Skip to content
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

Chore: Optimise Dockerfile for build cache #1627

Closed
benhovinga opened this issue Mar 11, 2025 · 0 comments · Fixed by #1628
Closed

Chore: Optimise Dockerfile for build cache #1627

benhovinga opened this issue Mar 11, 2025 · 0 comments · Fixed by #1628
Labels
ACK_OBTAINED Issue acknowledged from core team so work can be done to fix it.

Comments

@benhovinga
Copy link
Contributor

Currently the Dockerfile downloads and installs the python packages every time during the image build process. These packages can be cached to save some time (15-ish seconds) when rebuilding the image. This is mostly useful during development and can (depending on the config) speed up deployments.

This can be accomplished by installing the python dependencies first before copying the rest of the project. Such as this:

FROM python:latest
WORKDIR /usr/src/app

COPY requirements.txt Makefile ./
RUN make install-python-requirements

COPY . .
RUN make generate-site

EXPOSE 8000
ENTRYPOINT ["make", "serve"]

More information on this concept can be found through these resources:

@szh szh added the ACK_OBTAINED Issue acknowledged from core team so work can be done to fix it. label Mar 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ACK_OBTAINED Issue acknowledged from core team so work can be done to fix it.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants