From a80524219e95e9fcce2364164a5f626c142c7a25 Mon Sep 17 00:00:00 2001 From: Federico Meloni Date: Thu, 14 Nov 2024 10:12:30 +0100 Subject: [PATCH 01/26] updating key4hep base --- AlmaLinux9/Dockerfile-sim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AlmaLinux9/Dockerfile-sim b/AlmaLinux9/Dockerfile-sim index 5a12bd8..c86cc12 100644 --- a/AlmaLinux9/Dockerfile-sim +++ b/AlmaLinux9/Dockerfile-sim @@ -8,7 +8,7 @@ ARG REPOSITORY=infnpd FROM ${REPOSITORY}/mucoll-spack:${VERSION}-alma9 # Adding repositories: Key4hep + MuColl -ARG KEY4HEP_COMMIT=dc0b2bc4aaad8f3ef5f3c7f62ff5b0277a554eee +ARG KEY4HEP_COMMIT=6cb16c39ab85fbc211e50be804fa7a15f24ccebc ARG MUCOLL_COMMIT=7c7b4e01f999056d65787b35b063a1b129c67638 RUN source /opt/setup_spack.sh && \ From e7c2080912b64236e1f1afb87f3049548533fe1d Mon Sep 17 00:00:00 2001 From: Federico Meloni Date: Thu, 14 Nov 2024 10:18:09 +0100 Subject: [PATCH 02/26] updating key4hep base --- AlmaLinux9/Dockerfile-sim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AlmaLinux9/Dockerfile-sim b/AlmaLinux9/Dockerfile-sim index c86cc12..164995d 100644 --- a/AlmaLinux9/Dockerfile-sim +++ b/AlmaLinux9/Dockerfile-sim @@ -8,7 +8,7 @@ ARG REPOSITORY=infnpd FROM ${REPOSITORY}/mucoll-spack:${VERSION}-alma9 # Adding repositories: Key4hep + MuColl -ARG KEY4HEP_COMMIT=6cb16c39ab85fbc211e50be804fa7a15f24ccebc +ARG KEY4HEP_COMMIT=f6b94a45e2c9e3e414d75606927a56da59c4f00a ARG MUCOLL_COMMIT=7c7b4e01f999056d65787b35b063a1b129c67638 RUN source /opt/setup_spack.sh && \ From 2d44b82f737b81e5552d9dc062f6929729751457 Mon Sep 17 00:00:00 2001 From: Federico Meloni Date: Thu, 14 Nov 2024 10:42:14 +0100 Subject: [PATCH 03/26] picking up new mucoll-spack --- AlmaLinux9/Dockerfile-sim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AlmaLinux9/Dockerfile-sim b/AlmaLinux9/Dockerfile-sim index 164995d..d94eb4b 100644 --- a/AlmaLinux9/Dockerfile-sim +++ b/AlmaLinux9/Dockerfile-sim @@ -9,7 +9,7 @@ FROM ${REPOSITORY}/mucoll-spack:${VERSION}-alma9 # Adding repositories: Key4hep + MuColl ARG KEY4HEP_COMMIT=f6b94a45e2c9e3e414d75606927a56da59c4f00a -ARG MUCOLL_COMMIT=7c7b4e01f999056d65787b35b063a1b129c67638 +ARG MUCOLL_COMMIT=3ebc9b2b984fe33590b768489a7bf54050799407 RUN source /opt/setup_spack.sh && \ REPOPATH=${SPACK_ROOT}/var/key4hep-spack && \ From 1f0ebd9c6696d2b5ff57eeaff0713ef616561ea9 Mon Sep 17 00:00:00 2001 From: Federico Meloni Date: Thu, 14 Nov 2024 10:47:11 +0100 Subject: [PATCH 04/26] picking up new mucoll-spack --- AlmaLinux9/Dockerfile-sim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AlmaLinux9/Dockerfile-sim b/AlmaLinux9/Dockerfile-sim index d94eb4b..ee7fb9a 100644 --- a/AlmaLinux9/Dockerfile-sim +++ b/AlmaLinux9/Dockerfile-sim @@ -49,7 +49,7 @@ RUN source /opt/setup_spack.sh && \ # Concretizing the MuColl stack reusing system packages as external RUN source ${HOME}/setup_env.sh && \ - spack add mucoll-stack@2.9 && \ + spack add mucoll-stack && \ spack concretize --reuse --deprecated # Installing fragments of dependency tree in separate layers for cached debugging From 0450997697be6c1011ccdc4820b5c407596fef48 Mon Sep 17 00:00:00 2001 From: Federico Meloni Date: Wed, 20 Nov 2024 14:59:27 +0100 Subject: [PATCH 05/26] testing split build --- .github/workflows/build-image.yml | 100 +++++++++++++++++++++++++++--- AlmaLinux9/Dockerfile-base | 59 ++++++++++++++++++ AlmaLinux9/Dockerfile-sim | 26 +++----- AlmaLinux9/Dockerfile-spack | 1 - 4 files changed, 157 insertions(+), 29 deletions(-) create mode 100644 AlmaLinux9/Dockerfile-base diff --git a/.github/workflows/build-image.yml b/.github/workflows/build-image.yml index 5fab43d..4835d43 100644 --- a/.github/workflows/build-image.yml +++ b/.github/workflows/build-image.yml @@ -1,25 +1,36 @@ name: build-image on: + push: + branches: + - 'master' + - 'main' + - 'key4hep*' + tags: + - 'v*' + pull_request: + branches: + - 'master' + - 'main' workflow_dispatch: jobs: - build: + build-spack: runs-on: ubuntu-latest strategy: matrix: os: [{dir: AlmaLinux9,suffix: alma9}] steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: fetch-depth: 0 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 - name: Login to DockerHub uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} + password: ${{ secrets.GHCR_TOKEN }} - name: lowercase owner name run: | echo "OWNER_LC=${OWNER,,}" >>${GITHUB_ENV} @@ -30,9 +41,9 @@ jobs: uses: docker/metadata-action@v4 with: images: ghcr.io/${{env.OWNER_LC}}/mucoll-dummy - - name: Build and Push (mucoll-spack) - id: docker_build_mucoll-spack - uses: docker/build-push-action@v4 + - name: Build and Push + id: docker_build + uses: docker/build-push-action@v6 with: push: true context: ./${{matrix.os.dir}} @@ -41,9 +52,78 @@ jobs: VERSION=${{ steps.meta.outputs.version }} REPOSITORY=ghcr.io/${{env.OWNER_LC}} tags: ghcr.io/${{env.OWNER_LC}}/mucoll-spack:${{steps.meta.outputs.version}}-${{matrix.os.suffix}} - - name: Build and Push (mucoll-sim) - id: docker_build_mucoll-sim - uses: docker/build-push-action@v4 + build-base: + runs-on: ubuntu-latest + needs: build-spack + strategy: + matrix: + os: [{dir: AlmaLinux9,suffix: alma9}] + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Login to DockerHub + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GHCR_TOKEN }} + - name: lowercase owner name + run: | + echo "OWNER_LC=${OWNER,,}" >>${GITHUB_ENV} + env: + OWNER: '${{ github.repository_owner }}' + - name: Docker Meta + id: meta + uses: docker/metadata-action@v4 + with: + images: ghcr.io/${{env.OWNER_LC}}/mucoll-dummy + - name: Build and Push + id: docker_build + uses: docker/build-push-action@v6 + with: + push: true + context: ./${{matrix.os.dir}} + file: ./${{matrix.os.dir}}/Dockerfile-base + build-args: | + VERSION=${{ steps.meta.outputs.version }} + REPOSITORY=ghcr.io/${{env.OWNER_LC}} + tags: ghcr.io/${{env.OWNER_LC}}/mucoll-base:${{steps.meta.outputs.version}}-${{matrix.os.suffix}} + build-sim: + runs-on: ubuntu-latest + needs: build-base + strategy: + matrix: + os: [{dir: AlmaLinux9,suffix: alma9}] + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Login to DockerHub + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GHCR_TOKEN }} + - name: lowercase owner name + run: | + echo "OWNER_LC=${OWNER,,}" >>${GITHUB_ENV} + env: + OWNER: '${{ github.repository_owner }}' + - name: Docker Meta + id: meta + uses: docker/metadata-action@v4 + with: + images: ghcr.io/${{env.OWNER_LC}}/mucoll-dummy + - name: Build and Push + id: docker_build + uses: docker/build-push-action@v6 with: push: true context: ./${{matrix.os.dir}} diff --git a/AlmaLinux9/Dockerfile-base b/AlmaLinux9/Dockerfile-base new file mode 100644 index 0000000..3d2f544 --- /dev/null +++ b/AlmaLinux9/Dockerfile-base @@ -0,0 +1,59 @@ +############################################################################### +# Repository: ${REPOSITORY}/key4hep-base +# Tag: ${VERSION}-alma9 +############################################################################### + +ARG VERSION=main +ARG REPOSITORY=madbaron +FROM ${REPOSITORY}/mucoll-spack:${VERSION}-alma9 + +# Adding Key4hep repo +ARG KEY4HEP_COMMIT=9f4187ee47dfa1828be936e34c23035818bcd3aa + +RUN source /opt/setup_spack.sh && \ + REPOPATH=${SPACK_ROOT}/var/key4hep-spack && \ + git clone -b base-environment --single-branch https://github.com/key4hep/key4hep-spack ${REPOPATH} && \ + if [ -n "${KEY4HEP_COMMIT}" ]; then \ + cd ${REPOPATH}; \ + git checkout ${KEY4HEP_COMMIT}; \ + fi + +# Apply our patches to spack +COPY apply_patches.sh ./apply_patches.sh + +RUN source /opt/setup_spack.sh && \ + ./apply_patches.sh ${SPACK_ROOT}/var/key4hep-spack + +# Add the package repositories +RUN source /opt/setup_spack.sh && \ + spack repo add --scope system ${SPACK_ROOT}/var/key4hep-spack + +# Create the release environment +RUN source /opt/setup_spack.sh && \ + cd ${SPACK_ROOT}/var/key4hep-spack/environments/key4hep-dev-base && \ + spack env activate . && \ + cd - && \ + echo "source /opt/setup_spack.sh" > ${HOME}/setup_env.sh && \ + echo "cd ${SPACK_ROOT}/var/key4hep-spack/environments/key4hep-dev-base" >> ${HOME}/setup_env.sh && \ + echo "spack env activate ." >> ${HOME}/setup_env.sh && \ + echo "cd -" >> ${HOME}/setup_env.sh && \ + echo "spack env status" >> ${HOME}/setup_env.sh + +# Concretizing the stack reusing system packages as external +RUN source ${HOME}/setup_env.sh && \ + spack add key4hep-base-stack && \ + spack concretize --reuse + +# Installing fragments of dependency tree in separate layers for cached debugging +ENV SPACK_INSTALL_OPTS="--only-concrete --no-add --fail-fast" + +RUN source ${HOME}/setup_env.sh && \ + spack spec -NIt && \ + spack install ${SPACK_INSTALL_OPTS} && \ + spack clean -a + +RUN source ${HOME}/setup_env.sh && \ + echo "source ${SPACK_ENV}/.spack-env/view/setup.sh" > /opt/setup_k4base.sh && \ + echo "alias setup_k4base=\"source /opt/setup_k4base.sh\"" >> /etc/profile.d/aliases.sh + + diff --git a/AlmaLinux9/Dockerfile-sim b/AlmaLinux9/Dockerfile-sim index ee7fb9a..8fd2f1e 100644 --- a/AlmaLinux9/Dockerfile-sim +++ b/AlmaLinux9/Dockerfile-sim @@ -3,25 +3,16 @@ # Tag: ${VERSION}-alma9 ############################################################################### -ARG VERSION=release -ARG REPOSITORY=infnpd -FROM ${REPOSITORY}/mucoll-spack:${VERSION}-alma9 +ARG VERSION=dev +ARG REPOSITORY=madbaron +FROM ${REPOSITORY}/mucoll-base:${VERSION}-alma9 -# Adding repositories: Key4hep + MuColl -ARG KEY4HEP_COMMIT=f6b94a45e2c9e3e414d75606927a56da59c4f00a -ARG MUCOLL_COMMIT=3ebc9b2b984fe33590b768489a7bf54050799407 - -RUN source /opt/setup_spack.sh && \ - REPOPATH=${SPACK_ROOT}/var/key4hep-spack && \ - git clone https://github.com/key4hep/key4hep-spack ${REPOPATH} && \ - if [ -n "${KEY4HEP_COMMIT}" ]; then \ - cd ${REPOPATH}; \ - git checkout ${KEY4HEP_COMMIT}; \ - fi +# Adding repository: MuColl +ARG MUCOLL_COMMIT=3ff04277d2743a36bc4e6b6d162af22e3d2e4bd7 RUN source /opt/setup_spack.sh && \ REPOPATH=${SPACK_ROOT}/var/mucoll-spack && \ - git clone https://github.com/MuonColliderSoft/mucoll-spack ${REPOPATH} && \ + git clone https://github.com/madbaron/mucoll-spack ${REPOPATH} && \ if [ -n "${MUCOLL_COMMIT}" ]; then \ cd ${REPOPATH}; \ git checkout ${MUCOLL_COMMIT}; \ @@ -30,7 +21,6 @@ RUN source /opt/setup_spack.sh && \ # Apply our patches to spack COPY apply_patches.sh ./apply_patches.sh RUN source /opt/setup_spack.sh && \ - ./apply_patches.sh ${SPACK_ROOT}/var/key4hep-spack && \ ./apply_patches.sh ${SPACK_ROOT}/var/mucoll-spack # Add the package repositories @@ -50,10 +40,10 @@ RUN source /opt/setup_spack.sh && \ # Concretizing the MuColl stack reusing system packages as external RUN source ${HOME}/setup_env.sh && \ spack add mucoll-stack && \ - spack concretize --reuse --deprecated + spack concretize --reuse # Installing fragments of dependency tree in separate layers for cached debugging -ENV SPACK_INSTALL_OPTS "--only-concrete --no-add --fail-fast --deprecated" +ENV SPACK_INSTALL_OPTS="--only-concrete --no-add --fail-fast --deprecated" RUN source ${HOME}/setup_env.sh && \ spack spec -NIt && \ diff --git a/AlmaLinux9/Dockerfile-spack b/AlmaLinux9/Dockerfile-spack index d0ec153..fdb7988 100644 --- a/AlmaLinux9/Dockerfile-spack +++ b/AlmaLinux9/Dockerfile-spack @@ -4,7 +4,6 @@ ############################################################################### ARG VERSION=release -ARG REPOSITORY=infnpd FROM gitlab-registry.cern.ch/key4hep/k4-deploy/alma9-build # Add the new Certificate Authority (needed for xrootd) From 0a3331335b0a5720e6b15aba70233149c6352a51 Mon Sep 17 00:00:00 2001 From: Federico Meloni Date: Wed, 20 Nov 2024 15:08:40 +0100 Subject: [PATCH 06/26] testing split build --- .github/workflows/build-image.yml | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build-image.yml b/.github/workflows/build-image.yml index 4835d43..eb1b087 100644 --- a/.github/workflows/build-image.yml +++ b/.github/workflows/build-image.yml @@ -5,6 +5,7 @@ on: - 'master' - 'main' - 'key4hep*' + - '2.10' tags: - 'v*' pull_request: @@ -28,19 +29,13 @@ jobs: - name: Login to DockerHub uses: docker/login-action@v3 with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GHCR_TOKEN }} - - name: lowercase owner name - run: | - echo "OWNER_LC=${OWNER,,}" >>${GITHUB_ENV} - env: - OWNER: '${{ github.repository_owner }}' + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Docker Meta id: meta uses: docker/metadata-action@v4 with: - images: ghcr.io/${{env.OWNER_LC}}/mucoll-dummy + images: ${{ secrets.DOCKERHUB_REPOSITORY }}/mucoll-dummy - name: Build and Push id: docker_build uses: docker/build-push-action@v6 @@ -50,8 +45,8 @@ jobs: file: ./${{matrix.os.dir}}/Dockerfile-spack build-args: | VERSION=${{ steps.meta.outputs.version }} - REPOSITORY=ghcr.io/${{env.OWNER_LC}} - tags: ghcr.io/${{env.OWNER_LC}}/mucoll-spack:${{steps.meta.outputs.version}}-${{matrix.os.suffix}} + REPOSITORY=ghcr.io/${{ secrets.DOCKERHUB_REPOSITORY }} + tags: ${{ secrets.DOCKERHUB_REPOSITORY }}/mucoll-spack:${{steps.meta.outputs.version}}-${{matrix.os.suffix}} build-base: runs-on: ubuntu-latest needs: build-spack From 62afd30f60367e36f2fc46ee7ec7de14f674631e Mon Sep 17 00:00:00 2001 From: Federico Meloni Date: Wed, 20 Nov 2024 15:14:08 +0100 Subject: [PATCH 07/26] testing split build --- .github/workflows/build-image.yml | 32 ++++++++++--------------------- 1 file changed, 10 insertions(+), 22 deletions(-) diff --git a/.github/workflows/build-image.yml b/.github/workflows/build-image.yml index eb1b087..69b3055 100644 --- a/.github/workflows/build-image.yml +++ b/.github/workflows/build-image.yml @@ -63,19 +63,13 @@ jobs: - name: Login to DockerHub uses: docker/login-action@v3 with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GHCR_TOKEN }} - - name: lowercase owner name - run: | - echo "OWNER_LC=${OWNER,,}" >>${GITHUB_ENV} - env: - OWNER: '${{ github.repository_owner }}' + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Docker Meta id: meta uses: docker/metadata-action@v4 with: - images: ghcr.io/${{env.OWNER_LC}}/mucoll-dummy + images: ghcr.io/${{ secrets.DOCKERHUB_REPOSITORY }}/mucoll-dummy - name: Build and Push id: docker_build uses: docker/build-push-action@v6 @@ -85,8 +79,8 @@ jobs: file: ./${{matrix.os.dir}}/Dockerfile-base build-args: | VERSION=${{ steps.meta.outputs.version }} - REPOSITORY=ghcr.io/${{env.OWNER_LC}} - tags: ghcr.io/${{env.OWNER_LC}}/mucoll-base:${{steps.meta.outputs.version}}-${{matrix.os.suffix}} + REPOSITORY=ghcr.io/${{ secrets.DOCKERHUB_REPOSITORY }} + tags: ghcr.io/${{ secrets.DOCKERHUB_REPOSITORY }}/mucoll-base:${{steps.meta.outputs.version}}-${{matrix.os.suffix}} build-sim: runs-on: ubuntu-latest needs: build-base @@ -103,19 +97,13 @@ jobs: - name: Login to DockerHub uses: docker/login-action@v3 with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GHCR_TOKEN }} - - name: lowercase owner name - run: | - echo "OWNER_LC=${OWNER,,}" >>${GITHUB_ENV} - env: - OWNER: '${{ github.repository_owner }}' + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Docker Meta id: meta uses: docker/metadata-action@v4 with: - images: ghcr.io/${{env.OWNER_LC}}/mucoll-dummy + images: ghcr.io/${{ secrets.DOCKERHUB_REPOSITORY }}/mucoll-dummy - name: Build and Push id: docker_build uses: docker/build-push-action@v6 @@ -125,5 +113,5 @@ jobs: file: ./${{matrix.os.dir}}/Dockerfile-sim build-args: | VERSION=${{ steps.meta.outputs.version }} - REPOSITORY=ghcr.io/${{env.OWNER_LC}} - tags: ghcr.io/${{env.OWNER_LC}}/mucoll-sim:${{steps.meta.outputs.version}}-${{matrix.os.suffix}} + REPOSITORY=ghcr.io/${{ secrets.DOCKERHUB_REPOSITORY }} + tags: ghcr.io/${{ secrets.DOCKERHUB_REPOSITORY }}/mucoll-sim:${{steps.meta.outputs.version}}-${{matrix.os.suffix}} From 3745eeb245923bba7b2163829cc84f19d614cf72 Mon Sep 17 00:00:00 2001 From: Federico Meloni Date: Wed, 20 Nov 2024 15:19:43 +0100 Subject: [PATCH 08/26] back to GHCR --- .github/workflows/build-image.yml | 48 +++++++++++++++++++++---------- 1 file changed, 33 insertions(+), 15 deletions(-) diff --git a/.github/workflows/build-image.yml b/.github/workflows/build-image.yml index 69b3055..2880167 100644 --- a/.github/workflows/build-image.yml +++ b/.github/workflows/build-image.yml @@ -29,13 +29,19 @@ jobs: - name: Login to DockerHub uses: docker/login-action@v3 with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GHCR_TOKEN }} + - name: lowercase owner name + run: | + echo "OWNER_LC=${OWNER,,}" >>${GITHUB_ENV} + env: + OWNER: '${{ github.repository_owner }}' - name: Docker Meta id: meta uses: docker/metadata-action@v4 with: - images: ${{ secrets.DOCKERHUB_REPOSITORY }}/mucoll-dummy + images: ghcr.io/${{env.OWNER_LC}}/mucoll-dummy - name: Build and Push id: docker_build uses: docker/build-push-action@v6 @@ -45,8 +51,8 @@ jobs: file: ./${{matrix.os.dir}}/Dockerfile-spack build-args: | VERSION=${{ steps.meta.outputs.version }} - REPOSITORY=ghcr.io/${{ secrets.DOCKERHUB_REPOSITORY }} - tags: ${{ secrets.DOCKERHUB_REPOSITORY }}/mucoll-spack:${{steps.meta.outputs.version}}-${{matrix.os.suffix}} + REPOSITORY=ghcr.io/${{env.OWNER_LC}} + tags: ghcr.io/${{env.OWNER_LC}}/mucoll-spack:${{steps.meta.outputs.version}}-${{matrix.os.suffix}} build-base: runs-on: ubuntu-latest needs: build-spack @@ -63,13 +69,19 @@ jobs: - name: Login to DockerHub uses: docker/login-action@v3 with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GHCR_TOKEN }} + - name: lowercase owner name + run: | + echo "OWNER_LC=${OWNER,,}" >>${GITHUB_ENV} + env: + OWNER: '${{ github.repository_owner }}' - name: Docker Meta id: meta uses: docker/metadata-action@v4 with: - images: ghcr.io/${{ secrets.DOCKERHUB_REPOSITORY }}/mucoll-dummy + images: ghcr.io/${{env.OWNER_LC}}/mucoll-dummy - name: Build and Push id: docker_build uses: docker/build-push-action@v6 @@ -79,8 +91,8 @@ jobs: file: ./${{matrix.os.dir}}/Dockerfile-base build-args: | VERSION=${{ steps.meta.outputs.version }} - REPOSITORY=ghcr.io/${{ secrets.DOCKERHUB_REPOSITORY }} - tags: ghcr.io/${{ secrets.DOCKERHUB_REPOSITORY }}/mucoll-base:${{steps.meta.outputs.version}}-${{matrix.os.suffix}} + REPOSITORY=ghcr.io/${{env.OWNER_LC}} + tags: ghcr.io/${{env.OWNER_LC}}/mucoll-base:${{steps.meta.outputs.version}}-${{matrix.os.suffix}} build-sim: runs-on: ubuntu-latest needs: build-base @@ -97,13 +109,19 @@ jobs: - name: Login to DockerHub uses: docker/login-action@v3 with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GHCR_TOKEN }} + - name: lowercase owner name + run: | + echo "OWNER_LC=${OWNER,,}" >>${GITHUB_ENV} + env: + OWNER: '${{ github.repository_owner }}' - name: Docker Meta id: meta uses: docker/metadata-action@v4 with: - images: ghcr.io/${{ secrets.DOCKERHUB_REPOSITORY }}/mucoll-dummy + images: ghcr.io/${{env.OWNER_LC}}/mucoll-dummy - name: Build and Push id: docker_build uses: docker/build-push-action@v6 @@ -113,5 +131,5 @@ jobs: file: ./${{matrix.os.dir}}/Dockerfile-sim build-args: | VERSION=${{ steps.meta.outputs.version }} - REPOSITORY=ghcr.io/${{ secrets.DOCKERHUB_REPOSITORY }} - tags: ghcr.io/${{ secrets.DOCKERHUB_REPOSITORY }}/mucoll-sim:${{steps.meta.outputs.version}}-${{matrix.os.suffix}} + REPOSITORY=ghcr.io/${{env.OWNER_LC}} + tags: ghcr.io/${{env.OWNER_LC}}/mucoll-sim:${{steps.meta.outputs.version}}-${{matrix.os.suffix}} From aba4e45b2a10ae741b9f22131c48c77d19975e33 Mon Sep 17 00:00:00 2001 From: Federico Meloni Date: Wed, 20 Nov 2024 15:29:46 +0100 Subject: [PATCH 09/26] updating recommended spack version --- AlmaLinux9/Dockerfile-spack | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AlmaLinux9/Dockerfile-spack b/AlmaLinux9/Dockerfile-spack index fdb7988..3095dcf 100644 --- a/AlmaLinux9/Dockerfile-spack +++ b/AlmaLinux9/Dockerfile-spack @@ -11,7 +11,7 @@ RUN wget https://uit.stanford.edu/sites/default/files/2023/10/11/incommon-rsa-ca /usr/bin/update-ca-trust # Adding repositories: Spack -ARG SPACK_COMMIT=f5946c4621035dd466953c8d2664ff5f82f38138 +ARG SPACK_COMMIT=6cb16c39ab85fbc211e50be804fa7a15f24ccebc # Setting up Spack RUN git clone https://github.com/spack/spack.git /opt/spack && \ From f87db89d964e373b0ae46f1c79d5866a1b0c1e6b Mon Sep 17 00:00:00 2001 From: Federico Meloni Date: Wed, 20 Nov 2024 15:37:14 +0100 Subject: [PATCH 10/26] metadata v5 --- .github/workflows/build-image.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-image.yml b/.github/workflows/build-image.yml index 2880167..31f8d90 100644 --- a/.github/workflows/build-image.yml +++ b/.github/workflows/build-image.yml @@ -39,7 +39,7 @@ jobs: OWNER: '${{ github.repository_owner }}' - name: Docker Meta id: meta - uses: docker/metadata-action@v4 + uses: docker/metadata-action@v5 with: images: ghcr.io/${{env.OWNER_LC}}/mucoll-dummy - name: Build and Push @@ -79,7 +79,7 @@ jobs: OWNER: '${{ github.repository_owner }}' - name: Docker Meta id: meta - uses: docker/metadata-action@v4 + uses: docker/metadata-action@v5 with: images: ghcr.io/${{env.OWNER_LC}}/mucoll-dummy - name: Build and Push @@ -119,7 +119,7 @@ jobs: OWNER: '${{ github.repository_owner }}' - name: Docker Meta id: meta - uses: docker/metadata-action@v4 + uses: docker/metadata-action@v5 with: images: ghcr.io/${{env.OWNER_LC}}/mucoll-dummy - name: Build and Push From a1885ded63d3528caaf5cff4cecff6f044879bd3 Mon Sep 17 00:00:00 2001 From: Federico Meloni Date: Wed, 20 Nov 2024 17:35:10 +0100 Subject: [PATCH 11/26] publishing of spack image --- AlmaLinux9/Dockerfile-spack | 3 +++ 1 file changed, 3 insertions(+) diff --git a/AlmaLinux9/Dockerfile-spack b/AlmaLinux9/Dockerfile-spack index 3095dcf..0509b73 100644 --- a/AlmaLinux9/Dockerfile-spack +++ b/AlmaLinux9/Dockerfile-spack @@ -5,6 +5,9 @@ ARG VERSION=release FROM gitlab-registry.cern.ch/key4hep/k4-deploy/alma9-build +LABEL org.opencontainers.image.source=https://github.com/madbaron/MuonCollider-docker +LABEL org.opencontainers.image.description="Muon collider software stack based on Spack" +LABEL org.opencontainers.image.licenses=Apache-2.0 # Add the new Certificate Authority (needed for xrootd) RUN wget https://uit.stanford.edu/sites/default/files/2023/10/11/incommon-rsa-ca2.pem -P /usr/share/pki/ca-trust-source/anchors && \ From 885574d77a5bb6742ae58cee428304f41a954c96 Mon Sep 17 00:00:00 2001 From: Federico Meloni Date: Wed, 20 Nov 2024 17:51:03 +0100 Subject: [PATCH 12/26] artifact attestation --- .github/workflows/build-image.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-image.yml b/.github/workflows/build-image.yml index 31f8d90..ccbb155 100644 --- a/.github/workflows/build-image.yml +++ b/.github/workflows/build-image.yml @@ -53,7 +53,13 @@ jobs: VERSION=${{ steps.meta.outputs.version }} REPOSITORY=ghcr.io/${{env.OWNER_LC}} tags: ghcr.io/${{env.OWNER_LC}}/mucoll-spack:${{steps.meta.outputs.version}}-${{matrix.os.suffix}} - build-base: + - name: Generate artifact attestation + uses: actions/attest-build-provenance@v1 + with: + subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}} + subject-digest: ${{ steps.push.outputs.digest }} + push-to-registry: true +build-base: runs-on: ubuntu-latest needs: build-spack strategy: From 43102772f756bee688a16cd2e08d593ea80e6cb6 Mon Sep 17 00:00:00 2001 From: Federico Meloni Date: Wed, 20 Nov 2024 17:52:42 +0100 Subject: [PATCH 13/26] artifact attestation --- .github/workflows/build-image.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-image.yml b/.github/workflows/build-image.yml index ccbb155..cc26652 100644 --- a/.github/workflows/build-image.yml +++ b/.github/workflows/build-image.yml @@ -59,7 +59,7 @@ jobs: subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}} subject-digest: ${{ steps.push.outputs.digest }} push-to-registry: true -build-base: + build-base: runs-on: ubuntu-latest needs: build-spack strategy: From 5a1883609909fe27858a52d79b88be5218dfb2f4 Mon Sep 17 00:00:00 2001 From: Federico Meloni Date: Wed, 20 Nov 2024 18:00:19 +0100 Subject: [PATCH 14/26] token permissions --- .github/workflows/build-image.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-image.yml b/.github/workflows/build-image.yml index cc26652..da71382 100644 --- a/.github/workflows/build-image.yml +++ b/.github/workflows/build-image.yml @@ -13,6 +13,12 @@ on: - 'master' - 'main' workflow_dispatch: +permissions: + contents: read + pages: write + packages: write + id-token: write + attestations: write jobs: build-spack: runs-on: ubuntu-latest @@ -31,7 +37,7 @@ jobs: with: registry: ghcr.io username: ${{ github.actor }} - password: ${{ secrets.GHCR_TOKEN }} + password: ${{ secrets.GITHUB_TOKEN }} - name: lowercase owner name run: | echo "OWNER_LC=${OWNER,,}" >>${GITHUB_ENV} @@ -77,7 +83,7 @@ jobs: with: registry: ghcr.io username: ${{ github.actor }} - password: ${{ secrets.GHCR_TOKEN }} + password: ${{ secrets.GITHUB_TOKEN }} - name: lowercase owner name run: | echo "OWNER_LC=${OWNER,,}" >>${GITHUB_ENV} @@ -117,7 +123,7 @@ jobs: with: registry: ghcr.io username: ${{ github.actor }} - password: ${{ secrets.GHCR_TOKEN }} + password: ${{ secrets.GITHUB_TOKEN }} - name: lowercase owner name run: | echo "OWNER_LC=${OWNER,,}" >>${GITHUB_ENV} From 88a46d21d295814ba0c06abfef901b7da89569ab Mon Sep 17 00:00:00 2001 From: Federico Meloni Date: Wed, 20 Nov 2024 18:21:28 +0100 Subject: [PATCH 15/26] cleanup --- .github/workflows/build-image.yml | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build-image.yml b/.github/workflows/build-image.yml index da71382..6657697 100644 --- a/.github/workflows/build-image.yml +++ b/.github/workflows/build-image.yml @@ -1,10 +1,10 @@ -name: build-image +name: Build and Publish Docker Images + on: push: branches: - 'master' - 'main' - - 'key4hep*' - '2.10' tags: - 'v*' @@ -13,18 +13,24 @@ on: - 'master' - 'main' workflow_dispatch: + +env: + REGISTRY: ghcr.io + permissions: contents: read - pages: write packages: write id-token: write attestations: write + jobs: build-spack: runs-on: ubuntu-latest strategy: matrix: os: [{dir: AlmaLinux9,suffix: alma9}] + env: + IMAGE_NAME: mucoll-spack steps: - name: Checkout uses: actions/checkout@v4 @@ -35,7 +41,7 @@ jobs: - name: Login to DockerHub uses: docker/login-action@v3 with: - registry: ghcr.io + registry: ${{ env.REGISTRY }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: lowercase owner name @@ -43,26 +49,27 @@ jobs: echo "OWNER_LC=${OWNER,,}" >>${GITHUB_ENV} env: OWNER: '${{ github.repository_owner }}' - - name: Docker Meta + - name: Extract metadata for Docker id: meta uses: docker/metadata-action@v5 with: - images: ghcr.io/${{env.OWNER_LC}}/mucoll-dummy + images: ${{ env.REGISTRY }}/${{env.OWNER_LC}}/mucoll-dummy - name: Build and Push id: docker_build uses: docker/build-push-action@v6 with: - push: true context: ./${{matrix.os.dir}} file: ./${{matrix.os.dir}}/Dockerfile-spack + push: true build-args: | VERSION=${{ steps.meta.outputs.version }} - REPOSITORY=ghcr.io/${{env.OWNER_LC}} - tags: ghcr.io/${{env.OWNER_LC}}/mucoll-spack:${{steps.meta.outputs.version}}-${{matrix.os.suffix}} + REPOSITORY=${{ env.REGISTRY }}/${{env.OWNER_LC}} + tags: ${{ env.REGISTRY }}/${{env.OWNER_LC}}/${{ env.IMAGE_NAME}}:${{steps.meta.outputs.version}}-${{matrix.os.suffix}} + labels: ${{ steps.meta.outputs.labels }} - name: Generate artifact attestation uses: actions/attest-build-provenance@v1 with: - subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}} + subject-name: ${{ env.REGISTRY }}/${{env.OWNER_LC}}/${{ env.IMAGE_NAME}} subject-digest: ${{ steps.push.outputs.digest }} push-to-registry: true build-base: From 36b94b77f1547ce3e9ed9d3c0910837f40e09f64 Mon Sep 17 00:00:00 2001 From: Federico Meloni Date: Wed, 20 Nov 2024 18:29:47 +0100 Subject: [PATCH 16/26] cleanup --- .github/workflows/build-image.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-image.yml b/.github/workflows/build-image.yml index 6657697..a0b2330 100644 --- a/.github/workflows/build-image.yml +++ b/.github/workflows/build-image.yml @@ -32,19 +32,21 @@ jobs: env: IMAGE_NAME: mucoll-spack steps: + - name: Free up disk space + run: rm -rf /opt/hostedtoolcache - name: Checkout uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Set up Docker Buildx + - name: Set up Docker buildx uses: docker/setup-buildx-action@v3 - - name: Login to DockerHub + - name: Login to container registry uses: docker/login-action@v3 with: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: lowercase owner name + - name: Make owner name lowercase run: | echo "OWNER_LC=${OWNER,,}" >>${GITHUB_ENV} env: @@ -70,7 +72,7 @@ jobs: uses: actions/attest-build-provenance@v1 with: subject-name: ${{ env.REGISTRY }}/${{env.OWNER_LC}}/${{ env.IMAGE_NAME}} - subject-digest: ${{ steps.push.outputs.digest }} + subject-digest: ${{ steps.push.containerimage.digest }} push-to-registry: true build-base: runs-on: ubuntu-latest From 2134877179a5776c9afefb2201de0e9bd63a8561 Mon Sep 17 00:00:00 2001 From: Federico Meloni Date: Wed, 20 Nov 2024 18:38:11 +0100 Subject: [PATCH 17/26] free disk space --- .github/workflows/build-image.yml | 35 +++++++++++++++++-------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/.github/workflows/build-image.yml b/.github/workflows/build-image.yml index a0b2330..7319003 100644 --- a/.github/workflows/build-image.yml +++ b/.github/workflows/build-image.yml @@ -32,8 +32,6 @@ jobs: env: IMAGE_NAME: mucoll-spack steps: - - name: Free up disk space - run: rm -rf /opt/hostedtoolcache - name: Checkout uses: actions/checkout@v4 with: @@ -68,19 +66,19 @@ jobs: REPOSITORY=${{ env.REGISTRY }}/${{env.OWNER_LC}} tags: ${{ env.REGISTRY }}/${{env.OWNER_LC}}/${{ env.IMAGE_NAME}}:${{steps.meta.outputs.version}}-${{matrix.os.suffix}} labels: ${{ steps.meta.outputs.labels }} - - name: Generate artifact attestation - uses: actions/attest-build-provenance@v1 - with: - subject-name: ${{ env.REGISTRY }}/${{env.OWNER_LC}}/${{ env.IMAGE_NAME}} - subject-digest: ${{ steps.push.containerimage.digest }} - push-to-registry: true build-base: runs-on: ubuntu-latest needs: build-spack strategy: matrix: os: [{dir: AlmaLinux9,suffix: alma9}] + env: + IMAGE_NAME: mucoll-minimal steps: + - name: Free Disk Space (Ubuntu) + uses: jlumbroso/free-disk-space@v1 + with: + tool-cache: true - name: Checkout uses: actions/checkout@v4 with: @@ -90,7 +88,7 @@ jobs: - name: Login to DockerHub uses: docker/login-action@v3 with: - registry: ghcr.io + registry: ${{ env.REGISTRY }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: lowercase owner name @@ -102,7 +100,7 @@ jobs: id: meta uses: docker/metadata-action@v5 with: - images: ghcr.io/${{env.OWNER_LC}}/mucoll-dummy + images: ${{ env.REGISTRY }}/${{env.OWNER_LC}}/mucoll-dummy - name: Build and Push id: docker_build uses: docker/build-push-action@v6 @@ -112,8 +110,9 @@ jobs: file: ./${{matrix.os.dir}}/Dockerfile-base build-args: | VERSION=${{ steps.meta.outputs.version }} - REPOSITORY=ghcr.io/${{env.OWNER_LC}} - tags: ghcr.io/${{env.OWNER_LC}}/mucoll-base:${{steps.meta.outputs.version}}-${{matrix.os.suffix}} + REPOSITORY=${{ env.REGISTRY }}/${{env.OWNER_LC}} + tags: ${{ env.REGISTRY }}/${{env.OWNER_LC}}/${{ env.IMAGE_NAME}}:${{steps.meta.outputs.version}}-${{matrix.os.suffix}} + labels: ${{ steps.meta.outputs.labels }} build-sim: runs-on: ubuntu-latest needs: build-base @@ -121,6 +120,10 @@ jobs: matrix: os: [{dir: AlmaLinux9,suffix: alma9}] steps: + - name: Free Disk Space (Ubuntu) + uses: jlumbroso/free-disk-space@v1 + with: + tool-cache: true - name: Checkout uses: actions/checkout@v4 with: @@ -130,7 +133,7 @@ jobs: - name: Login to DockerHub uses: docker/login-action@v3 with: - registry: ghcr.io + registry: ${{ env.REGISTRY }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: lowercase owner name @@ -142,7 +145,7 @@ jobs: id: meta uses: docker/metadata-action@v5 with: - images: ghcr.io/${{env.OWNER_LC}}/mucoll-dummy + images: ${{ env.REGISTRY }}/${{env.OWNER_LC}}/mucoll-dummy - name: Build and Push id: docker_build uses: docker/build-push-action@v6 @@ -152,5 +155,5 @@ jobs: file: ./${{matrix.os.dir}}/Dockerfile-sim build-args: | VERSION=${{ steps.meta.outputs.version }} - REPOSITORY=ghcr.io/${{env.OWNER_LC}} - tags: ghcr.io/${{env.OWNER_LC}}/mucoll-sim:${{steps.meta.outputs.version}}-${{matrix.os.suffix}} + REPOSITORY=${{ env.REGISTRY }}/${{env.OWNER_LC}} + tags: ${{ env.REGISTRY }}/${{env.OWNER_LC}}/mucoll-sim:${{steps.meta.outputs.version}}-${{matrix.os.suffix}} From 7d64f60288e620a69885d50ea20005f88a2d3a2f Mon Sep 17 00:00:00 2001 From: Federico Meloni Date: Wed, 20 Nov 2024 18:42:16 +0100 Subject: [PATCH 18/26] free disk space --- .github/workflows/build-image.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-image.yml b/.github/workflows/build-image.yml index 7319003..da0464b 100644 --- a/.github/workflows/build-image.yml +++ b/.github/workflows/build-image.yml @@ -76,7 +76,7 @@ jobs: IMAGE_NAME: mucoll-minimal steps: - name: Free Disk Space (Ubuntu) - uses: jlumbroso/free-disk-space@v1 + uses: jlumbroso/free-disk-space@main with: tool-cache: true - name: Checkout From 3e375536fd9b9b4f589c90fcc84a3e4c7813e11b Mon Sep 17 00:00:00 2001 From: Federico Meloni Date: Wed, 20 Nov 2024 21:48:07 +0100 Subject: [PATCH 19/26] update spack commit --- AlmaLinux9/Dockerfile-sim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/AlmaLinux9/Dockerfile-sim b/AlmaLinux9/Dockerfile-sim index 8fd2f1e..ded45b8 100644 --- a/AlmaLinux9/Dockerfile-sim +++ b/AlmaLinux9/Dockerfile-sim @@ -8,7 +8,7 @@ ARG REPOSITORY=madbaron FROM ${REPOSITORY}/mucoll-base:${VERSION}-alma9 # Adding repository: MuColl -ARG MUCOLL_COMMIT=3ff04277d2743a36bc4e6b6d162af22e3d2e4bd7 +ARG MUCOLL_COMMIT=538b2743d2198d8e89eb28b0af4db7afa8728f68 RUN source /opt/setup_spack.sh && \ REPOPATH=${SPACK_ROOT}/var/mucoll-spack && \ @@ -20,12 +20,12 @@ RUN source /opt/setup_spack.sh && \ # Apply our patches to spack COPY apply_patches.sh ./apply_patches.sh + RUN source /opt/setup_spack.sh && \ ./apply_patches.sh ${SPACK_ROOT}/var/mucoll-spack # Add the package repositories RUN source /opt/setup_spack.sh && \ - spack repo add --scope system ${SPACK_ROOT}/var/key4hep-spack && \ spack repo add --scope system ${SPACK_ROOT}/var/mucoll-spack # Create the release environment From 3f4e1e8aa85a5bc641e9e37e564e0d6317f43d60 Mon Sep 17 00:00:00 2001 From: Federico Meloni Date: Thu, 21 Nov 2024 10:48:46 +0100 Subject: [PATCH 20/26] differentiating workflows --- .../{build-image.yml => full-rebuild.yml} | 6 +- .github/workflows/minimal-rebuild.yml | 112 ++++++++++++++++++ .github/workflows/mucoll-rebuild.yml | 65 ++++++++++ AlmaLinux9/Dockerfile-sim | 16 +-- 4 files changed, 190 insertions(+), 9 deletions(-) rename .github/workflows/{build-image.yml => full-rebuild.yml} (96%) create mode 100644 .github/workflows/minimal-rebuild.yml create mode 100644 .github/workflows/mucoll-rebuild.yml diff --git a/.github/workflows/build-image.yml b/.github/workflows/full-rebuild.yml similarity index 96% rename from .github/workflows/build-image.yml rename to .github/workflows/full-rebuild.yml index da0464b..c17e8fc 100644 --- a/.github/workflows/build-image.yml +++ b/.github/workflows/full-rebuild.yml @@ -1,4 +1,4 @@ -name: Build and Publish Docker Images +name: Re-build and publish everything on: push: @@ -6,6 +6,8 @@ on: - 'master' - 'main' - '2.10' + paths: + - 'MuonCollider-docker/AlmaLinux9/Dockerfile-spack' tags: - 'v*' pull_request: @@ -121,7 +123,7 @@ jobs: os: [{dir: AlmaLinux9,suffix: alma9}] steps: - name: Free Disk Space (Ubuntu) - uses: jlumbroso/free-disk-space@v1 + uses: jlumbroso/free-disk-space@main with: tool-cache: true - name: Checkout diff --git a/.github/workflows/minimal-rebuild.yml b/.github/workflows/minimal-rebuild.yml new file mode 100644 index 0000000..e1bbc05 --- /dev/null +++ b/.github/workflows/minimal-rebuild.yml @@ -0,0 +1,112 @@ +name: Re-build and publish Minimal + +on: + push: + branches: + - 'master' + - 'main' + - '2.10' + paths: + - 'MuonCollider-docker/AlmaLinux9/Dockerfile-base' + workflow_dispatch: + +env: + REGISTRY: ghcr.io + +permissions: + contents: read + packages: write + id-token: write + attestations: write + +jobs: + build-base: + runs-on: ubuntu-latest + strategy: + matrix: + os: [{dir: AlmaLinux9,suffix: alma9}] + env: + IMAGE_NAME: mucoll-minimal + steps: + - name: Free Disk Space (Ubuntu) + uses: jlumbroso/free-disk-space@main + with: + tool-cache: true + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Login to DockerHub + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: lowercase owner name + run: | + echo "OWNER_LC=${OWNER,,}" >>${GITHUB_ENV} + env: + OWNER: '${{ github.repository_owner }}' + - name: Docker Meta + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{env.OWNER_LC}}/mucoll-dummy + - name: Build and Push + id: docker_build + uses: docker/build-push-action@v6 + with: + push: true + context: ./${{matrix.os.dir}} + file: ./${{matrix.os.dir}}/Dockerfile-base + build-args: | + VERSION=${{ steps.meta.outputs.version }} + REPOSITORY=${{ env.REGISTRY }}/${{env.OWNER_LC}} + tags: ${{ env.REGISTRY }}/${{env.OWNER_LC}}/${{ env.IMAGE_NAME}}:${{steps.meta.outputs.version}}-${{matrix.os.suffix}} + labels: ${{ steps.meta.outputs.labels }} + build-sim: + runs-on: ubuntu-latest + needs: build-base + strategy: + matrix: + os: [{dir: AlmaLinux9,suffix: alma9}] + steps: + - name: Free Disk Space (Ubuntu) + uses: jlumbroso/free-disk-space@main + with: + tool-cache: true + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Login to DockerHub + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: lowercase owner name + run: | + echo "OWNER_LC=${OWNER,,}" >>${GITHUB_ENV} + env: + OWNER: '${{ github.repository_owner }}' + - name: Docker Meta + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{env.OWNER_LC}}/mucoll-dummy + - name: Build and Push + id: docker_build + uses: docker/build-push-action@v6 + with: + push: true + context: ./${{matrix.os.dir}} + file: ./${{matrix.os.dir}}/Dockerfile-sim + build-args: | + VERSION=${{ steps.meta.outputs.version }} + REPOSITORY=${{ env.REGISTRY }}/${{env.OWNER_LC}} + tags: ${{ env.REGISTRY }}/${{env.OWNER_LC}}/mucoll-sim:${{steps.meta.outputs.version}}-${{matrix.os.suffix}} diff --git a/.github/workflows/mucoll-rebuild.yml b/.github/workflows/mucoll-rebuild.yml new file mode 100644 index 0000000..f7511e2 --- /dev/null +++ b/.github/workflows/mucoll-rebuild.yml @@ -0,0 +1,65 @@ +name: Re-build and publish MuColl + +on: + push: + branches: + - 'master' + - 'main' + - '2.10' + paths: + - 'MuonCollider-docker/AlmaLinux9/Dockerfile-sim' + workflow_dispatch: + +env: + REGISTRY: ghcr.io + +permissions: + contents: read + packages: write + id-token: write + attestations: write + +jobs: + build-sim: + runs-on: ubuntu-latest + strategy: + matrix: + os: [{dir: AlmaLinux9,suffix: alma9}] + steps: + - name: Free Disk Space (Ubuntu) + uses: jlumbroso/free-disk-space@main + with: + tool-cache: true + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Login to DockerHub + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: lowercase owner name + run: | + echo "OWNER_LC=${OWNER,,}" >>${GITHUB_ENV} + env: + OWNER: '${{ github.repository_owner }}' + - name: Docker Meta + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{env.OWNER_LC}}/mucoll-dummy + - name: Build and Push + id: docker_build + uses: docker/build-push-action@v6 + with: + push: true + context: ./${{matrix.os.dir}} + file: ./${{matrix.os.dir}}/Dockerfile-sim + build-args: | + VERSION=${{ steps.meta.outputs.version }} + REPOSITORY=${{ env.REGISTRY }}/${{env.OWNER_LC}} + tags: ${{ env.REGISTRY }}/${{env.OWNER_LC}}/mucoll-sim:${{steps.meta.outputs.version}}-${{matrix.os.suffix}} diff --git a/AlmaLinux9/Dockerfile-sim b/AlmaLinux9/Dockerfile-sim index ded45b8..99ab116 100644 --- a/AlmaLinux9/Dockerfile-sim +++ b/AlmaLinux9/Dockerfile-sim @@ -5,10 +5,10 @@ ARG VERSION=dev ARG REPOSITORY=madbaron -FROM ${REPOSITORY}/mucoll-base:${VERSION}-alma9 +FROM ${REPOSITORY}/mucoll-minimal:${VERSION}-alma9 # Adding repository: MuColl -ARG MUCOLL_COMMIT=538b2743d2198d8e89eb28b0af4db7afa8728f68 +ARG MUCOLL_COMMIT=c77399b9f1500dd4ad80fcaa067ae44fb566503e RUN source /opt/setup_spack.sh && \ REPOPATH=${SPACK_ROOT}/var/mucoll-spack && \ @@ -30,11 +30,13 @@ RUN source /opt/setup_spack.sh && \ # Create the release environment RUN source /opt/setup_spack.sh && \ - spack env create sim && \ - spack env activate sim && \ - cp ${SPACK_ROOT}/var/mucoll-spack/environments/mucoll-release/*.yaml ${SPACK_ENV} && \ + cd ${SPACK_ROOT}/var/mucoll-spack/environments/mucoll-release && \ + spack env activate . && \ + cd - && \ echo "source /opt/setup_spack.sh" > ${HOME}/setup_env.sh && \ - echo "spack env activate sim" >> ${HOME}/setup_env.sh && \ + echo "cd ${SPACK_ROOT}/var/mucoll-spack/environments/mucoll-release" >> ${HOME}/setup_env.sh && \ + echo "spack env activate ." >> ${HOME}/setup_env.sh && \ + echo "cd -" >> ${HOME}/setup_env.sh && \ echo "spack env status" >> ${HOME}/setup_env.sh # Concretizing the MuColl stack reusing system packages as external @@ -43,7 +45,7 @@ RUN source ${HOME}/setup_env.sh && \ spack concretize --reuse # Installing fragments of dependency tree in separate layers for cached debugging -ENV SPACK_INSTALL_OPTS="--only-concrete --no-add --fail-fast --deprecated" +ENV SPACK_INSTALL_OPTS="--only-concrete --no-add --fail-fast" RUN source ${HOME}/setup_env.sh && \ spack spec -NIt && \ From ae6f9ca75c5c68b31003928d409f840f5b45502c Mon Sep 17 00:00:00 2001 From: Federico Meloni Date: Thu, 21 Nov 2024 10:52:52 +0100 Subject: [PATCH 21/26] understanding workflows --- .github/workflows/full-rebuild.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/full-rebuild.yml b/.github/workflows/full-rebuild.yml index c17e8fc..f394683 100644 --- a/.github/workflows/full-rebuild.yml +++ b/.github/workflows/full-rebuild.yml @@ -7,7 +7,7 @@ on: - 'main' - '2.10' paths: - - 'MuonCollider-docker/AlmaLinux9/Dockerfile-spack' + - 'MuonCollider-docker/AlmaLinux9/**' tags: - 'v*' pull_request: From f335ae3ae9aada02ca6bd8927e67813815d482ba Mon Sep 17 00:00:00 2001 From: Federico Meloni Date: Thu, 21 Nov 2024 10:53:50 +0100 Subject: [PATCH 22/26] understanding workflows --- .github/workflows/full-rebuild.yml | 2 +- .github/workflows/minimal-rebuild.yml | 2 +- .github/workflows/mucoll-rebuild.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/full-rebuild.yml b/.github/workflows/full-rebuild.yml index f394683..1c9f4ba 100644 --- a/.github/workflows/full-rebuild.yml +++ b/.github/workflows/full-rebuild.yml @@ -7,7 +7,7 @@ on: - 'main' - '2.10' paths: - - 'MuonCollider-docker/AlmaLinux9/**' + - 'AlmaLinux9/**' tags: - 'v*' pull_request: diff --git a/.github/workflows/minimal-rebuild.yml b/.github/workflows/minimal-rebuild.yml index e1bbc05..c51fb2e 100644 --- a/.github/workflows/minimal-rebuild.yml +++ b/.github/workflows/minimal-rebuild.yml @@ -7,7 +7,7 @@ on: - 'main' - '2.10' paths: - - 'MuonCollider-docker/AlmaLinux9/Dockerfile-base' + - 'AlmaLinux9/Dockerfile-base' workflow_dispatch: env: diff --git a/.github/workflows/mucoll-rebuild.yml b/.github/workflows/mucoll-rebuild.yml index f7511e2..ee80be5 100644 --- a/.github/workflows/mucoll-rebuild.yml +++ b/.github/workflows/mucoll-rebuild.yml @@ -7,7 +7,7 @@ on: - 'main' - '2.10' paths: - - 'MuonCollider-docker/AlmaLinux9/Dockerfile-sim' + - 'AlmaLinux9/Dockerfile-sim' workflow_dispatch: env: From e79e2c34f8e33b34a7faa0d73956b0867341e295 Mon Sep 17 00:00:00 2001 From: Federico Meloni Date: Thu, 21 Nov 2024 10:54:34 +0100 Subject: [PATCH 23/26] understanding workflows --- .github/workflows/full-rebuild.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/full-rebuild.yml b/.github/workflows/full-rebuild.yml index 1c9f4ba..a4ce235 100644 --- a/.github/workflows/full-rebuild.yml +++ b/.github/workflows/full-rebuild.yml @@ -6,8 +6,6 @@ on: - 'master' - 'main' - '2.10' - paths: - - 'AlmaLinux9/**' tags: - 'v*' pull_request: From 4e059dc232f64b0df0910fc472a9a8a2d3740d41 Mon Sep 17 00:00:00 2001 From: Federico Meloni Date: Thu, 21 Nov 2024 10:55:32 +0100 Subject: [PATCH 24/26] understanding workflows --- .github/workflows/mucoll-rebuild.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/mucoll-rebuild.yml b/.github/workflows/mucoll-rebuild.yml index ee80be5..0c5cdb6 100644 --- a/.github/workflows/mucoll-rebuild.yml +++ b/.github/workflows/mucoll-rebuild.yml @@ -2,10 +2,6 @@ name: Re-build and publish MuColl on: push: - branches: - - 'master' - - 'main' - - '2.10' paths: - 'AlmaLinux9/Dockerfile-sim' workflow_dispatch: From 513b6d1323be13a0b9fd9e2a6120d18b8cd00c8b Mon Sep 17 00:00:00 2001 From: Federico Meloni Date: Thu, 21 Nov 2024 11:05:17 +0100 Subject: [PATCH 25/26] getting rid of hardcoded hashes --- AlmaLinux9/Dockerfile-sim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AlmaLinux9/Dockerfile-sim b/AlmaLinux9/Dockerfile-sim index 99ab116..37514e5 100644 --- a/AlmaLinux9/Dockerfile-sim +++ b/AlmaLinux9/Dockerfile-sim @@ -8,7 +8,7 @@ ARG REPOSITORY=madbaron FROM ${REPOSITORY}/mucoll-minimal:${VERSION}-alma9 # Adding repository: MuColl -ARG MUCOLL_COMMIT=c77399b9f1500dd4ad80fcaa067ae44fb566503e +ARG MUCOLL_COMMIT=11a32828ca9230337562dc43f91a25862d3a21ff RUN source /opt/setup_spack.sh && \ REPOPATH=${SPACK_ROOT}/var/mucoll-spack && \ From ce47dfa3f7021bdbf54343b8337eb08ec02d70d5 Mon Sep 17 00:00:00 2001 From: Federico Meloni Date: Thu, 21 Nov 2024 11:07:39 +0100 Subject: [PATCH 26/26] improving workflows --- .github/workflows/full-rebuild.yml | 6 ++---- .github/workflows/minimal-rebuild.yml | 4 ---- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/.github/workflows/full-rebuild.yml b/.github/workflows/full-rebuild.yml index a4ce235..c4a03ff 100644 --- a/.github/workflows/full-rebuild.yml +++ b/.github/workflows/full-rebuild.yml @@ -2,10 +2,8 @@ name: Re-build and publish everything on: push: - branches: - - 'master' - - 'main' - - '2.10' + paths: + - 'AlmaLinux9/Dockerfile-spack' tags: - 'v*' pull_request: diff --git a/.github/workflows/minimal-rebuild.yml b/.github/workflows/minimal-rebuild.yml index c51fb2e..0cbbaad 100644 --- a/.github/workflows/minimal-rebuild.yml +++ b/.github/workflows/minimal-rebuild.yml @@ -2,10 +2,6 @@ name: Re-build and publish Minimal on: push: - branches: - - 'master' - - 'main' - - '2.10' paths: - 'AlmaLinux9/Dockerfile-base' workflow_dispatch: