Skip to content

Commit 1c276b0

Browse files
ci(docker): improve handling of docker tags
Tag images in a better way by assigning an SHA hash for each build that is made for a branch. This is safer as it would not produce a problem of always relying upon the branch name of `main` and not knowing which commit this `main` refers to. Also the concrete versions of different steps in the pipeline are now being used instead of using long SHA hashes.
1 parent fe88a30 commit 1c276b0

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

.github/workflows/docker.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,24 @@ jobs:
2222
uses: actions/checkout@v3
2323

2424
- name: Log in to the Container registry
25-
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
25+
uses: docker/login-action@v2
2626
with:
2727
registry: ${{ env.REGISTRY }}
2828
username: ${{ github.actor }}
2929
password: ${{ secrets.GITHUB_TOKEN }}
3030

3131
- name: Extract metadata (tags, labels) for Docker
3232
id: meta
33-
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
33+
uses: docker/metadata-action@v4
3434
with:
3535
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
3636
tags: |
37-
type=ref,event=branch
37+
type=sha,format=short,event=branch
3838
type=ref,event=pr
3939
type=semver,pattern={{version}}
4040
4141
- name: Build and push Docker image
42-
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
42+
uses: docker/build-push-action@v3
4343
with:
4444
context: .
4545
push: true

0 commit comments

Comments
 (0)