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(Dockerfile): use COPY --link flag #3869

Merged
merged 4 commits into from
Jan 22, 2025

Conversation

iainsproat
Copy link
Contributor

@iainsproat iainsproat commented Jan 22, 2025

Description & motivation

Uses Docker COPY --link to reduce probability of build cache being invalidated https://docs.docker.com/reference/dockerfile/#benefits-of-using---link

Changes:

To-do before merge:

Screenshots:

Validation of changes:

Checklist:

  • My pull request follows the guidelines in the Contributing guide?
  • My pull request does not duplicate any other open Pull Requests for the same update/change?
  • My commits are related to the pull request and do not amend unrelated code or documentation.
  • My code follows a similar style to existing code.
  • I have added appropriate tests.
  • I have updated or added relevant documentation.

References

- hack to only fetch a single commit with depth 1
- cloning the entire repository was subject to cache being missed
- link forces COPY to reuse already built layers in subsequent builds
- This is especially important for multi-stage builds where a COPY --from statement would previously get invalidated if any previous commands in the same stage changed, , causing the need to rebuild the intermediate stages again
@iainsproat iainsproat changed the title Iain/postgres dockerfile cache chore(Dockerfile): use COPY --link flag Jan 22, 2025
Copy link
Contributor

📸 Preview service has generated an image.

Copy link
Contributor

📸 Preview service has generated an image.

@iainsproat iainsproat marked this pull request as ready for review January 22, 2025 14:29
@iainsproat iainsproat merged commit e6adced into main Jan 22, 2025
28 of 30 checks passed
@iainsproat iainsproat deleted the iain/postgres-dockerfile-cache branch January 22, 2025 15:03
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.

2 participants