Skip to content

Commit 25d950b

Browse files
authored
Merge pull request #780 from doerfli/feature/docker-build
fix(docker): refactor Docker workflow to use updated actions and improve build process
2 parents b90609a + 7201845 commit 25d950b

File tree

1 file changed

+32
-6
lines changed

1 file changed

+32
-6
lines changed

.github/workflows/docker.yml

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,44 @@ on:
44
push:
55
branches: [ main ]
66
tags:
7-
- '*'
7+
- '*'
88
pull_request:
99
branches:
10-
- main
10+
- main
1111

1212
jobs:
1313
docker:
1414
if: github.actor != 'dependabot[bot]'
1515
runs-on: ubuntu-latest
16+
permissions:
17+
contents: read
18+
packages: write
1619
steps:
1720
- uses: actions/checkout@v6
18-
- run: echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u doerfli --password-stdin
19-
- uses: rlespinasse/github-slug-action@v2.x
20-
- run: docker build -f Dockerfile -t ghcr.io/doerfli/reeper/reeper:${{ env.GITHUB_REF_SLUG }} .
21-
- run: docker push ghcr.io/doerfli/reeper/reeper:${{ env.GITHUB_REF_SLUG }}
21+
22+
- uses: docker/setup-buildx-action@v3
23+
24+
- uses: docker/login-action@v3
25+
with:
26+
registry: ghcr.io
27+
username: ${{ github.actor }}
28+
password: ${{ secrets.GITHUB_TOKEN }}
29+
30+
- uses: docker/metadata-action@v5
31+
id: meta
32+
with:
33+
images: ghcr.io/doerfli/reeper/reeper
34+
tags: |
35+
type=ref,event=branch
36+
type=ref,event=pr
37+
type=ref,event=tag
38+
type=sha,prefix=
39+
40+
- uses: docker/build-push-action@v6
41+
with:
42+
context: .
43+
file: ./Dockerfile
44+
push: true
45+
tags: ${{ steps.meta.outputs.tags }}
46+
labels: ${{ steps.meta.outputs.labels }}
47+

0 commit comments

Comments
 (0)