Skip to content

Commit d8df180

Browse files
committed
Initial WIP to test image building here.
1 parent a6ee716 commit d8df180

File tree

7 files changed

+292
-150
lines changed

7 files changed

+292
-150
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions
2+
# https://docs.github.com/en/actions/use-cases-and-examples/publishing-packages/publishing-docker-images#publishing-images-to-github-packages
3+
name: 'Build docker image for use in GitHub Actions'
4+
description: 'Builds a docker image for use in GitHub Actions for a given compiler and a given compiler version.'
5+
6+
inputs:
7+
compiler-name:
8+
description: 'The Fortran compiler to install.'
9+
required: true
10+
compiler-version:
11+
description: 'The compiler version to install.'
12+
required: true
13+
docker-registry-name:
14+
description: 'The docker registry to publish to.'
15+
default: 'ghcr.io'
16+
docker-registry-username:
17+
description: 'The username to login to the docker registry with.'
18+
required: true
19+
docker-registry-password:
20+
description: 'The password to login to the docker registry with.'
21+
required: true
22+
image-name:
23+
description: 'The name of the docker image.'
24+
required: true
25+
26+
runs:
27+
using: 'composite'
28+
steps:
29+
- name: "Log in to the container registry"
30+
uses: docker/login-action@v3
31+
with:
32+
registry: ${{ inputs.docker-registry-name }}
33+
username: ${{ inputs.docker-registry-username }}
34+
password: ${{ inputs.docker-registry-password }}
35+
36+
- name: "Extract metadata (tags, labels) for docker"
37+
id: meta
38+
uses: docker/metadata-action@v5
39+
with:
40+
images: ${{ inputs.docker-registry-name }}/${{ inputs.image-name }}
41+
tags: |
42+
type=raw,value=linux-${{ inputs.compiler-name }}-${{ inputs.compiler-version }}
43+
type=sha
44+
type=ref,enable=true,priority=600,prefix=,suffix=,event=branch
45+
type=ref,enable=true,priority=600,prefix=,suffix=,event=tag
46+
type=ref,enable=true,priority=600,prefix=pr-,suffix=,event=pr
47+
48+
- name: "Build and push docker image"
49+
id: push
50+
uses: docker/build-push-action@v6
51+
with:
52+
context: docker/github-actions/
53+
build-args: |
54+
COMPILER=${{ inputs.compiler-name }}
55+
VERSION=${{ inputs.compiler-version }}
56+
push: true
57+
tags: ${{ steps.meta.outputs.tags }}
58+
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)