-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.user
More file actions
19 lines (16 loc) · 839 Bytes
/
Dockerfile.user
File metadata and controls
19 lines (16 loc) · 839 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
FROM pcourbin/bookdown:extended
# Or FROM pcourbin/bookdown:base
ARG b_mainFile=index.Rmd
ENV mainFile=$b_mainFile
ARG uid=0
ENV b_uid=$uid
ARG bookdownuser=root
ENV b_bookdownuser=$bookdownuser
# add non-root user (workaround for docker)
RUN testName="$(awk -v uid=$b_uid -F":" '{ if($3==uid){print $1} }' /etc/passwd)" && \
if [ "${testName}" = "" ] && [ "${b_bookdownuser}" != "root" ] ; then useradd -m -u $b_uid $b_bookdownuser ; echo "Create user '${b_bookdownuser}'" ;\
else (if [ $testName != "" ] && [ "$b_bookdownuser" != "$testName" ] ; then \
(>&2 echo "You have a choose a uid '${b_uid}' which is already taken. If you want to use this uid, please, juste select as 'bookdownuser' the name '${testName}'") ; fi ; ); \
fi && \
(>&2 echo We will try to use the user $b_uid / $b_bookdownuser) ;
USER $b_bookdownuser