2021-09-30 21:34:47 +00:00
|
|
|
name: Containers
|
2021-08-06 22:53:46 +00:00
|
|
|
on:
|
2021-09-30 21:34:47 +00:00
|
|
|
# This Workflow can be triggered manually
|
|
|
|
workflow_dispatch:
|
2021-08-06 22:53:46 +00:00
|
|
|
# Build new Spack develop containers nightly.
|
|
|
|
schedule:
|
|
|
|
- cron: '34 0 * * *'
|
2021-09-30 21:34:47 +00:00
|
|
|
# Run on pull requests that modify this file
|
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- develop
|
|
|
|
paths:
|
|
|
|
- '.github/workflows/build-containers.yml'
|
2021-08-06 22:53:46 +00:00
|
|
|
# Let's also build & tag Spack containers on releases.
|
|
|
|
release:
|
|
|
|
types: [published]
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
deploy-images:
|
2021-10-05 23:12:25 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
permissions:
|
|
|
|
packages: write
|
2021-08-06 22:53:46 +00:00
|
|
|
strategy:
|
|
|
|
# Even if one container fails to build we still want the others
|
|
|
|
# to continue their builds.
|
|
|
|
fail-fast: false
|
|
|
|
# A matrix of Dockerfile paths, associated tags, and which architectures
|
|
|
|
# they support.
|
|
|
|
matrix:
|
2021-10-04 07:34:53 +00:00
|
|
|
dockerfile: [[amazon-linux, amazonlinux-2.dockerfile, 'linux/amd64,linux/arm64'],
|
|
|
|
[centos7, centos-7.dockerfile, 'linux/amd64,linux/arm64,linux/ppc64le'],
|
|
|
|
[leap15, leap-15.dockerfile, 'linux/amd64,linux/arm64,linux/ppc64le'],
|
|
|
|
[ubuntu-xenial, ubuntu-1604.dockerfile, 'linux/amd64,linux/arm64,linux/ppc64le'],
|
|
|
|
[ubuntu-bionic, ubuntu-1804.dockerfile, 'linux/amd64,linux/arm64,linux/ppc64le']]
|
2021-08-06 22:53:46 +00:00
|
|
|
name: Build ${{ matrix.dockerfile[0] }}
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2021-11-02 07:55:28 +00:00
|
|
|
uses: actions/checkout@1e204e9a9253d643386038d443f96446fa156a97 # @v2
|
2021-08-06 22:53:46 +00:00
|
|
|
|
|
|
|
- name: Set Container Tag Normal (Nightly)
|
|
|
|
run: |
|
2021-09-30 21:34:47 +00:00
|
|
|
container="${{ matrix.dockerfile[0] }}:latest"
|
2021-08-06 22:53:46 +00:00
|
|
|
echo "container=${container}" >> $GITHUB_ENV
|
|
|
|
echo "versioned=${container}" >> $GITHUB_ENV
|
|
|
|
|
|
|
|
# On a new release create a container with the same tag as the release.
|
|
|
|
- name: Set Container Tag on Release
|
|
|
|
if: github.event_name == 'release'
|
|
|
|
run: |
|
2021-09-30 21:34:47 +00:00
|
|
|
versioned="${{matrix.dockerfile[0]}}:${GITHUB_REF##*/}"
|
2021-08-06 22:53:46 +00:00
|
|
|
echo "versioned=${versioned}" >> $GITHUB_ENV
|
|
|
|
|
|
|
|
- name: Check ${{ matrix.dockerfile[1] }} Exists
|
|
|
|
run: |
|
|
|
|
printf "Preparing to build ${{ env.container }} from ${{ matrix.dockerfile[1] }}"
|
|
|
|
if [ ! -f "share/spack/docker/${{ matrix.dockerfile[1]}}" ]; then
|
|
|
|
printf "Dockerfile ${{ matrix.dockerfile[0]}} does not exist"
|
|
|
|
exit 1;
|
|
|
|
fi
|
|
|
|
|
2021-09-30 21:34:47 +00:00
|
|
|
- name: Set up QEMU
|
2021-11-01 17:44:03 +00:00
|
|
|
uses: docker/setup-qemu-action27d0a4f181a40b142cce983c5393082c365d1480 # @v1
|
2021-09-30 21:34:47 +00:00
|
|
|
|
|
|
|
- name: Set up Docker Buildx
|
2021-11-01 17:44:03 +00:00
|
|
|
uses: docker/setup-buildx-action@94ab11c41e45d028884a99163086648e898eed25 # @v1
|
2021-09-30 21:34:47 +00:00
|
|
|
|
2021-08-06 22:53:46 +00:00
|
|
|
- name: Log in to GitHub Container Registry
|
2021-11-01 17:44:03 +00:00
|
|
|
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 # @v1
|
2021-08-06 22:53:46 +00:00
|
|
|
with:
|
|
|
|
registry: ghcr.io
|
2021-08-07 00:25:36 +00:00
|
|
|
username: ${{ github.actor }}
|
2021-08-06 22:53:46 +00:00
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|
2021-09-30 21:34:47 +00:00
|
|
|
- name: Log in to DockerHub
|
2021-11-01 17:44:03 +00:00
|
|
|
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 # @v1
|
2021-09-30 21:34:47 +00:00
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
2021-08-06 22:53:46 +00:00
|
|
|
|
2021-08-07 18:02:02 +00:00
|
|
|
- name: Build & Deploy ${{ matrix.dockerfile[1] }}
|
2021-11-01 17:44:03 +00:00
|
|
|
uses: docker/build-push-action@a66e35b9cbcf4ad0ea91ffcaf7bbad63ad9e0229 # @v2
|
2021-08-06 22:53:46 +00:00
|
|
|
with:
|
|
|
|
file: share/spack/docker/${{matrix.dockerfile[1]}}
|
|
|
|
platforms: ${{ matrix.dockerfile[2] }}
|
2021-09-30 21:34:47 +00:00
|
|
|
push: ${{ github.event_name != 'pull_request' }}
|
2021-08-06 22:53:46 +00:00
|
|
|
tags: |
|
2021-09-30 21:34:47 +00:00
|
|
|
spack/${{ env.container }}
|
|
|
|
spack/${{ env.versioned }}
|
|
|
|
ghcr.io/spack/${{ env.container }}
|
|
|
|
ghcr.io/spack/${{ env.versioned }}
|