Build custom hub image #21
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: Build custom hub image | |
on: | |
release: | |
types: [ published ] | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: Image tag | |
required: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
# see https://github.com/docker/build-push-action | |
steps: | |
# Setup (see https://github.com/docker/build-push-action) | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- 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 }} | |
# Publish to Docker hub | |
- name: Store version number (on release) | |
if: ${{ github.event_name == 'release' }} | |
id: version | |
# GITHUB_REF looks like "refs/tags/0.3.1" - we need to extract the actual version without the v prefix | |
run: echo ::set-output name=number::${GITHUB_REF##*/} | |
- name: Build and push (on release) | |
if: ${{ github.event_name == 'release' }} | |
uses: docker/build-push-action@v4 | |
with: | |
push: true | |
context: jupyterhub | |
file: jupyterhub/Dockerfile | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
tags: | | |
blsq/openhexa-jupyterhub:${{ steps.version.outputs.number }} | |
blsq/openhexa-jupyterhub:latest | |
- name: Build and push (manual) | |
if: ${{ github.event_name == 'workflow_dispatch' }} | |
uses: docker/build-push-action@v4 | |
with: | |
push: true | |
context: jupyterhub | |
file: jupyterhub/Dockerfile | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
tags: | | |
blsq/openhexa-jupyterhub:${{ github.event.inputs.tag }} | |
blsq/openhexa-jupyterhub:latest | |