Skip to content

Commit 4910ce5

Browse files
committed
fix: update registry
1 parent 6611a56 commit 4910ce5

2 files changed

Lines changed: 17 additions & 16 deletions

File tree

.github/workflows/ci-cd.yaml

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,23 +35,21 @@ jobs:
3535
username: ${{ github.actor }}
3636
password: ${{ secrets.GITHUB_TOKEN }}
3737

38-
- name: Extract version from tag or fallback
39-
id: version
40-
run: |
41-
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
42-
echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
43-
else
44-
echo "TAG=0.0.1" >> $GITHUB_OUTPUT
45-
fi
38+
- name: Extract metadata
39+
id: meta
40+
uses: docker/metadata-action@v5
41+
with:
42+
images: ${{ env.IMAGE_NAME }}
4643

4744
- name: Docker Bake (build and push)
4845
uses: docker/bake-action@v6
4946
with:
5047
push: true
5148
files: |
5249
./docker-bake.hcl
50+
cwd://${{ steps.meta.outputs.bake-file-tags }}
51+
cwd://${{ steps.meta.outputs.bake-file-annotations }}
52+
targets: prod
5353
set: |
54-
*.labels.org.opencontainers.image.revision=${{ github.sha }}
5554
*.cache-from=type=gha
56-
*.cache-to=type=gha,mode=max
57-
*.args.TAG=${{ steps.version.outputs.TAG }}
55+
*.cache-to=type=gha,mode=max

docker-bake.hcl

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
variable "TAG" {
2-
default = "0.0.1"
2+
default = "latest"
3+
}
4+
5+
variable "registry" {
6+
default = "ghcr.io/nmdra"
37
}
48

59
group "default" {
@@ -10,8 +14,8 @@ target "dev" {
1014
dockerfile = "Dockerfile.dev"
1115
context = "."
1216
tags = [
13-
"nimendra/fastapi-demo:dev",
14-
"nimendra/fastapi-demo:${TAG}-dev"
17+
"${registry}/fastapi-demo:dev",
18+
"${registry}/fastapi-demo:${TAG}-dev"
1519
]
1620
args = {
1721
ENV = "development"
@@ -22,8 +26,7 @@ target "prod" {
2226
dockerfile = "Dockerfile.prod"
2327
context = "."
2428
tags = [
25-
"nimendra/fastapi-demo:0.0.1",
26-
"nimendra/fastapi-demo:${TAG}"
29+
"${registry}/fastapi-demo:${TAG}"
2730
]
2831
args = {
2932
ENV = "production"

0 commit comments

Comments
 (0)