Skip to content

Optimize Dockerfile-workers #18292

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

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from

Conversation

AndrewFerr
Copy link
Member

@AndrewFerr AndrewFerr commented Mar 28, 2025

  • Use a uv:python image for the first build layer, to reduce the number of intermediate images required, as the
    main Dockerfile uses that image already
  • Use a cache mount for apt commands
  • Skip a pointless install of redis-server, since the redis Docker image is copied from instead
  • Move some RUN steps out of the final image layer & into the build layer

Depends on #18275

Pull Request Checklist

  • Pull request is based on the develop branch
  • Pull request includes a changelog file. The entry should:
    • Be a short description of your change which makes sense to users. "Fixed a bug that prevented receiving messages from other servers." instead of "Moved X method from EventStore to EventWorkerStore.".
    • Use markdown where necessary, mostly for code blocks.
    • End with either a period (.) or an exclamation mark (!).
    • Start with a capital letter.
    • Feel free to credit yourself, by adding a sentence "Contributed by @github_username." or "Contributed by [Your Name]." to the end of the entry.
  • Code style is correct
    (run the linters)

@AndrewFerr AndrewFerr requested a review from a team as a code owner March 28, 2025 16:00
Do this to reduce the number of intermediate images required, as the
main Dockerfile uses that image already.
Do it in the same way as is done in the main Dockerfile
Nothing from the apt-installed redis-server ends up getting copied into
the runtime image (only the redis docker image is used instead), so skip
installing it.
Add RUN commands to the deps_base build layer to replace some commands
done in the runtime layer, and to be able to COPY some dirs with proper
ownership instead of having to tweak them in the runtime image.
UID/GID ownership of top-level directories isn't preserved by COPY, so
set the desired ownership with COPY --chown instead.
@AndrewFerr AndrewFerr force-pushed the docker/worker-image-tweaks branch from c7b73b4 to 0e984ec Compare April 1, 2025 13:26
@AndrewFerr
Copy link
Member Author

The latest batch of commits is just a rebase onto develop, since #18275 has since been merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant