Skip to content

Commit 8c89c2f

Browse files
committed
Updating build-images to use docker metadata action for tagging
1 parent 58f4598 commit 8c89c2f

File tree

1 file changed

+21
-5
lines changed

1 file changed

+21
-5
lines changed

.github/workflows/build-images.yml

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,26 @@ jobs:
3333
username: ${{ github.actor }}
3434
password: ${{ secrets.GITHUB_TOKEN }}
3535

36+
- name: Docker meta
37+
id: meta
38+
uses: docker/metadata-action@v5
39+
with:
40+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/bluesky
41+
tags: |
42+
type=ref,event=branch
43+
type=ref,event=pr
44+
type=semver,pattern={{version}}
45+
type=semver,pattern={{major}}.{{minor}}
46+
type=sha
47+
3648
- name: Build and push bluesky image
3749
uses: docker/build-push-action@v5
3850
with:
3951
context: .
4052
file: ./images/bluesky/Containerfile
4153
push: true
42-
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/bluesky:latest
54+
tags: ${{ steps.meta.outputs.tags }}
55+
labels: ${{ steps.meta.outputs.labels }}
4356
cache-from: type=gha
4457
cache-to: type=gha,mode=max
4558

@@ -49,7 +62,8 @@ jobs:
4962
context: .
5063
file: ./images/nbs/Containerfile
5164
push: true
52-
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/nbs:latest
65+
tags: ${{ steps.meta.outputs.tags }}
66+
labels: ${{ steps.meta.outputs.labels }}
5367
build-args: |
5468
BASE_IMAGE=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/bluesky:latest
5569
cache-from: type=gha
@@ -61,19 +75,21 @@ jobs:
6175
context: .
6276
file: ./images/gui/Containerfile
6377
push: true
64-
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/nbs-gui:latest
78+
tags: ${{ steps.meta.outputs.tags }}
79+
labels: ${{ steps.meta.outputs.labels }}
6580
build-args: |
6681
BASE_IMAGE=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/nbs:latest
6782
cache-from: type=gha
68-
cache-to: type=gha,mode=max
83+
cache-to: type=gha,mode=max
6984

7085
- name: Build and push nbs-viewer image
7186
uses: docker/build-push-action@v5
7287
with:
7388
context: .
7489
file: ./images/viewer/Containerfile
7590
push: true
76-
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/nbs-viewer:latest
91+
tags: ${{ steps.meta.outputs.tags }}
92+
labels: ${{ steps.meta.outputs.labels }}
7793
build-args: |
7894
BASE_IMAGE=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/nbs:latest
7995
cache-from: type=gha

0 commit comments

Comments
 (0)