Skip to content

Commit e125ffa

Browse files
authored
Merge pull request #1 from ConsortiumGARR/gh
feat: build docker image via github actions
2 parents 3589c5a + f3a31b3 commit e125ffa

1 file changed

Lines changed: 58 additions & 0 deletions

File tree

.github/workflows/docker-image.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Docker Image CI
2+
3+
on:
4+
push:
5+
tags:
6+
- "[0-9]+.[0-9]+.[0-9]+"
7+
workflow_dispatch:
8+
inputs:
9+
tag:
10+
description: "Version tag to use for the Docker image"
11+
required: true
12+
13+
jobs:
14+
build-and-push:
15+
runs-on: ubuntu-latest
16+
17+
permissions:
18+
contents: read
19+
packages: write
20+
21+
steps:
22+
- name: Checkout code
23+
uses: actions/checkout@v6
24+
25+
- name: Log in to GitHub Packages
26+
uses: docker/login-action@v4
27+
with:
28+
registry: ghcr.io
29+
username: ${{ github.actor }}
30+
password: ${{ secrets.GITHUB_TOKEN }}
31+
32+
- name: Set up QEMU
33+
uses: docker/setup-qemu-action@v4
34+
35+
- name: Set up Docker Buildx
36+
uses: docker/setup-buildx-action@v4
37+
38+
- name: Lower case docker image name
39+
id: docker_image
40+
uses: ASzc/change-string-case-action@v8
41+
with:
42+
string: ${{ github.repository }}
43+
44+
- name: Build and push latest
45+
uses: docker/build-push-action@v7
46+
with:
47+
context: .
48+
push: true
49+
platforms: linux/amd64,linux/arm64
50+
tags: ghcr.io/${{ steps.docker_image.outputs.lowercase }}:latest
51+
52+
- name: Build and push version tag
53+
uses: docker/build-push-action@v7
54+
with:
55+
context: .
56+
push: true
57+
platforms: linux/amd64,linux/arm64
58+
tags: ghcr.io/${{ steps.docker_image.outputs.lowercase }}:${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref_name }}

0 commit comments

Comments
 (0)