1- name : Build and Push Docker Image
1+ # .github/workflows/docker-compose-ci.yml
2+ name : Build & Push (Compose/Bake)
23
34on :
45 push :
56 branches : [ "main", "master" ]
7+ # enable when you want release builds from tags
8+ # push:
9+ # tags: [ "v*" ]
610
711jobs :
812 build :
913 runs-on : ubuntu-latest
10- strategy :
11- matrix :
12- service :
13- - name : usermanagementapi
14- context : .
15- dockerfile : UserManagementApi/Dockerfile
16- - name : loggingapi
17- context : .
18- dockerfile : CentralizedLoggingApi/Dockerfile
19- - name : integrationportal
20- context : .
21- dockerfile : ApiIntegrationMvc/Dockerfile
22-
14+
2315 steps :
24- - name : Checkout code
16+ - name : Checkout
2517 uses : actions/checkout@v4
18+ with :
19+ fetch-depth : 0
2620
27- - name : Set up Docker Buildx
21+ - name : Setup Docker Buildx
2822 uses : docker/setup-buildx-action@v3
2923
3024 - name : Login to Docker Hub
@@ -40,10 +34,20 @@ jobs:
4034 username : ${{ github.actor }}
4135 password : ${{ secrets.GITHUB_TOKEN }}
4236
43- - name : Build and push images
44- uses : docker/build-push-action@v6
37+ # Optional: quick sanity check that compose is at repo root
38+ - name : Show tree
39+ run : |
40+ pwd
41+ ls -la
42+ test -f docker-compose.yml && echo "compose found" || (echo "compose missing" && exit 1)
43+
44+ - name : Build & Push with Bake (compose)
45+ uses : docker/bake-action@v4
4546 with :
47+ files : |
48+ docker-compose.yml
4649 push : true
47- tags : |
48- ${{ secrets.DOCKERHUB_USERNAME }}/centralized-logging:latest
49- ghcr.io/hasanjaved-developer/centralized-logging:latest
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
0 commit comments