Speed up Docker build in CI environment 🏎

"If you’re building Docker images on your laptop for tagging release, be in shame, and then change your behavior" - Kelsey Hightower, 2018 That’s right! If you are building Docker images in your local machine, you are doing it wrong. We don’t want to build anything on our laptop. When we are tagging a new release for production, staging, or even for a dev environment, the build should trigger automatically to save time and avoid the hassle. But Docker builds in a CI environment might not be faster than our local machine if we don’t configure it properly. In this write-up, I’ll try to share my experience on how I achieved more speed building Docker images in a CI environment. ...

January 14, 2020 · 5 min · Anis Khan

How I reduced the size of a Docker image

December 2017, at work, I had to deploy a micro-service very very quickly to support the core service of ours. The framework I used for this one was Sanic, (a micro-framework written in Python 3.5 with Async support). So, I get the python image first along with dependencies in a requirements.txt file. This is how it went: FROM python:3.6 ENV PYTHONUNBUFFERED 1 ENV TZ=Asia/Dhaka RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone RUN mkdir /app ADD requirements.txt ./app/ WORKDIR /app RUN pip install -r requirements.txt COPY ./code ./app EXPOSE 5000 After building this Dockerfile, the size of the image was 780 MB! ...

June 9, 2018 · 3 min · Anis Khan