Browse files

Problem: isolated Linux testing, release builds

Currently, running some of the tests can be problematic
if SIT is also being used on that same machine by the same
user as SIT will try to pick up the existing user config.

Also, building releases requires the additional setup of
musl target.

Solution: provide a Docker container with the musl build environment
  • Loading branch information...
yrashk committed Jun 23, 2018
1 parent 6f129b6 commit 534a9253d22d261c65a56362c087d4a945ed5498
Showing with 23 additions and 0 deletions.
  1. +1 −0 .gitignore
  2. +7 −0 Makefile
  3. +3 −0 build-tools/linux-build-container/Dockerfile
  4. +12 −0 build-tools/linux-build-container/
@@ -2,3 +2,4 @@ target
@@ -1,7 +1,14 @@
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
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
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"
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
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"
rm -f ._docker_linux
@@ -0,0 +1,3 @@
FROM rust:1.26.2
RUN apt-get update && apt-get install -y cmake libgit2-dev musl-tools
RUN rustup target add x86_64-unknown-linux-musl
@@ -0,0 +1,12 @@
This container provides a convenient way to build and test sit in isolation
from the local environment (Linux-specific). This is particularly useful for
running integration tests that might inadvertently read user configuration and
fail because of that (or introduce undesired behaviour such as requiring gnupg
signatures and triggering gpg-agent popups) ir building releases.
A suggested way to run such isolated environment would be:
docker run -v /host/path/to/sit/repo:/sit -e CARGO_TARGET_DIR=/sit/test_target -ti <image tag>

0 comments on commit 534a925

Please sign in to comment.