Use python:3.10-slim as base image instead of python:3.10#45
Open
Use python:3.10-slim as base image instead of python:3.10#45
Conversation
"CET" is not a valid timezone all year around. "Europe/Stockholm" is.
This newer version has ready-built wheel packages for Python 3.10, so we won't need to have gcc installed in our production runner image.
This will shrink the size of the resulting image significantly.
In the `master` branch currently, the image is around 1.2 GB, while this
build clocks in at 300MB. See details below:
```
$ docker image ls|grep --color=never git.stacken.kth.se/stacken/fingerweb
git.stacken.kth.se/stacken/fingerweb python-slim 76804258796a 4 minutes ago 300MB
git.stacken.kth.se/stacken/fingerweb master ecff86210fea 29 minutes ago 1.2GB
```
The image in `master`:
```
% docker image history git.stacken.kth.se/stacken/fingerweb:master
IMAGE CREATED CREATED BY SIZE COMMENT
ecff86210fea 32 minutes ago CMD ["/bin/sh" "-c" "/app/entrypoint.sh"] 0B buildkit.dockerfile.v0
<missing> 32 minutes ago ADD entrypoint.sh /app/entrypoint.sh # build… 310B buildkit.dockerfile.v0
<missing> 32 minutes ago ADD conf/nginx.conf /etc/nginx/nginx.conf # … 728B buildkit.dockerfile.v0
<missing> 32 minutes ago RUN /bin/sh -c sed -i "s/XXX_BUILD_DATE_XXX/… 4.17kB buildkit.dockerfile.v0
<missing> 32 minutes ago WORKDIR /app 0B buildkit.dockerfile.v0
<missing> 32 minutes ago RUN /bin/sh -c pip install -r /app/requireme… 50.2MB buildkit.dockerfile.v0
<missing> 32 minutes ago COPY --chown=finger /app /app # buildkit 1.45MB buildkit.dockerfile.v0
<missing> 33 hours ago RUN /bin/sh -c apt-get update && apt-get -y… 57.3MB buildkit.dockerfile.v0
<missing> 33 hours ago RUN /bin/sh -c adduser --no-create-home --ge… 4.49kB buildkit.dockerfile.v0
<missing> 33 hours ago EXPOSE map[8080/tcp:{}] 0B buildkit.dockerfile.v0
<missing> 2 weeks ago CMD ["python3"] 0B buildkit.dockerfile.v0
<missing> 2 weeks ago RUN /bin/sh -c set -eux; for src in idle3 p… 36B buildkit.dockerfile.v0
<missing> 2 weeks ago RUN /bin/sh -c set -eux; wget -O python.ta… 55.7MB buildkit.dockerfile.v0
<missing> 2 weeks ago ENV PYTHON_SHA256=de6517421601e39a9a3bc3e1bc… 0B buildkit.dockerfile.v0
<missing> 2 weeks ago ENV PYTHON_VERSION=3.10.20 0B buildkit.dockerfile.v0
<missing> 2 weeks ago ENV GPG_KEY=A035C8C19219BA821ECEA86B64E628F8… 0B buildkit.dockerfile.v0
<missing> 2 weeks ago RUN /bin/sh -c set -eux; apt-get update; a… 17.8MB buildkit.dockerfile.v0
<missing> 2 weeks ago ENV LANG=C.UTF-8 0B buildkit.dockerfile.v0
<missing> 2 weeks ago ENV PATH=/usr/local/bin:/usr/local/sbin:/usr… 0B buildkit.dockerfile.v0
<missing> 2 weeks ago RUN /bin/sh -c set -ex; apt-get update; ap… 656MB buildkit.dockerfile.v0
<missing> 2 weeks ago RUN /bin/sh -c set -eux; apt-get update; a… 185MB buildkit.dockerfile.v0
<missing> 2 weeks ago RUN /bin/sh -c set -eux; apt-get update; a… 60.2MB buildkit.dockerfile.v0
<missing> 2 weeks ago # debian.sh --arch 'amd64' out/ 'trixie' '@1… 120MB debuerreotype 0.17
```
The image for this commit:
```
% docker image history git.stacken.kth.se/stacken/fingerweb:python-slim
IMAGE CREATED CREATED BY SIZE COMMENT
76804258796a 6 minutes ago CMD ["/bin/sh" "-c" "/app/entrypoint.sh"] 0B buildkit.dockerfile.v0
<missing> 6 minutes ago ADD entrypoint.sh /app/entrypoint.sh # build… 310B buildkit.dockerfile.v0
<missing> 6 minutes ago ADD conf/nginx.conf /etc/nginx/nginx.conf # … 728B buildkit.dockerfile.v0
<missing> 6 minutes ago RUN /bin/sh -c sed -i "s/XXX_BUILD_DATE_XXX/… 4.17kB buildkit.dockerfile.v0
<missing> 6 minutes ago WORKDIR /app 0B buildkit.dockerfile.v0
<missing> 6 minutes ago RUN /bin/sh -c pip install -r /app/requireme… 63.8MB buildkit.dockerfile.v0
<missing> 7 minutes ago COPY --chown=finger /app /app # buildkit 1.45MB buildkit.dockerfile.v0
<missing> 8 minutes ago RUN /bin/sh -c apt-get update && apt-get -y… 113MB buildkit.dockerfile.v0
<missing> 2 hours ago RUN /bin/sh -c adduser --no-create-home --ge… 4.45kB buildkit.dockerfile.v0
<missing> 2 hours ago EXPOSE map[8080/tcp:{}] 0B buildkit.dockerfile.v0
<missing> 2 weeks ago CMD ["python3"] 0B buildkit.dockerfile.v0
<missing> 2 weeks ago RUN /bin/sh -c set -eux; for src in idle3 p… 36B buildkit.dockerfile.v0
<missing> 2 weeks ago RUN /bin/sh -c set -eux; savedAptMark="$(a… 39.4MB buildkit.dockerfile.v0
<missing> 2 weeks ago ENV PYTHON_SHA256=de6517421601e39a9a3bc3e1bc… 0B buildkit.dockerfile.v0
<missing> 2 weeks ago ENV PYTHON_VERSION=3.10.20 0B buildkit.dockerfile.v0
<missing> 2 weeks ago ENV GPG_KEY=A035C8C19219BA821ECEA86B64E628F8… 0B buildkit.dockerfile.v0
<missing> 2 weeks ago RUN /bin/sh -c set -eux; apt-get update; a… 3.81MB buildkit.dockerfile.v0
<missing> 2 weeks ago ENV LANG=C.UTF-8 0B buildkit.dockerfile.v0
<missing> 2 weeks ago ENV PATH=/usr/local/bin:/usr/local/sbin:/usr… 0B buildkit.dockerfile.v0
<missing> 2 weeks ago # debian.sh --arch 'amd64' out/ 'trixie' '@1… 78.6MB debuerreotype 0.17
```
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This will shrink the size of the resulting image significantly, because the
python:3.10image is chunky compared to its-slimsibling.In the
masterbranch currently, the image is around 1.2 GB, while thisbuild clocks in at 300MB. See details below:
The image in
master:The image for this commit: