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

Multistage Docker Builds #32

Open
JoshLoecker opened this issue Sep 1, 2022 · 0 comments
Open

Multistage Docker Builds #32

JoshLoecker opened this issue Sep 1, 2022 · 0 comments
Labels
priority:normal state:open This is still being planned subsystem:docker Relates to docker type:bug This isn't working

Comments

@JoshLoecker
Copy link
Member

The use of multistage builds can greatly reduce the size of the final docker image. See below.

DockerHub Page to Multistage Builds

One of the most challenging things about building images is keeping the image size down. Each instruction in the Dockerfile adds a layer to the image, and you need to remember to clean up any artifacts you don’t need before moving on to the next layer. To write a really efficient Dockerfile, you have traditionally needed to employ shell tricks and other logic to keep the layers as small as possible and to ensure that each layer has the artifacts it needs from the previous layer and nothing else.

It was actually very common to have one Dockerfile to use for development (which contained everything needed to build your application), and a slimmed-down one to use for production, which only contained your application and exactly what was needed to run it. This has been referred to as the “builder pattern”. Maintaining two Dockerfiles is not ideal.

Additional Links
How to Optimize Docker Images using Dive
How do I 'copy' installed R-packages from the 1ste stage to 2nd stage using multistage building on a R-base image?

@JoshLoecker JoshLoecker added type:bug This isn't working priority:normal state:open This is still being planned subsystem:docker Relates to docker labels Sep 1, 2022
@JoshLoecker JoshLoecker moved this to Open in MADRID Sep 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority:normal state:open This is still being planned subsystem:docker Relates to docker type:bug This isn't working
Projects
Status: Open
Development

No branches or pull requests

1 participant