From c344726e777edfa976ac5ce6951693d64501aa9b Mon Sep 17 00:00:00 2001 From: Yuxiang Zhu Date: Sep 19 2018 02:45:35 +0000 Subject: Simplify the WaiverDB Dockerfile used by C3I pipeline jobs Git will not be used to check out the source code. We will use COPY in Dockerfile directly. To specify the Git branch or commit ID to build from, just generate a new build config from the template with corresponding WAIVERDB_GIT_REF template argument. --- diff --git a/openshift/containers/waiverdb/Dockerfile b/openshift/containers/waiverdb/Dockerfile index bd843cc..60d6555 100644 --- a/openshift/containers/waiverdb/Dockerfile +++ b/openshift/containers/waiverdb/Dockerfile @@ -1,56 +1,27 @@ FROM fedora:28 LABEL \ name="waiverdb" \ + maintainer="WaiverDB developers" \ description="WaiverDB application" \ vendor="WaiverDB developers" \ - license="GPLv2+" \ - build-date="" + license="GPLv2+" -# Installing WaiverDB dependencies -RUN dnf -y install python3-gunicorn \ - python3-flask \ - python3-sqlalchemy \ - python3-flask-restful \ - python3-flask-sqlalchemy \ - python3-psycopg2 \ - python3-gssapi \ - python3-mock \ - python3-flask-oidc \ - python3-click \ - python3-flask-migrate \ - python3-stomppy \ - python3-fedmsg \ - && dnf -y clean all +COPY . /usr/local/src/waiverdb/ -ARG WAIVERDB_GIT_REPO=https://pagure.io/waiverdb.git -ARG WAIVERDB_GIT_REF=master -ARG WAIVERDB_VERSION= -ENV WAIVERDB_VERSION=$WAIVERDB_VERSION - -# Installing CA certificate -RUN if [ -n "$WAIVERDB_CACERT_URL" ]; then \ - cd /etc/pki/ca-trust/source/anchors \ - && curl -O --insecure --location "$WAIVERDB_CACERT_URL" \ - && update-ca-trust extract; \ - fi +# Allow a non-root user to install a custom root CA at run-time +RUN cp -r /usr/local/src/waiverdb/docker/ / \ + && chmod g+w /etc/pki/tls/certs/ca-bundle.crt # Installing WaiverDB -RUN dnf -y install git python3-pip \ - && mkdir -p /usr/local/src \ - && git clone "$WAIVERDB_GIT_REPO" /usr/local/src/waiverdb \ +RUN dnf -y install python3-gunicorn python3-pip findutils rpm-build \ && cd /usr/local/src/waiverdb \ - && git fetch origin "$WAIVERDB_GIT_REF" \ - && git checkout -f "$WAIVERDB_GIT_REF" \ + # install dependencies defined in RPM spec file + && rpm --query --requires --specfile ./waiverdb.spec | grep --invert-match waiverdb | xargs -d '\n' dnf -y install \ + # install using --no-deps option to ensure nothing comes from PyPi && pip3 install --no-deps . \ && mkdir -p /etc/waiverdb \ - && cp conf/settings.py.example /etc/waiverdb/settings.py \ - && cp conf/client.conf.example /etc/waiverdb/client.conf \ - && dnf -y history undo last \ - && dnf -y clean all \ - # Allow a non-root user to install a custom root CA at run-time - && cp -r docker/ / \ - && chmod g+w /etc/pki/tls/certs/ca-bundle.crt \ - && cd / && rm -rf /usr/local/src/waiverdb + && cp conf/settings.py.example /etc/waiverdb/settings.py && cp conf/client.conf.example /etc/waiverdb/client.conf \ + && dnf -y autoremove findutils rpm-build && dnf -y clean all && cd / && rm -rf /usr/local/src/waiverdb USER 1001 EXPOSE 8080 diff --git a/openshift/waiverdb-container-template.yaml b/openshift/waiverdb-container-template.yaml index 09b5a40..b0802e7 100644 --- a/openshift/waiverdb-container-template.yaml +++ b/openshift/waiverdb-container-template.yaml @@ -56,13 +56,6 @@ objects: strategy: dockerStrategy: forcePull: true - buildArgs: - - name: "WAIVERDB_GIT_REPO" - value: "${WAIVERDB_GIT_REPO}" - - name: "WAIVERDB_GIT_REF" - value: "${WAIVERDB_GIT_REF}" - - name: "WAIVERDB_VERSION" - value: "${WAIVERDB_VERSION}" dockerfilePath: openshift/containers/waiverdb/Dockerfile resources: requests: