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

change make docker to copy from finished container instead of mounting #93

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

akdor1154
Copy link

@akdor1154 akdor1154 commented Jan 16, 2018

Currently make docker works by mounting the output dir on the host into the build container.
This means it can't be used when the build environment is itself a docker container.

This PR changes the docker build behaviour to instead run the build container without mounting, and then copying the binary out of the finished container before removing it.

Benefits:

  • works when building inside container environments
  • your own Travis is probably a good use case for this

Drawbacks:

  • slightly more complicated
  • because the build container is removed each time, make docker builds from scratch every time (if this is an issue it could be worked around with the drawback of more complexity in the Makefile)
  • requires Docker 1.8

@simonbuchan
Copy link

Also required for Windows (at least using WSL) where the only way to use docker is export DOCKER_HOST=tcp://localhost:2375, e.g. "remote" connection to docker for windows.

I did pretty much exactly this except for docker rm at the end of the docker: target, which should match the behavior of the previous docker run --rm, the difference being that if run(?) or cp fails, the container is left over.

Shouldn't docker rm -v be used? Not sure if (unmounted) volumes are created and thus leaked.

Base automatically changed from master to main February 18, 2021 20:00
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