Skip to content

Commit dcfd791

Browse files
authored
Merge pull request #679 from crazy-max/github-builder
ci: switch to docker github builder to build bin image
2 parents 8c431d2 + b421554 commit dcfd791

3 files changed

Lines changed: 20 additions & 8 deletions

File tree

.github/workflows/bin-image.yml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,27 @@ on:
2222
- 'v*'
2323
pull_request:
2424

25-
env:
26-
REPO_SLUG: moby/vpnkit-bin
2725
jobs:
2826
build:
29-
uses: crazy-max/.github/.github/workflows/bake-distribute-mp.yml@d9a10e2737504a6e253f96e344cef684b0e00cb5
27+
uses: docker/github-builder/.github/workflows/bake.yml@70ac3fc303efa83d2b94905e6ab78bb83cbdc2ae # v1.11.0
28+
permissions:
29+
contents: read # same as global permission
30+
id-token: write # for signing attestation(s) with GitHub OIDC Token
3031
with:
32+
setup-qemu: true
3133
target: bin-image
32-
push: ${{ github.event_name != 'pull_request' && github.repository == 'moby/vpnkit' }}
3334
cache: false # See: https://github.com/moby/vpnkit/pull/647/files/3d4f258e7514b9cc878639f724cbb0caffa8fd98#r2032880337
34-
meta-image: moby/vpnkit-bin
35+
output: image
36+
push: ${{ github.event_name != 'pull_request' && github.repository == 'moby/vpnkit' }}
37+
meta-images: |
38+
moby/vpnkit-bin
3539
meta-tags: |
3640
type=semver,pattern={{version}}
3741
type=ref,event=branch
3842
type=ref,event=pr
3943
type=sha
4044
secrets:
41-
login-username: ${{ secrets.DOCKERHUB_USERNAME }}
42-
login-password: ${{ secrets.DOCKERHUB_TOKEN }}
45+
registry-auths: |
46+
- registry: docker.io
47+
username: ${{ secrets.DOCKERHUB_USERNAME }}
48+
password: ${{ secrets.DOCKERHUB_TOKEN }}

Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,8 @@ ADD . /home/opam/vpnkit
77
RUN opam pin add vpnkit /home/opam/vpnkit --kind=path -n
88
RUN opam install vpnkit -y
99

10-
FROM alpine:latest
10+
FROM scratch AS binary
1111
COPY --from=build /home/opam/.opam/4.14/bin/vpnkit /vpnkit
12+
13+
FROM alpine:latest
14+
COPY --from=binary /vpnkit /vpnkit

docker-bake.hcl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ target "docker-metadata-action" {}
66

77
target "bin-image" {
88
target = "binary"
9+
args = {
10+
BUILDKIT_CONTEXT_KEEP_GIT_DIR = 1
11+
}
912
output = ["type=image"]
1013
platforms = [
1114
"linux/amd64",

0 commit comments

Comments
 (0)