Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Further reduce the size of the docker image #3972
You can do it with the builder container pattern : https://docs.docker.com/develop/develop-images/multistage-build/
That way you build synapse then throw away the container(s) you built it in and just copy the required bits into a new container - it makes it a little easier than having that one multi-line RUN command to try to make a single image.
So - we can deploy this for a slight gain, if we remove the "rm -rf /synapse" as that's not doing anything useful to the size
Doing it properly will be about using the multi-stage builder to:
FROM python-alpine... RUN apk install runtime_deps RUN apk install build_deps # seperate layers, because we can re-use the layer with just the runtime deps below, speeding up builds I think. pip install to /target/ # somehow, how do you do that in python other bits here FROM python-alpine RUN apk install runtime_deps # this is ok as a separate layer COPY --from = 0 /target
Then i think we get to re-use layers where we want them - runtime dependencies, and build dependencies, without affecting the end image size.