File tree Expand file tree Collapse file tree 2 files changed +12
-30
lines changed Expand file tree Collapse file tree 2 files changed +12
-30
lines changed Original file line number Diff line number Diff line change @@ -27,39 +27,28 @@ jobs:
27
27
uses : actions/checkout@v4
28
28
29
29
- name : Log in to the Container registry
30
- uses : docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0
30
+ uses : docker/login-action@v3
31
31
with :
32
32
registry : ${{ env.REGISTRY }}
33
33
username : ${{ github.actor }}
34
34
password : ${{ secrets.GITHUB_TOKEN }}
35
35
36
36
- name : Set up Docker Buildx
37
- uses : docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0
37
+ uses : docker/setup-buildx-action@v3
38
38
39
39
- name : Extract metadata (tags, labels) for Docker
40
40
id : meta
41
- uses : docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.1.1
41
+ uses : docker/metadata-action@v5
42
42
with :
43
43
images : " ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}"
44
44
45
45
- name : AMD - Build and push Docker image
46
- uses : docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # v5.3.0
46
+ uses : docker/build-push-action@v5
47
47
with :
48
48
context : .
49
49
push : true
50
- build-args : |
51
- TARGETOS=linux
52
- TARGETARCH=amd64
53
- tags : ${{ steps.meta.outputs.tags }}
54
- labels : ${{ steps.meta.outputs.labels }}
55
-
56
- - name : ARM - Build and push Docker image
57
- uses : docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # v5.3.0
58
- with :
59
- context : .
60
- push : true
61
- build-args : |
62
- TARGETOS=linux
63
- TARGETARCH=arm64
50
+ platforms : |
51
+ linux/amd64
52
+ linux/arm64
64
53
tags : ${{ steps.meta.outputs.tags }}
65
54
labels : ${{ steps.meta.outputs.labels }}
Original file line number Diff line number Diff line change 1
1
FROM --platform=$BUILDPLATFORM golang:1.22-alpine3.19 as builder
2
-
3
- RUN apk update && \
4
- apk add bash jq alpine-sdk sed gawk git ca-certificates curl && \
5
- apk add --no-cache gcc musl-dev
6
-
2
+ # Define target arch variables so we can use them while crosscompiling, will be set automatically
3
+ ARG TARGETOS
4
+ ARG TARGETARCH
7
5
WORKDIR /go/src/
8
6
9
7
# get dependencies
@@ -14,17 +12,12 @@ RUN go mod download
14
12
COPY . .
15
13
16
14
# Build project
17
- ARG TARGETOS=linux
18
- ARG TARGETARCH=amd64
19
- RUN GOOS=$TARGETOS GOARCH=$TARGETARCH CGO_ENABLED=0 go build -ldflags "-s -w" -a -installsuffix cgo -o /radix-oauth-guard
15
+ RUN GOOS=$TARGETOS GOARCH=$TARGETARCH CGO_ENABLED=0 go build -ldflags "-s -w" -a -installsuffix cgo -o /radix-oauth-guard
20
16
21
- RUN addgroup -S -g 1000 guard
22
- RUN adduser -S -u 1000 -G guard guard
23
17
24
- FROM --platform=$TARGETOS/$TARGETARCH scratch
18
+ FROM --platform=$TARGETPLATFORM scratch
25
19
26
20
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
27
- COPY --from=builder /etc/passwd /etc/passwd
28
21
COPY --from=builder /radix-oauth-guard /radix-oauth-guard
29
22
30
23
EXPOSE 8000
You can’t perform that action at this time.
0 commit comments