1- # .github/workflows/docker-compose-ci.yml
21name : Build & Push (Compose/Bake)
32
43on :
54 push :
65 branches : [ "main", "master" ]
7- # enable when you want release builds from tags
8- # push:
9- # tags: [ "v*" ]
106
117jobs :
128 build :
139 runs-on : ubuntu-latest
1410
11+ env :
12+ # Your Docker Hub namespace (must be lowercase)
13+ DOCKERHUB_NS : ${{ secrets.DOCKERHUB_USERNAME }}
14+
1515 steps :
1616 - name : Checkout
1717 uses : actions/checkout@v4
@@ -34,20 +34,31 @@ jobs:
3434 username : ${{ github.actor }}
3535 password : ${{ secrets.GITHUB_TOKEN }}
3636
37- # Optional: quick sanity check that compose is at repo root
38- - name : Show tree
37+ - name : Compute short SHA
38+ id : sha
39+ run : echo "short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
40+
41+ - name : Ensure compose files exist
3942 run : |
40- pwd
41- ls -la
42- test -f docker-compose.yml && echo "compose found" || (echo "compose missing" && exit 1)
43+ test -f docker-compose.yml || (echo "missing docker-compose.yml" && exit 1)
44+ test -f docker-compose.ci.override.yml || (echo "missing docker-compose.ci.override.yml" && exit 1)
4345
44- - name : Build & Push with Bake (compose)
45- uses : docker/bake-action@v4
46+ - name : Build & Push with Bake (compose + override )
47+ uses : docker/bake-action@v5
4648 with :
4749 files : |
4850 docker-compose.yml
51+ docker-compose.ci.override.yml
4952 push : true
50- # You can override or add tags/labels per-target with `set:` if needed
51- # set: |
52- # *.labels=org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}
53- # *.tags=ghcr.io/hasanjaved-developer/centralized-logging/{{.target}}:edge
53+ # Add extra tags for GHCR (sha) and Docker Hub (edge + sha)
54+ set : |
55+ *.labels=org.opencontainers.image.revision=${{ github.sha }}
56+ usermanagementapi.tags=${{ env.DOCKERHUB_NS }}/centralized-logging/usermanagementapi:edge
57+ usermanagementapi.tags=${{ env.DOCKERHUB_NS }}/centralized-logging/usermanagementapi:${{ steps.sha.outputs.short }}
58+ centralizedloggingapi.tags=${{ env.DOCKERHUB_NS }}/centralized-logging/loggingapi:edge
59+ centralizedloggingapi.tags=${{ env.DOCKERHUB_NS }}/centralized-logging/loggingapi:${{ steps.sha.outputs.short }}
60+ apiintegrationmvc.tags=${{ env.DOCKERHUB_NS }}/centralized-logging/integrationportal:edge
61+ apiintegrationmvc.tags=${{ env.DOCKERHUB_NS }}/centralized-logging/integrationportal:${{ steps.sha.outputs.short }}
62+ env :
63+ # Primary tag selected in the override (GHCR)
64+ TAG : edge
0 commit comments