docker #6
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 | |
on: | |
workflow_dispatch: | |
inputs: | |
dockerfile: | |
description: 'Select the Dockerfile to use' | |
required: true | |
default: 'Dockerfile.dachub' | |
options: | |
- Dockerfile.dachub | |
- Dockerfile.incore | |
jobs: | |
docker: | |
permissions: | |
contents: read | |
packages: write | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
# Create metadata for image | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
hub.ncsa.illinois.edu/dachub/${{ github.event.inputs.dockerfile }} | |
ghcr.io/${{ github.repository_owner }}/${{ github.event.inputs.dockerfile }} | |
tags: | | |
type=schedule | |
type=ref,event=branch | |
type=ref,event=pr | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=semver,pattern={{major}} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Inspect Builder | |
run: | | |
echo "Name: ${{ steps.buildx.outputs.name }}" | |
echo "Endpoint: ${{ steps.buildx.outputs.endpoint }}" | |
echo "Status: ${{ steps.buildx.outputs.status }}" | |
echo "Flags: ${{ steps.buildx.outputs.flags }}" | |
echo "Platforms: ${{ steps.buildx.outputs.platforms }}" | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Login to NCSA Hub | |
uses: docker/login-action@v3 | |
with: | |
registry: hub.ncsa.illinois.edu | |
username: ${{ secrets.NCSA_HUB_USERNAME }} | |
password: ${{ secrets.NCSA_HUB_PASSWORD }} | |
# Build and push | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
file: ${{ github.event.inputs.dockerfile }} | |
push: true | |
platforms: linux/amd64 | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
build-args: | | |
VERSION=${{ steps.meta.outputs.version }} |