-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Slim down docker images #864
Conversation
810c9bf
to
d421941
Compare
@@ -11,7 +11,6 @@ jedi==0.18.2 | |||
boto==2.49.0 | |||
boto3==1.19.4 | |||
botocore==1.22.9 | |||
cchardet==2.1.7 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cchardet is a faster version of chardet. We don't often need to detect charset on the fly and if we need to we can just use chardet in Python. cchardet Requires a C++ compiler to build and it used to be an optional dependency of requests. It is also abandoned - see the drama here and everybody moved away from it since it does not work on Python 3.10.
ENV \ | ||
TZ="Etc/GMT" \ | ||
LANG="en_US.UTF-8" \ | ||
LC_ALL="en_US.UTF-8" \ | ||
DEBIAN_FRONTEND=noninteractive \ | ||
PATH="/opt/venv/bin:$PATH" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just made one layer from all the env vars.
vim \ | ||
libffi-dev \ | ||
&& locale-gen en_US.UTF-8 \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We used to install language-pack-en
, that just includes all the English variants around the world, but we only need en_US.UTF-8
gettext-base \ | ||
language-pack-en \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that was substituted with locale-gen en_US.UTF-8
COPY --chown=sync-engine:sync-engine ./ ./ | ||
RUN python3 -m pip install pip==24.0 virtualenv==20.25.1 && \ | ||
python3 -m virtualenv /opt/venv && \ | ||
/opt/venv/bin/python3 -m pip install --no-deps -r requirements/prod.txt -r requirements/test.txt && \ | ||
/opt/venv/bin/python3 -m pip install --no-cache --no-deps -r requirements/prod.txt -r requirements/test.txt && \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need to store wheels in the image since they will be only used once for install and it increases image size.
35b09e3
to
27603af
Compare
gpg \ | ||
gpg-agent \ | ||
dirmngr \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those were previously installed from recommended, we need those for some things devops uses in the upstream image.
I was revising the Docker image to realize that we have quite a number of packages that are not needed. Most of them used to be build time dependencies of Python packages that can be now installed from binary wheels.
This: