Skip to content

Commit 77a946e

Browse files
authored
Merge pull request #647 from vvoland/gha-binimg
Add GHA workflow to build image
2 parents e92857f + d78ded9 commit 77a946e

File tree

3 files changed

+62
-3
lines changed

3 files changed

+62
-3
lines changed

.github/workflows/bin-image.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: bin-image
2+
3+
# Default to 'contents: read', which grants actions to read commits.
4+
#
5+
# If any permission is set, any permission not included in the list is
6+
# implicitly set to "none".
7+
#
8+
# see https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions
9+
permissions:
10+
contents: read
11+
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.ref }}
14+
cancel-in-progress: true
15+
16+
on:
17+
workflow_dispatch:
18+
push:
19+
branches:
20+
- 'master'
21+
tags:
22+
- 'v*'
23+
pull_request:
24+
25+
env:
26+
REPO_SLUG: moby/vpnkit-bin
27+
jobs:
28+
build:
29+
uses: crazy-max/.github/.github/workflows/bake-distribute-mp.yml@d9a10e2737504a6e253f96e344cef684b0e00cb5
30+
with:
31+
target: bin-image
32+
push: ${{ github.event_name != 'pull_request' && github.repository == 'moby/vpnkit' }}
33+
cache: false # See: https://github.com/moby/vpnkit/pull/647/files/3d4f258e7514b9cc878639f724cbb0caffa8fd98#r2032880337
34+
meta-image: moby/vpnkit
35+
meta-tags: |
36+
type=semver,pattern={{version}}
37+
type=ref,event=branch
38+
type=ref,event=pr
39+
type=sha
40+
secrets:
41+
login-username: ${{ secrets.DOCKERHUB_USERNAME }}
42+
login-password: ${{ secrets.DOCKERHUB_TOKEN }}

Dockerfile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1-
FROM ocaml/opam:alpine-3.15-ocaml-4.14 as build
1+
FROM ocaml/opam:alpine-3.19-ocaml-4.14 AS build
22
RUN opam update
33

44
ADD . /home/opam/vpnkit
5-
RUN opam pin add vpnkit /home/opam/vpnkit -n
5+
RUN opam pin add vpnkit /home/opam/vpnkit --kind=path -n
66
RUN opam depext vpnkit -y
77

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: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
group "default" {
2+
targets = ["bin-image"]
3+
}
4+
5+
target "docker-metadata-action" {}
6+
7+
target "bin-image" {
8+
target = "binary"
9+
output = ["type=image"]
10+
platforms = [
11+
"linux/amd64",
12+
"linux/arm64",
13+
]
14+
}

0 commit comments

Comments
 (0)