@@ -16,18 +16,30 @@ jobs:
1616 image :
1717 runs-on : ubuntu-latest
1818 steps :
19- - uses : actions/checkout@v3
20- - uses : actions/setup-go@v3
19+ - uses : actions/checkout@v4
20+ - uses : actions/setup-go@v5
2121 with :
2222 go-version : v1.24.0
2323 check-latest : true
24+
25+ - name : Set up Node.js
26+ uses : actions/setup-node@v4
27+ with :
28+ node-version : ' 20'
29+ cache : ' npm'
30+ cache-dependency-path : web/package-lock.json
31+
2432 # We need this to remove local tags that are not semver so goreleaser doesn't get confused.
2533 - name : Delete non-semver tags
2634 run : ' git tag -d $(git tag -l | grep -v "^v")'
35+
36+ # Set up Docker Buildx for multi-platform builds
37+ - name : Set up Docker Buildx
38+ uses : docker/setup-buildx-action@v3
39+
2740 # If you notice signing errors, you may need to update the cosign version.
2841 - uses : sigstore/cosign-installer@v3.7.0
29- - name : Install ko
30- run : go install github.com/google/ko@latest
42+
3143
3244 - name : Install Helm
3345 uses : azure/setup-helm@v3
@@ -37,31 +49,83 @@ jobs:
3749 - name : Set LDFLAGS
3850 run : echo LDFLAGS="$(make ldflags)" | tee -a >> $GITHUB_ENV
3951
40- # Build ko from HEAD, build and push an image tagged with the commit SHA,
41- # then keylessly sign it with cosign.
42- - name : Publish and sign konnector image
52+ # Login to GitHub Container Registry (used by both ko and Docker)
53+ - name : Login to GitHub Container Registry
54+ uses : docker/login-action@v3
55+ with :
56+ registry : ghcr.io
57+ username : ${{ github.actor }}
58+ password : ${{ secrets.GITHUB_TOKEN }}
59+
60+ # Build and push konnector image using Dockerfile.konnector
61+ - name : Build and push konnector image
62+ uses : docker/build-push-action@v6
63+ id : build-konnector
64+ with :
65+ context : .
66+ file : ./Dockerfile.konnector
67+ platforms : linux/amd64,linux/arm64
68+ push : true
69+ tags : |
70+ ghcr.io/${{ github.repository_owner }}/konnector:latest
71+ ghcr.io/${{ github.repository_owner }}/konnector:${{ github.sha }}
72+ ghcr.io/${{ github.repository_owner }}/konnector:${{ github.ref_name }}
73+ cache-from : type=gha
74+ cache-to : type=gha,mode=max
75+ build-args : |
76+ LDFLAGS=${{ env.LDFLAGS }}
77+ labels : |
78+ org.opencontainers.image.title=Kube Bind Konnector
79+ org.opencontainers.image.description=Kube Bind konnector component
80+ org.opencontainers.image.source=https://github.com/${{ github.repository }}
81+ org.opencontainers.image.revision=${{ github.sha }}
82+ org.opencontainers.image.version=${{ github.ref_name }}
83+
84+ # Sign the konnector image
85+ - name : Sign konnector image
4386 env :
44- KO_DOCKER_REPO : ghcr.io/${{ github.repository_owner }}/konnector
4587 COSIGN_EXPERIMENTAL : ' true'
4688 run : |
47- echo "${{ github.token }}" | ko login ghcr.io --username "${{ github.actor }}" --password-stdin
48- img=$(ko build --bare --platform=all -t latest -t ${{ github.sha }} -t ${{github.ref_name}} ./cmd/konnector)
49- echo "built ${img}"
89+ img="ghcr.io/${{ github.repository_owner }}/konnector@${{ steps.build-konnector.outputs.digest }}"
90+ echo "signing ${img}"
5091 cosign sign ${img} \
5192 --yes \
5293 -a sha=${{ github.sha }} \
5394 -a ref=${{ github.ref }} \
5495 -a run_id=${{ github.run_id }} \
5596 -a run_attempt=${{ github.run_attempt }}
5697
57- - name : Publish and sign backend image
98+ # Build and push backend image using Dockerfile (includes frontend)
99+ - name : Build and push backend image
100+ uses : docker/build-push-action@v6
101+ id : build
102+ with :
103+ context : .
104+ file : ./Dockerfile
105+ platforms : linux/amd64,linux/arm64
106+ push : true
107+ tags : |
108+ ghcr.io/${{ github.repository_owner }}/backend:latest
109+ ghcr.io/${{ github.repository_owner }}/backend:${{ github.sha }}
110+ ghcr.io/${{ github.repository_owner }}/backend:${{ github.ref_name }}
111+ cache-from : type=gha
112+ cache-to : type=gha,mode=max
113+ build-args : |
114+ LDFLAGS=${{ env.LDFLAGS }}
115+ labels : |
116+ org.opencontainers.image.title=Kube Bind Backend
117+ org.opencontainers.image.description=Kube Bind backend with integrated Vue.js frontend
118+ org.opencontainers.image.source=https://github.com/${{ github.repository }}
119+ org.opencontainers.image.revision=${{ github.sha }}
120+ org.opencontainers.image.version=${{ github.ref_name }}
121+
122+ # Sign the backend image
123+ - name : Sign backend image
58124 env :
59- KO_DOCKER_REPO : ghcr.io/${{ github.repository_owner }}/backend
60125 COSIGN_EXPERIMENTAL : ' true'
61126 run : |
62- echo "${{ github.token }}" | ko login ghcr.io --username "${{ github.actor }}" --password-stdin
63- img=$(ko build --bare --platform=all -t latest -t ${{ github.sha }} -t ${{github.ref_name}} ./cmd/backend)
64- echo "built ${img}"
127+ img="ghcr.io/${{ github.repository_owner }}/backend@${{ steps.build.outputs.digest }}"
128+ echo "signing ${img}"
65129 cosign sign ${img} \
66130 --yes \
67131 -a sha=${{ github.sha }} \
0 commit comments