Skip to content

Commit da0507c

Browse files
committed
Add GitHub Actions workflow for building and publishing Docker image
1 parent 7235c9a commit da0507c

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Create a Docker image from the software and publish it
2+
3+
on:
4+
push:
5+
branches: ['main']
6+
7+
env:
8+
REGISTRY: ghcr.io
9+
IMAGE_NAME: ${{ github.repository }}
10+
11+
jobs:
12+
build-and-push-image:
13+
runs-on: ubuntu-latest
14+
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
15+
permissions:
16+
contents: read
17+
packages: write
18+
id-token: write
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@v4
22+
- name: Log in to the Container registry
23+
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
24+
with:
25+
registry: ${{ env.REGISTRY }}
26+
username: ${{ github.actor }}
27+
password: ${{ secrets.GITHUB_TOKEN }}
28+
- name: Build and push Docker image
29+
id: push
30+
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
31+
with:
32+
context: "{{defaultContext}}:software"
33+
push: true
34+
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest

0 commit comments

Comments
 (0)