64
64
restore-keys : |
65
65
${{ runner.os }}-buildx-
66
66
67
+ - name : Install Cosign
68
+ uses : sigstore/cosign-installer@v3
69
+
67
70
- name : Login Docker Hub
68
71
uses : docker/login-action@v3.3.0
69
72
with :
76
79
with :
77
80
registry : ghcr.io
78
81
username : ${{ github.repository_owner }}
79
- password : ${{ secrets.GITHUB_TOKEN }}
82
+
83
+ - name : Verify base image
84
+ run : |
85
+ cosign dockerfile verify --base-image-only --key https://github.com/GoogleContainerTools/distroless build/images/${{ matrix.module }}/Dockerfile
80
86
81
87
- name : Push to Registry
82
88
uses : docker/build-push-action@v6.7.0
85
91
platforms : ${{ matrix.platforms }}
86
92
file : build/images/${{ matrix.module }}/Dockerfile
87
93
labels : |-
94
+ org.opencontainers.image.title=${{ github.event.repository.name }}
95
+ org.opencontainers.image.description=${{ github.event.repository.description }}
96
+ org.opencontainers.image.url=${{ github.event.repository.html_url }}
88
97
org.opencontainers.image.source=https://github.com/${{ github.repository }}
89
98
org.opencontainers.image.revision=${{ github.sha }}
99
+ org.opencontainers.image.version=${{ steps.get_version.outputs.VERSION }}
90
100
build-args : |
91
101
GITVERSION=git-${{ steps.vars.outputs.git_revision }}
92
102
VERSION=${{ steps.get_version.outputs.VERSION }}
@@ -97,6 +107,31 @@ jobs:
97
107
cache-from : type=local,src=/tmp/.buildx-cache
98
108
cache-to : type=local,dest=/tmp/.buildx-cache-new
99
109
110
+ - name : Sign container image
111
+ run : |
112
+ cosign sign --key env://COSIGN_KEY dragonflyoss/${{ matrix.module }}:${{ steps.get_version.outputs.VERSION }}
113
+ cosign sign --key env://COSIGN_KEY ghcr.io/${{ env.IMAGE_REPOSITORY }}/${{ matrix.module }}:${{ steps.get_version.outputs.VERSION }}
114
+ env :
115
+ COSIGN_KEY : ${{secrets.COSIGN_KEY}}
116
+ COSIGN_PASSWORD : ${{secrets.COSIGN_PASSWORD}}
117
+
118
+ - name : Check images
119
+ run : |
120
+ docker buildx imagetools inspect dragonflyoss/${{ matrix.module }}:${{ steps.get_version.outputs.VERSION }}
121
+ docker pull dragonflyoss/${{ matrix.module }}:${{ steps.get_version.outputs.VERSION }}
122
+ cosign verify --key cosign.pub dragonflyoss/${{ matrix.module }}:${{ steps.get_version.outputs.VERSION }}
123
+ docker buildx imagetools inspect ghcr.io/${{ env.IMAGE_REPOSITORY }}/${{ matrix.module }}:${{ steps.get_version.outputs.VERSION }}
124
+ docker pull ghcr.io/${{ env.IMAGE_REPOSITORY }}/${{ matrix.module }}:${{ steps.get_version.outputs.VERSION }}
125
+ cosign verify --key cosign.pub ghcr.io/${{ env.IMAGE_REPOSITORY }}/${{ matrix.module }}:${{ steps.get_version.outputs.VERSION }}
126
+
127
+ - uses : anchore/sbom-action@v0
128
+ with :
129
+ image : dragonflyoss/${{ matrix.module }}:${{ steps.get_version.outputs.VERSION }}
130
+
131
+ - uses : anchore/sbom-action@v0
132
+ with :
133
+ image : ghcr.io/${{ env.IMAGE_REPOSITORY }}/${{ matrix.module }}:${{ steps.get_version.outputs.VERSION }}
134
+
100
135
- name : Move cache
101
136
run : |
102
137
rm -rf /tmp/.buildx-cache
0 commit comments