docker_images #204
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: docker_images | |
on: | |
push: | |
pull_request: | |
schedule: | |
- cron: "14 14 * * TUE" # Every Tuesday at 14:14 | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false # Build all images so we can see which fail | |
matrix: | |
image: | |
[ | |
hartree-notebook, | |
jupyter-datascience-notebook, | |
jupyter-openstack-notebook-centos, | |
jupyter-tensorflow-notebook, | |
jupyter-all-spark-notebook, | |
jupyter-minimal, | |
jupyter-r-notebook, | |
jupyter-base-notebook-centos, | |
jupyter-openstack-notebook, | |
jupyter-scipy-notebook, | |
jupyter-opengl, | |
] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Login to Harbor | |
uses: docker/login-action@v2 | |
with: | |
registry: harbor.stfc.ac.uk | |
username: ${{ secrets.HARBOR_USERNAME }} | |
password: ${{ secrets.HARBOR_TOKEN }} | |
- name: Build notebook and push to prod | |
if: ${{ github.ref == 'refs/heads/master' }} | |
uses: docker/build-push-action@v3 | |
with: | |
push: true | |
context: "{{defaultContext}}:${{ matrix.image }}" | |
tags: "harbor.stfc.ac.uk/stfc-cloud/${{ matrix.image }}:latest" | |
- name: Set commit SHA for later | |
id: commit_sha | |
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
- name: Build notebook and push to staging | |
if: ${{ github.ref != 'refs/heads/master' }} | |
uses: docker/build-push-action@v3 | |
with: | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
push: true | |
context: "{{defaultContext}}:${{ matrix.image }}" | |
tags: "harbor.stfc.ac.uk/stfc-cloud-staging/${{ matrix.image }}:${{ steps.commit_sha.outputs.sha_short }}" | |
- name: Inform of tagged name | |
if: ${{ github.ref != 'refs/heads/master' }} | |
run: echo "Image published to harbor.stfc.ac.uk/stfc-cloud-staging/${{ matrix.image }}:${{ steps.commit_sha.outputs.sha_short }}" |