build:
context: ./build
args:
USERID: ${USERID}
GROUPID: ${GROUPID}
So you're passing the local uid and gid as variables to the build process.(1) FROM image:tag
WORKDIR "/application"
ARG USERID
ARG GROUPID
RUN if [ ${USERID:-0} -ne 0 ] && [ ${GROUPID:-0} -ne 0 ]; then userdel -f www-data ;fi \
&& if getent group ${GROUPID} ; then groupdel www-data; fi \
&& groupadd -g ${GROUPID} www-data && useradd -m -l -u ${USERID} -g www-data www-data -s /bin/bash \
(1) $USERID and $USERID might not be available as an environment variable on your system. To do so, place this under .bashrc: export USERID=$(id -u)
export GROUPID=$(id -g)