forked from veracruz-project/veracruz-docker-image
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
56 lines (51 loc) · 1.6 KB
/
Dockerfile
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# docker image for developing and testing Veracruz.
#
# AUTHORS
#
# The Veracruz Development Team.
#
# COPYRIGHT
#
# See the `LICENSE.markdown` file in the Veracruz root directory for licensing
# and copyright information.
#
# NOTE: We try to follow the guide in https://docs.docker.com/develop/develop-images/dockerfile_best-practices/
# Each RUN contains a bundle of steps, which reduces the cache.
ARG TEE
FROM veracruz/${TEE}:latest
ARG USER=root
ARG UID=0
ARG DOCKER_GROUP_ID=0
ENV DEBIAN_FRONTEND noninteractive
# If you want to use a local cache, you should bind in a local cache directory to /cache
ENV XARGO_HOME=/cache/xargo \
SCCACHE_DIR=/cache/sccache \
SCCACHE_CACHE_SIZE=10G \
PATH=/cache/cargo/bin:$PATH
# Use bash as the default
SHELL ["/bin/bash", "-c"]
# add a user
RUN \
mkdir -p /work; \
if [ "$USER" != "root" ] ; then \
useradd -u $UID -m -p `openssl rand -base64 32` -s /bin/bash $USER ; \
mkdir /home/$USER/.rustup ; \
chown $USER /home/$USER/.rustup ; \
ln -s /usr/local/rustup/toolchains /home/$USER/.rustup/ ; \
if [ "$DOCKER_GROUP_ID" != "0" ] ; then \
groupadd -g ${DOCKER_GROUP_ID} docker ; \
usermod -a -G docker $USER ; \
fi ; \
if getent group nixbld &>/dev/null ; then \
usermod -a -G nixbld $USER ; \
fi ; \
if getent group ne &>/dev/null ; then \
usermod -a -G ne $USER ; \
fi ; \
if [ -d /nix ] ; then \
chown -R $(USER) /nix ; \
chmod 0755 /nix ; \
fi ; \
fi
WORKDIR /work/veracruz
USER $USER