Skip to content

Initial WIP to test image building here. #124

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions .github/actions/build-gha-docker-image/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions
# https://docs.github.com/en/actions/use-cases-and-examples/publishing-packages/publishing-docker-images#publishing-images-to-github-packages
name: 'Build docker image for use in GitHub Actions'
description: 'Builds a docker image for use in GitHub Actions for a given compiler and a given compiler version.'

inputs:
compiler-name:
description: 'The Fortran compiler to install.'
required: true
compiler-version:
description: 'The compiler version to install.'
required: true
docker-registry-name:
description: 'The docker registry to publish to.'
default: 'ghcr.io'
docker-registry-username:
description: 'The username to login to the docker registry with.'
required: true
docker-registry-password:
description: 'The password to login to the docker registry with.'
required: true
image-name:
description: 'The name of the docker image.'
required: true

runs:
using: 'composite'
steps:
- name: "Log in to the container registry"
uses: docker/login-action@v3
with:
registry: ${{ inputs.docker-registry-name }}
username: ${{ inputs.docker-registry-username }}
password: ${{ inputs.docker-registry-password }}

- name: "Extract metadata (tags, labels) for docker"
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ inputs.docker-registry-name }}/${{ inputs.image-name }}
tags: |
type=raw,value=linux-${{ inputs.compiler-name }}-${{ inputs.compiler-version }}
type=sha
type=ref,enable=true,priority=600,prefix=,suffix=,event=branch
type=ref,enable=true,priority=600,prefix=,suffix=,event=tag
type=ref,enable=true,priority=600,prefix=pr-,suffix=,event=pr

- name: "Build and push docker image"
id: push
uses: docker/build-push-action@v6
with:
context: docker/github-actions/
build-args: |
COMPILER=${{ inputs.compiler-name }}
VERSION=${{ inputs.compiler-version }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
Loading
Loading