|
| 1 | +name: Build alma10-spack docker image |
| 2 | + |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + - cron: "0 0 * * 0" |
| 6 | + |
| 7 | + push: |
| 8 | + branches: [ main ] |
| 9 | + tags: |
| 10 | + - 'v*' |
| 11 | + paths: |
| 12 | + - dockerfiles/alma10-spack-base.dockerfile |
| 13 | + |
| 14 | + workflow_dispatch: |
| 15 | + |
| 16 | +jobs: |
| 17 | + |
| 18 | + push_to_registries: |
| 19 | + name: Push Docker image to multiple registries |
| 20 | + runs-on: ubuntu-latest |
| 21 | + permissions: |
| 22 | + packages: write |
| 23 | + contents: read |
| 24 | + steps: |
| 25 | + - name: Delete huge unnecessary tools folder |
| 26 | + run: rm -rf /opt/hostedtoolcache |
| 27 | + |
| 28 | + - name: Check out the repo |
| 29 | + uses: actions/checkout@main |
| 30 | + with: |
| 31 | + repository: art-daq/daq-docker |
| 32 | + path: daq-docker |
| 33 | + |
| 34 | + - name: Log in to Docker Hub |
| 35 | + uses: docker/login-action@master |
| 36 | + with: |
| 37 | + username: ${{ secrets.DOCKERHUB_USERNAME }} |
| 38 | + password: ${{ secrets.DOCKERHUB_TOKEN }} |
| 39 | + |
| 40 | + - name: Log in to the Container registry |
| 41 | + uses: docker/login-action@master |
| 42 | + with: |
| 43 | + registry: ghcr.io |
| 44 | + username: ${{ github.actor }} |
| 45 | + password: ${{ secrets.TOKEN_GHIO }} |
| 46 | + |
| 47 | + - name: Extract metadata (tags, labels) for Docker |
| 48 | + id: meta |
| 49 | + uses: docker/metadata-action@master |
| 50 | + with: |
| 51 | + images: | |
| 52 | + eflumerf/alma10-spack |
| 53 | + ghcr.io/art-daq/alma10-spack |
| 54 | + tags: | |
| 55 | + type=raw,value=latest |
| 56 | + type=ref,event=branch |
| 57 | + type=ref,event=tag |
| 58 | + |
| 59 | + - name: prepare build dir |
| 60 | + run: | |
| 61 | + build_dir="${{ github.workspace }}/docker-build" |
| 62 | + mkdir -p $build_dir |
| 63 | + cd $build_dir |
| 64 | + cp ${{ github.workspace }}/daq-docker/dockerfiles/alma10-spack-base.dockerfile $build_dir/Dockerfile |
| 65 | + |
| 66 | + - name: Build and push Docker images |
| 67 | + uses: docker/build-push-action@master |
| 68 | + with: |
| 69 | + context: ${{ github.workspace }}/docker-build |
| 70 | + push: true |
| 71 | + tags: ${{ steps.meta.outputs.tags }} |
| 72 | + labels: ${{ steps.meta.outputs.labels }} |
| 73 | + |
0 commit comments