Skip to content

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
@coderbirju coderbirju requested review from a team as code owners June 30, 2025 21:18
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