Permalink
Browse files

Problem: make linux fails

It fails because within the container, when cargo is trying to download
crates, it gets permission denied. This is happening because we're
passing UID/GID of the current user and cargo is trying to write
globally.

Solution: make this command build in a designated directory
that we later allow anybody to overwrite
  • Loading branch information...
yrashk committed Nov 1, 2018
1 parent 4cbc727 commit 4fd6b1133fc88e331f3ee8217b2d9c3bdfb7bc70
Showing with 6 additions and 6 deletions.
  1. +6 −6 Makefile
@@ -1,18 +1,18 @@
.PHONY: test
osx: target/x86_64-apple-darwin/release/sit target/x86_64-apple-darwin/release/sit-web
linux: target/x86_64-unknown-linux-musl/release/sit target/x86_64-unknown-linux-musl/release/sit-web
osx: target/builds/x86_64-apple-darwin/release/sit
linux: target/builds/x86_64-unknown-linux-musl/release/sit
target/x86_64-apple-darwin/release/sit target/x86_64-apple-darwin/release/sit-web: build-tools/cross-compile-osx/Dockerfile sit-core sit-web sit
target/builds/x86_64-apple-darwin/release/sit: build-tools/cross-compile-osx/Dockerfile sit-core sit Makefile
docker build --iidfile ._docker_osx build-tools/cross-compile-osx
sed -i s/sha256://g ._docker_osx
docker run -u `id -u`:`id -g` -v `pwd`:/sit -w /sit -t `cat ._docker_osx` sh -c "cargo build --release --target=x86_64-apple-darwin"
docker run -u `id -u`:`id -g` -v `pwd`:/sit -w /sit -e CARGO_TARGET_DIR=/sit/target/builds -t `cat ._docker_osx` sh -c "cargo build --release --target=x86_64-apple-darwin && chmod -R o+w /sit/target/builds"
rm -f ._docker_osx
target/x86_64-unknown-linux-musl/release/sit target/x86_64-unknown-linux-musl/release/sit-web: build-tools/linux-build-container/Dockerfile sit-core sit-web sit
target/builds/x86_64-unknown-linux-musl/release/sit: build-tools/linux-build-container/Dockerfile sit-core sit Makefile
docker build --iidfile ._docker_linux build-tools/linux-build-container
sed -i s/sha256://g ._docker_linux
docker run -u `id -u`:`id -g` -v `pwd`:/sit -w /sit -t `cat ._docker_linux` sh -c "cargo build --release --target=x86_64-unknown-linux-musl && strip target/x86_64-unknown-linux-musl/release/sit target/x86_64-unknown-linux-musl/release/sit-web"
docker run -v `pwd`:/sit -w /sit -e CARGO_TARGET_DIR=/sit/target/builds -t `cat ._docker_linux` sh -c "cargo build --release --target=x86_64-unknown-linux-musl && chmod -R o+w /sit/target/builds && strip target/builds/x86_64-unknown-linux-musl/release/sit"
rm -f ._docker_linux
test:

0 comments on commit 4fd6b11

Please sign in to comment.