diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index fedd720380807be1cec6e7ceff9cbab5f159e590..df0f385f929da7689ab509905ba7a76ce452122c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,7 +3,7 @@ build_kaniko_command: variables: # To push to a specific docker tag other than latest(the default), amend the --destination parameter, e.g. --destination $CI_REGISTRY_IMAGE:$CI_BUILD_REF_NAME # See https://docs.gitlab.com/ee/ci/variables/predefined_variables.html#variables-reference for available variables - IMAGE_DESTINATION: ${CI_REGISTRY_IMAGE}:ddpv3 + IMAGE_DESTINATION: ${CI_REGISTRY_IMAGE}:ddpv4 image: # We recommend using the CERN version of the Kaniko image: gitlab-registry.cern.ch/ci-tools/docker-image-builder name: gitlab-registry.cern.ch/ci-tools/docker-image-builder diff --git a/Dockerfile b/Dockerfile index 23e5c4abe6f43a16aece4479d92e140577db9d42..e0621e6fe335621d9c68c6ec1b150e4fd7a9d06c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,9 @@ FROM pytorch/pytorch:1.9.0-cuda10.2-cudnn7-runtime +ENV NB_USER jovyan +ENV NB_UID 1000 +ENV HOME /home/$NB_USER + RUN apt-get -qq update && \ apt-get -yqq install libpam-krb5 krb5-user && \ apt-get -yqq clean && \ @@ -9,22 +13,27 @@ RUN apt-get -qq update && \ python3-pip python3-wheel && \ rm -rf /var/lib/apt/lists/* +# create user and set required ownership +RUN useradd -M -s /bin/bash -N -u ${NB_UID} ${NB_USER} \ + && mkdir -p ${HOME} \ + && chown -R ${NB_USER}:users ${HOME} \ + && chown -R ${NB_USER}:users /usr/local/bin -RUN mkdir -p /opt/regressor && \ - mkdir -p /opt/regressor/src/models \ +RUN mkdir -p ${HOME}/models \ && pip install h5py pyflakes comet_ml && export MKL_SERVICE_FORCE_INTEL=1 -WORKDIR /opt/regressor/src +WORKDIR ${HOME} -ADD wgan.py /opt/regressor/src/wgan.py -ADD wganHCAL.py /opt/regressor/src/wganHCAL.py +ADD wgan.py ${HOME}/wgan.py +ADD wganHCAL.py ${HOME}/wganHCAL.py -COPY ./models/* /opt/regressor/src/models/ +COPY ./models/* ${HOME}/models/ COPY docker/krb5.conf /etc/krb5.conf +RUN mkdir -p /etc/sudoers.d && echo "jovyan ALL=(ALL:ALL) NOPASSWD:ALL" > /etc/sudoers.d/jovyan +RUN echo 'PS1="${debian_chroot:+($debian_chroot)}@\h:\w\$ "' >> /etc/bash.bashrc -RUN chgrp -R 0 /opt/regressor \ - && chmod -R g+rwX /opt/regressor +USER $NB_USER ENTRYPOINT ["/bin/bash"]