0001 ARG IMAGE 0002 FROM ${IMAGE} 0003 0004 # fundamental: language, timezone 0005 ARG LANG 0006 ARG LANGUAGE 0007 ARG TIMEZONE 0008 ENV LANG=${LANG} 0009 ENV LC_CTYPE=${LANG} 0010 ENV LC_MESSAGES=${LANG} 0011 ENV LC_ALL= 0012 ENV LANGUAGE=${LANGUAGE} 0013 ENV TZ=${TIMEZONE} 0014 0015 # we assume Xephyr uses this $DISPLAY 0016 ARG XEPHYR_DISPLAY 0017 0018 # apt: not interactive 0019 ENV DEBIAN_FRONTEND noninteractive 0020 0021 ############################################################ 0022 # Package (APT) dependency definitions 0023 # XXX We know this style IS NOT RECOMMENDED by Docker culture, 0024 # XXX but the Dockerfile is too stubborn, 0025 # XXX so we use the following classified definitions. 0026 ############################################################ 0027 0028 # apt: base system 0029 ARG PKG_BASE="locales tzdata sudo procps" 0030 ARG PKG_UTILTIES 0031 ARG PKG_MODEL_SPECIFIC="systemd coreutils python3 python3-pip telnet curl" 0032 0033 RUN apt-get update && \ 0034 apt-get install -y ${PKG_BASE} \ 0035 ${PKG_MODEL_SPECIFIC} \ 0036 ${PKG_UTILTIES} && \ 0037 apt-get -y autoremove && \ 0038 apt-get clean && \ 0039 rm -rf /var/lib/apt/lists/* 0040 0041 RUN sed -i "/${LANG}/s/^# //" /etc/locale.gen && locale-gen && update-locale LANG=${LANG} 0042 0043 ARG SANDBOX_UID=1000 0044 ARG SANDBOX_USER=docker 0045 ARG SANDBOX_PASSWORD=docker 0046 ARG SANDBOX_HOME=/home/$SANDBOX_USER} 0047 RUN [ $SANDBOX_UID -ne 0 ] && { useradd -m --uid ${SANDBOX_UID} --groups sudo,video --shell /bin/bash ${SANDBOX_USER} && echo ${SANDBOX_USER}:${SANDBOX_PASSWORD} | chpasswd; } || true 0048 0049 # install mysql connector via pip (python package system) 0050 RUN /usr/bin/pip3 install mysql-connector-python 0051 0052 ############################################################ 0053 # Finally, we set up bootstrap scripts under /sandbox/ and 0054 # /home/${SANDBOX_USER} home directory. 0055 ############################################################ 0056 RUN mkdir /sandbox 0057 COPY files /sandbox 0058 RUN find /sandbox -type d -name CVS | xargs rm -fr || true 0059 0060 WORKDIR ${SANDBOX_HOME} 0061 RUN chown -R ${SANDBOX_USER} ./ 0062 USER ${SANDBOX_USER} 0063 0064 ENTRYPOINT ["/sandbox/entrypoint.sh"]