Skip to content

Commit

Permalink
Fix build in Docker targets
Browse files Browse the repository at this point in the history
There are some inconveniences when building in container and writing in
shared volume. The biggest of those are that by doing that the resulting
target directory is owned by root and in some rare cases - you end up
with unnecessary files in the target directory. To solve that the
project files are copied in the container and not mounted and the target
directory is copied back to the host when the build finishes.
  • Loading branch information
VMitov committed Apr 1, 2018
1 parent ab192f2 commit 74f5d5f
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion Makefile.docker
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,19 @@ PROJECTROOT=$(shell pwd)
# The name for the docker builder image
BUILDER_CONTAINER_NAME="milagro-crypto/amcl-builder"

make = docker run --rm -v $(PROJECTROOT):/src -w /src --user `id -u` -e WINEPREFIX=/tmp/.wine $(BUILDER_CONTAINER_NAME) sh -c "mkdir -p /tmp/.wine && make $1"
define make
rm -rf target
docker create \
--env WINEPREFIX=/tmp/.wine \
--name builder \
--workdir /src \
$(BUILDER_CONTAINER_NAME) sh -c "mkdir -p /tmp/.wine && make $1"
docker cp . builder:/src
-docker start -ai builder
docker cp builder:/src/target .
docker stop builder
docker rm builder
endef

all: builder

Expand Down

0 comments on commit 74f5d5f

Please sign in to comment.