Optimize Dockerfiles #1146

Closed
opened 2026-04-06 01:38:31 +02:00 by MrUnknownDE · 0 comments
Owner

Originally created by @dfunkt on 5/1/2024

Move some ARGs closer to the build stage (potentially improving caching):
Example: I usually set VW_VERSION to be the latest commit hash, without this change I'd have to also rebuild the dependencies even if they didn't change since the previous layers would get invalidated.

Remove redundant COPY commands:
They can be combined, no point in using extra layers if it can be avoided.

Remove redundant RUN command:
apt-get and xx-apt-get commands can be moved into the same RUN command, thus saving another layer.

Move CARGO_HOME's "&&" operator to the first line (improves consistency)

*Originally created by @dfunkt on 5/1/2024* Move some ARGs closer to the build stage (potentially improving caching): Example: I usually set VW_VERSION to be the latest commit hash, without this change I'd have to also rebuild the dependencies even if they didn't change since the previous layers would get invalidated. Remove redundant COPY commands: They can be combined, no point in using extra layers if it can be avoided. Remove redundant RUN command: apt-get and xx-apt-get commands can be moved into the same RUN command, thus saving another layer. Move CARGO_HOME's "&&" operator to the first line (improves consistency)
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/vaultwarden#1146