-
-
Notifications
You must be signed in to change notification settings - Fork 708
Optimize Dockerfile and build process #4039
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
base: develop
Are you sure you want to change the base?
Conversation
Signed-off-by: wilmardo <[email protected]>
Signed-off-by: wilmardo <[email protected]>
…minimum Signed-off-by: wilmardo <[email protected]>
Signed-off-by: wilmardo <[email protected]>
thanks for this and the other PR's |
No worries, let me know if there are any questions also @theProf feel free to shoot some comments. I decided on less stages to keep the Dockerfile more simple and readable |
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.
Thank you for the improvements @wilmardo 😃
COPY --link requirements.txt ./ | ||
|
||
RUN <<EOF | ||
# remove Development dependencies from requirements.txt | ||
sed -i '/# Development/,$d' requirements.txt | ||
apk add --no-cache --virtual .build-deps \ | ||
build-base \ | ||
cargo \ | ||
curl \ | ||
g++ \ | ||
gcc \ | ||
jpeg-dev \ | ||
libffi-dev \ | ||
libwebp-dev \ | ||
musl-dev \ | ||
postgresql-dev \ | ||
python3-dev \ | ||
openldap-dev \ | ||
openssl-dev \ | ||
xmlsec \ | ||
xmlsec-dev \ | ||
rust \ | ||
zlib-dev | ||
python -m venv venv | ||
venv/bin/python -m pip install --upgrade pip | ||
venv/bin/pip debug -v | ||
venv/bin/pip install wheel==0.45.1 | ||
venv/bin/pip install setuptools_rust==1.10.2 | ||
venv/bin/pip install -r requirements.txt --no-cache-dir | ||
apk --purge del .build-deps | ||
EOF |
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.
I suggest moving building the venv to a separate stage. This way we would have one stage for the frontend and its build dependencies, one stage for the backend and its build dependencies, and one final image with runtime dependencies.
|
||
RUN <<EOF | ||
# remove Development dependencies from requirements.txt | ||
sed -i '/# Development/,$d' requirements.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.
Rather out of scope for this PR, but I think the Python dev dependencies should be moved to another file to cleanly separate them, for example in requirements_dev.txt
.
Somewhat of a simpler implementation of #3919
@theProf I cherry-picked some of your work to not discard your work :)
docker build
ends up as a working image instead of missing the compiled frontend.git
directory can be omitted from the container