forked from maidsafe/sn_data_types
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.build
36 lines (31 loc) · 1.38 KB
/
Dockerfile.build
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
FROM rust:latest
RUN addgroup --gid 1000 maidsafe && \
adduser --uid 1000 --ingroup maidsafe --home /home/maidsafe --shell /bin/sh --disabled-password --gecos "" maidsafe && \
# The parent container sets this to the 'staff' group, which causes problems
# with reading code stored in Cargo's registry.
chgrp -R maidsafe /usr/local
# Install fixuid for dealing with permissions issues with mounted volumes.
# We could perhaps put this into a base container at a later stage.
RUN USER=maidsafe && \
GROUP=maidsafe && \
curl -SsL https://github.com/boxboat/fixuid/releases/download/v0.4/fixuid-0.4-linux-amd64.tar.gz | tar -C /usr/local/bin -xzf - && \
chown root:root /usr/local/bin/fixuid && \
chmod 4755 /usr/local/bin/fixuid && \
mkdir -p /etc/fixuid && \
printf "user: $USER\ngroup: $GROUP\n" > /etc/fixuid/config.yml
RUN apt-get update -y && \
mkdir /target && \
chown maidsafe:maidsafe /target && \
mkdir /usr/src/safe-nd && \
chown maidsafe:maidsafe /usr/src/safe-nd && \
apt-get clean -y && \
rm -rf /var/lib/apt/lists/*
WORKDIR /usr/src/safe-nd
COPY . .
USER maidsafe:maidsafe
ENV CARGO_TARGET_DIR=/target
RUN rustup component add rustfmt clippy && \
cargo clippy --verbose --release --all-targets && \
cargo test --verbose --release && \
find /target/release/ -maxdepth 1 -type f -exec rm '{}' \;
ENTRYPOINT ["fixuid", "-q"]