Skip to content

Commit

Permalink
Move compilation to root user to resolve permission issues
Browse files Browse the repository at this point in the history
  • Loading branch information
TilBlechschmidt committed Jul 28, 2020
1 parent 37cf61c commit 0162ffa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
14 changes: 4 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,8 @@ RUN apt-get update && \
# Static linking for C++ code
RUN sudo ln -s "/usr/bin/g++" "/usr/bin/musl-g++"

# Allow sudo without a password.
ADD sudoers /etc/sudoers.d/nopasswd

# Run all further code as user `rust`, and create our working directories
# as the appropriate user.
USER rust
# Create a working directory
ENV HOME=/home/rust
RUN mkdir -p /home/rust/libs /home/rust/src

# Set up our path with all our binary directories, including those for the
Expand All @@ -91,8 +87,7 @@ ENV PATH=/home/rust/.cargo/bin:/usr/local/musl/bin:/usr/local/sbin:/usr/local/bi
# manually.
RUN curl https://sh.rustup.rs -sSf | \
sh -s -- -y --default-toolchain $TOOLCHAIN && \
rustup target add x86_64-unknown-linux-musl && \
rustup target add armv7-unknown-linux-musleabihf
rustup target add x86_64-unknown-linux-musl
ADD cargo-config.toml /home/rust/.cargo/config

# Set up a `git credentials` helper for using GH_USER and GH_TOKEN to access
Expand Down Expand Up @@ -168,6 +163,5 @@ RUN cargo install -f cargo-audit && \
cargo install -f mdbook-graphviz && \
rm -rf /home/rust/.cargo/registry/

# Expect our source code to live in /home/rust/src. We'll run the build as
# user `rust`, which will be uid 1000, gid 1000 outside the container.
# Expect our source code to live in /home/rust/src.
WORKDIR /home/rust/src
3 changes: 0 additions & 3 deletions cargo-config.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
[build]
# Target musl-libc by default when running Cargo.
target = "x86_64-unknown-linux-musl"

[target.armv7-unknown-linux-musleabihf]
linker = "arm-linux-gnueabihf-gcc"

0 comments on commit 0162ffa

Please # to comment.