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

Replace COPY with bind mount in modules examples #857

Merged
merged 4 commits into from
Jan 9, 2024

Conversation

jnoordsij
Copy link
Contributor

Proposed changes

In the modules examples, a COPY from the builder is done to ensure it's output is available to the final image. However, this operation results in the layer being part of the final image and thus slightly bloating it.

By using a bind mount for the RUN operation, the builder content is exposed to this particular run operation only, in a read-only manner, and will not be part of the final image in any way.

See also https://docs.docker.com/engine/reference/builder/#run---mount.

Checklist

Before creating a PR, run through this checklist and mark each as complete:

  • I have read the CONTRIBUTING document
  • I have run ./update.sh and ensured all entrypoint/Dockerfile template changes have been applied to the relevant image entrypoint scripts & Dockerfiles
  • If applicable, I have added tests that prove my fix is effective or that my feature works
  • If applicable, I have checked that any relevant tests pass after adding my changes
  • I have updated any relevant documentation

@thresheek
Copy link
Collaborator

Hi @jnoordsij!

It looks like the tests fail since we're using non-buildkit builds... This means we'd need to adapt the tests and document this on modules/ for users to be aware of the limitation.

@jnoordsij
Copy link
Contributor Author

jnoordsij commented Jan 9, 2024

Hi @jnoordsij!

It looks like the tests fail since we're using non-buildkit builds... This means we'd need to adapt the tests and document this on modules/ for users to be aware of the limitation.

Ah yeah, I didn't realise this would be enforced in these builds as well. I've updated the tests and added some documentation notes. Let's hope the tests will succeed now!

Edit: tests look all fine now!

@thresheek thresheek merged commit 610fb56 into nginxinc:master Jan 9, 2024
9 checks passed
@thresheek
Copy link
Collaborator

Thanks for the contribution and fast fixes!

@jnoordsij jnoordsij deleted the patch-1 branch January 9, 2024 18:50
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