From d191fbf4575d86f64178878b043718db334d460b Mon Sep 17 00:00:00 2001 From: Gernot Maier Date: Tue, 30 Jan 2024 21:35:25 +0100 Subject: [PATCH 1/4] improve docker container generation --- .../workflows/vts-eventdisplay-package.yml | 22 ++++---- dockerfiles/Dockerfile | 51 +++++++++---------- 2 files changed, 38 insertions(+), 35 deletions(-) diff --git a/.github/workflows/vts-eventdisplay-package.yml b/.github/workflows/vts-eventdisplay-package.yml index a55c0cea..1a1d436c 100644 --- a/.github/workflows/vts-eventdisplay-package.yml +++ b/.github/workflows/vts-eventdisplay-package.yml @@ -3,7 +3,10 @@ name: VTS Eventdisplay Docker Image on: push: - branches: ["main"] + branches: + - main + tags: + - 'v*' pull_request: branches: ["main"] release: @@ -26,6 +29,14 @@ jobs: with: path: 'EventDisplay_v4' + - name: Set build arguments + run: | + if [[ "${{ github.event_name }}" == 'pull_request' ]]; then + echo "BUILD_BRANCH=${GITHUB_HEAD_REF}" >> "$GITHUB_ENV" + else + echo "BUILD_BRANCH=${GITHUB_REF#refs/heads/}" >> "$GITHUB_ENV" + fi + - name: Log in to the Container registry uses: docker/login-action@v3 with: @@ -39,18 +50,11 @@ jobs: with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - - name: vbf - run: | - curl https://syncandshare.desy.de/index.php/s/${{ secrets.VBFcpp17 }}/download > VBF.tar.gz - - - name: sofa - run: | - curl https://syncandshare.desy.de/index.php/s/${{ secrets.SOFA }}/download > sofa.tar.gz - - name: Build and push Docker image uses: docker/build-push-action@v5 with: context: . + build-args: BUILD_BRANCH=${{ env.BUILD_BRANCH }} push: ${{ github.event_name != 'pull_request' }} file: ./EventDisplay_v4/dockerfiles/Dockerfile tags: ${{ steps.meta.outputs.tags }} diff --git a/dockerfiles/Dockerfile b/dockerfiles/Dockerfile index 034fd7ab..4561ef07 100644 --- a/dockerfiles/Dockerfile +++ b/dockerfiles/Dockerfile @@ -1,42 +1,41 @@ -ARG ROOT_VERSION=latest -FROM rootproject/root:${ROOT_VERSION} AS vbf_build +ARG ROOT_VERSION=6.30.02-alma9 +FROM rootproject/root:${ROOT_VERSION} AS build +ARG VBF_VERSION=0.3.4 +ARG BUILD_BRANCH=main LABEL maintainer.name="Eventdisplay Team" LABEL maintainer.email="gernot.maier@desy.de" -COPY VBF.tar.gz VBF.tar.gz -RUN mkdir VBF &&tar -xzf VBF.tar.gz -C VBF --strip-components=1 \ - && cd VBF \ - && ./configure --prefix=/opt/VBF \ - && make && make install \ - && make clean - -FROM rootproject/root:${ROOT_VERSION} as eventdisplay_build -WORKDIR /opt/ -COPY --from=vbf_build /opt/VBF /opt/VBF +# VBF +ADD https://syncandshare.desy.de/index.php/s/NrnZNKfT8WxFpcn/download /workdir/VBF-$VBF_VERSION.tar.gz +WORKDIR /workdir/ +RUN mkdir VBF && tar -xzf VBF-$VBF_VERSION.tar.gz -C VBF --strip-components=1 && \ + cd VBF && \ + ./configure --prefix=/opt/VBF && \ + make && make install && make clean ENV VBFSYS /opt/VBF -ENV LD_LIBRARY_PATH "${VBFSYS}/lib/:${LD_LIBRARY_PATH}" +ENV EVNDISPSYS /opt/EventDisplay_v4 +ENV SOFASYS "${EVNDISPSYS}/sofa" ENV PATH ${VBFSYS}/bin:${PATH} - -COPY EventDisplay_v4 /opt/Eventdisplay -COPY sofa.tar.gz sofa.tar.gz -ENV EVNDISPSYS /opt/Eventdisplay ENV LD_LIBRARY_PATH "${EVNDISPSYS}/obj:${EVNDISPSYS}/lib:${ROOTSYS}/lib:${VBFSYS}/lib:${LD_LIBRARY_PATH}" -ENV SOFASYS "${EVNDISPSYS}/sofa" -RUN cd ${EVNDISPSYS} \ - && mv -f /opt/sofa.tar.gz ./sofa/ \ - && ./install_sofa.sh \ - && make VTS +WORKDIR /opt/ +RUN BUILD_BRANCH=$(echo ${BUILD_BRANCH} | sed 's#refs/tags/##') && \ + git clone -b ${BUILD_BRANCH} https://github.com/VERITAS-Observatory/EventDisplay_v4.git --depth 1 +ADD https://syncandshare.desy.de/index.php/s/jr9NrbWFR5MLaDf/download ${SOFASYS}/sofa.tar.gz +RUN cd ${EVNDISPSYS} \ + && ./install_sofa.sh && make VTS + FROM rootproject/root:${ROOT_VERSION} WORKDIR /opt/ -COPY --from=vbf_build /opt/VBF /opt/VBF -COPY --from=eventdisplay_build /opt/Eventdisplay /opt/Eventdisplay - -ENV EVNDISPSYS /opt/Eventdisplay +COPY --from=build /opt/VBF /opt/VBF +COPY --from=build /opt/EventDisplay_v4 /opt/EventDisplay_v4 + +ENV EVNDISPSYS /opt/EventDisplay_v4 ENV VBFSYS /opt/VBF ENV LD_LIBRARY_PATH "${VBFSYS}/lib/:${LD_LIBRARY_PATH}" ENV PATH ${VBFSYS}/bin:${PATH} ENV LD_LIBRARY_PATH "${EVNDISPSYS}/obj:${EVNDISPSYS}/lib:${ROOTSYS}/lib:${VBFSYS}/lib:${LD_LIBRARY_PATH}" ENV SOFASYS "${EVNDISPSYS}/sofa" + From 2ca0580de13275665b298296ca82a88bc177d65f Mon Sep 17 00:00:00 2001 From: Gernot Maier Date: Tue, 30 Jan 2024 21:36:33 +0100 Subject: [PATCH 2/4] add workflow dispatch --- .github/workflows/vts-eventdisplay-package.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/vts-eventdisplay-package.yml b/.github/workflows/vts-eventdisplay-package.yml index 1a1d436c..10f45776 100644 --- a/.github/workflows/vts-eventdisplay-package.yml +++ b/.github/workflows/vts-eventdisplay-package.yml @@ -2,6 +2,7 @@ name: VTS Eventdisplay Docker Image on: + workflow_dispatch: push: branches: - main From bebf491fa957445ef7a2f78a677a3d8af694602f Mon Sep 17 00:00:00 2001 From: Gernot Maier Date: Tue, 30 Jan 2024 21:48:38 +0100 Subject: [PATCH 3/4] try older checkout for cpp11 --- .github/workflows/ci-buildmatrix-cpp11.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-buildmatrix-cpp11.yml b/.github/workflows/ci-buildmatrix-cpp11.yml index 1324571e..f64eb494 100644 --- a/.github/workflows/ci-buildmatrix-cpp11.yml +++ b/.github/workflows/ci-buildmatrix-cpp11.yml @@ -21,7 +21,7 @@ jobs: steps: # Checks-out your repository under $GITHUB_WORKSPACE - - uses: actions/checkout@v4 + - uses: actions/checkout@v3 - name: vbf run: | From 29daa95d0b74710fbe7a81204594aa26a86a8a79 Mon Sep 17 00:00:00 2001 From: Gernot Maier Date: Wed, 31 Jan 2024 11:48:14 +0100 Subject: [PATCH 4/4] add analysis files --- dockerfiles/Dockerfile | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/dockerfiles/Dockerfile b/dockerfiles/Dockerfile index 4561ef07..50298de2 100644 --- a/dockerfiles/Dockerfile +++ b/dockerfiles/Dockerfile @@ -38,4 +38,14 @@ ENV LD_LIBRARY_PATH "${VBFSYS}/lib/:${LD_LIBRARY_PATH}" ENV PATH ${VBFSYS}/bin:${PATH} ENV LD_LIBRARY_PATH "${EVNDISPSYS}/obj:${EVNDISPSYS}/lib:${ROOTSYS}/lib:${VBFSYS}/lib:${LD_LIBRARY_PATH}" ENV SOFASYS "${EVNDISPSYS}/sofa" - + + # add main branch of VERITAS Analysis files + WORKDIR /opt/ + RUN git clone https://github.com/VERITAS-Observatory/Eventdisplay_AnalysisFiles_VTS.git --dept 1 + ENV VERITAS_EVNDISP_AUX_DIR /opt/Eventdisplay_AnalysisFiles_VTS + +# data and user data and log directory (to be mounted) +ENV VERITAS_DATA_DIR /opt/data +ENV VERITAS_LOG_DIR /opt/data +ENV VERITAS_USER_DATA_DIR /opt/user_data +ENV VERITAS_USER_USER_DIR /opt/user_data \ No newline at end of file