From 5646680c436f8a0837596a76726bc5233f75e236 Mon Sep 17 00:00:00 2001 From: B13nch3n <b13nch3n_01@theb-si.de> Date: Mon, 30 May 2022 11:01:35 +0200 Subject: [PATCH] Adapt to new way of providing the ModelCIF dict --- validation/Dockerfile | 52 ++++++++++++++++++++----------------------- 1 file changed, 24 insertions(+), 28 deletions(-) diff --git a/validation/Dockerfile b/validation/Dockerfile index 1393478..2af9344 100644 --- a/validation/Dockerfile +++ b/validation/Dockerfile @@ -1,5 +1,5 @@ -ARG VERSION_PYTHON="3.6.15" -ARG VERSION_BASE_IMAGE="python:${VERSION_PYTHON}-alpine3.15" +ARG VERSION_PYTHON="3.7" +ARG VERSION_BASE_IMAGE="python:${VERSION_PYTHON}-alpine3.16" FROM ${VERSION_BASE_IMAGE} # We need to declare ARGs again which were declared before the build stage # (FROM directive), otherwise they won't be available in this stage. @@ -62,39 +62,32 @@ RUN set -e pipefail; \ extra-cmake-modules tcsh; \ apk add libstdc++ -## Add a dedicated user for mmCIF file validation -## MMCIF_USER_ID can be used to avoid file permission issues in development. -ARG MMCIF_USER_ID=501 -RUN adduser -S -u ${MMCIF_USER_ID} mmcif-vldtr -## Copy tools (already in use during dictionary SDB creation) +## Copy tools/ entrypoint script COPY --chmod=755 get-mmcif-dict-versions.py \ /usr/local/bin/get-mmcif-dict-versions +COPY --chmod=755 entrypoint.sh / +COPY --chmod=755 validate-mmcif-file.py /usr/local/bin/validate-mmcif-file -## Create dictionaries for validating mmCIF files. To rebuild dictionaries, -## rebuild the container with build argument DICT_FETCH_DATE="<DATA>.n" so -## only the RUN Command for building the dictionary is triggered. The ".n" -## should be an increasing number to enable simple multiple builds in one -## day, in case something goes wrong. +## Create dictionaries for validating mmCIF files. +## The version to be created is controlled by build argument USE_DICT_VERSION. +## Use a versions vailable at +## https://github.com/ihmwg/ModelCIF/tree/master/archive or the special word +## "latest", that will use +## https://github.com/ihmwg/ModelCIF/blob/master/dist/mmcif_ma.dic. ## Dictionaries do not change that frequently therefore we skip the hassle of ## keeping them in an external volume. -ARG DICT_FETCH_DATE="2022-05-16.1" -# ToDo: use commit instead of USE_DICT_RELEASE -ARG USE_DICT_RELEASE="master" -ENV DICT_FETCH_DATE=${DICT_FETCH_DATE} -ENV USE_DICT_RELEASE=${USE_DICT_RELEASE} -LABEL org.modelarchive.dict-fetch-date="${DICT_FETCH_DATE}" -LABEL org.modelarchive.dict_release="${USE_DICT_RELEASE}" +ARG USE_DICT_VERSION="1.4.1" +ENV USE_DICT_VERSION=${USE_DICT_VERSION} +LABEL org.modelarchive.dict_release="${USE_DICT_VERSION}" WORKDIR ${SRC_DIR} RUN set -e pipefail; \ apk add curl; \ export _DICT_DIR="${SRC_DIR}/mmcif_dicts"; \ export _DICT_URL="https://mmcif.wwpdb.org/dictionaries/ascii"; \ - export _PATHSPEC="557bda7"; \ - export _REPO_URL="https://raw.githubusercontent.com/ihmwg/ModelCIF/${_PATHSPEC}"; \ - export _MA_DICT_URL="${_REPO_URL}/dist/mmcif_ma.dic"; \ - export _DICT_REPO="ModelCIF.git"; \ + export _GIT_URL="https://raw.github.com/ihmwg/ModelCIF/master"; \ + export _MA_DICT_URL="${_GIT_URL}/archive/mmcif_ma-v${USE_DICT_VERSION}.dic"; \ mkdir ${_DICT_DIR}; \ mkdir ${MMCIF_DICTS_DIR}; \ cd ${_DICT_DIR}; \ @@ -104,8 +97,9 @@ RUN set -e pipefail; \ gunzip *.gz; \ # ## Fetch the merged ModelCIF dictionary - # - ## Fetch the Git repo with the dictionaries + if test x${USE_DICT_VERSION}==xlatest; then \ + export _MA_DICT_URL="${_GIT_URL}/dist/mmcif_ma.dic"; \ + fi; \ curl ${_MA_DICT_URL} -s -L -o mmcif_ma.dic; \ # ## Build the ModelCIF SDB @@ -137,15 +131,17 @@ RUN set -e pipefail; \ apk del curl -COPY --chmod=755 entrypoint.sh / -COPY --chmod=755 validate-mmcif-file.py /usr/local/bin/validate-mmcif-file - # for development #RUN set -e pipefail; \ # apk add bash emacs gcc build-base; \ # /usr/local/bin/python -m pip install pylint black; \ # apk del gcc build-base +## Add a dedicated user for mmCIF file validation +## MMCIF_USER_ID can be used to avoid file permission issues in development. +ARG MMCIF_USER_ID=501 +RUN adduser -S -u ${MMCIF_USER_ID} mmcif-vldtr + USER mmcif-vldtr ENTRYPOINT ["/entrypoint.sh"] -- GitLab