8000 Split Dockerfile in two stages: builder and runtime. by pablospe · Pull Request #2347 · colmap/colmap · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Split Dockerfile in two stages: builder and runtime. #2347

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

Merged
merged 1 commit into from
Jan 12, 2024

Conversation

pablospe
Copy link
Contributor

Splitting the Dockerfile in two stages reduces the size of the final image considerably, since all the build dependencies are not needed.

You can still create the tag for the stages separately:

docker build --target builder -t colmap:builder .
docker build --target runtime -t colmap:runtime .

But the default command (without --target) is the last stage, so:

docker build -t colmap:latest .

will refer to --target runtime because it is the last stage in the Dockerfile.

@ahojnnes
Copy link
Contributor

Thanks, great improvement.

@ahojnnes ahojnnes merged commit fb3fa6a into colmap:main Jan 12, 2024
@pablospe
Copy link
Contributor Author

FYI, this PR reduces the docker image ~3GB :)

image

(image from https://hub.docker.com/r/colmap/colmap)

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
0