Skip to content

Commit e137d40

Browse files
committed
Test stackhpc docker-multiarch-build-push
1 parent 498b70b commit e137d40

File tree

1 file changed

+32
-26
lines changed

1 file changed

+32
-26
lines changed

.github/workflows/docker-images.yaml

Lines changed: 32 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,43 @@
11
name: Multi-Arch Docker Build and Push to GHCR
2-
32
on:
43
push:
54
branches:
65
- master
76
tags:
87
- v*
8+
workflow_dispatch:
9+
910
jobs:
1011
build:
1112
runs-on: ubuntu-latest
12-
1313
steps:
14-
- name: Checkout code
15-
uses: actions/checkout@v2
16-
17-
- name: Login to GHCR
18-
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.repository_owner }} --password-stdin
19-
20-
- name: Set up QEMU
21-
uses: docker/setup-qemu-action@v3
22-
23-
- name: Set up Docker Buildx for multiarch images
24-
uses: docker/setup-buildx-action@v3
25-
26-
- name: Build and push Docker image to GHCR
27-
run: |
28-
# Strip git ref prefix from version
29-
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
30-
31-
# Strip "v" prefix from tag name
32-
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
33-
34-
docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 \
35-
--push \
36-
-t ghcr.io/${{ github.repository }}:${VERSION} \
37-
.
14+
- name: Check out the repository
15+
uses: actions/checkout@v3
16+
17+
- name: Login to GitHub Container Registry
18+
uses: docker/login-action@v2
19+
with:
20+
registry: ghcr.io
21+
username: ${{ github.actor }}
22+
password: ${{ secrets.GITHUB_TOKEN }}
23+
24+
- name: Calculate metadata for image
25+
id: image-meta
26+
uses: docker/metadata-action@v4
27+
with:
28+
images: ghcr.io/stackhpc/radosgw_usage_exporter
29+
# Produce the branch name or tag and the SHA as tags
30+
tags: |
31+
type=ref,event=branch
32+
type=ref,event=tag
33+
type=sha,prefix=
34+
35+
- name: Build and push image
36+
uses: stackhpc/github-actions/docker-multiarch-build-push@master
37+
with:
38+
cache-key: radosgw_usage_exporter
39+
context: .
40+
platforms: linux/amd64,linux/arm64
41+
push: true
42+
tags: ${{ steps.image-meta.outputs.tags }}
43+
labels: ${{ steps.image-meta.outputs.labels }}

0 commit comments

Comments
 (0)