Skip to content

Commit 0162ffa

Browse files
Move compilation to root user to resolve permission issues
1 parent 37cf61c commit 0162ffa

File tree

2 files changed

+4
-13
lines changed

2 files changed

+4
-13
lines changed

Dockerfile

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,8 @@ RUN apt-get update && \
7272
# Static linking for C++ code
7373
RUN sudo ln -s "/usr/bin/g++" "/usr/bin/musl-g++"
7474

75-
# Allow sudo without a password.
76-
ADD sudoers /etc/sudoers.d/nopasswd
77-
78-
# Run all further code as user `rust`, and create our working directories
79-
# as the appropriate user.
80-
USER rust
75+
# Create a working directory
76+
ENV HOME=/home/rust
8177
RUN mkdir -p /home/rust/libs /home/rust/src
8278

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

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

171-
# Expect our source code to live in /home/rust/src. We'll run the build as
172-
# user `rust`, which will be uid 1000, gid 1000 outside the container.
166+
# Expect our source code to live in /home/rust/src.
173167
WORKDIR /home/rust/src

cargo-config.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
11
[build]
22
# Target musl-libc by default when running Cargo.
33
target = "x86_64-unknown-linux-musl"
4-
5-
[target.armv7-unknown-linux-musleabihf]
6-
linker = "arm-linux-gnueabihf-gcc"

0 commit comments

Comments
 (0)