How do I reduce a python (docker) image size using a multi-stage build?

ok so my solution is using wheel, it lets us compile on first image, create wheel files for all dependencies and install them in the second image, without installing the compilers FROM python:2.7-alpine as base RUN mkdir /svc COPY . /svc WORKDIR /svc RUN apk add –update \ postgresql-dev \ gcc \ musl-dev \ linux-headers … Read more

Share variable in multi-stage Dockerfile: ARG before FROM not substituted

ARGs only last for the build phase of a single image. For the multistage, renew the ARG by simply stating: ARG DARSHAN_VER after your FROM instructions. cf. https://docs.docker.com/engine/reference/builder/#arg ARG DARSHAN_VER=3.1.6 FROM fedora:29 as build ARG DARSHAN_VER RUN dnf install -y \ gcc \ make \ bzip2 bzip2-devel zlib zlib-devel RUN curl -O “ftp://ftp.mcs.anl.gov/pub/darshan/releases/darshan-${DARSHAN_VER}.tar.gz” \ && … Read more