-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
34 lines (25 loc) · 944 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# syntax=docker.io/docker/dockerfile:1
##################################################
## "build" stage
##################################################
FROM --platform=${BUILDPLATFORM:-linux/amd64} docker.io/golang:1.23.2-bookworm@sha256:18d2f940cc20497f85466fdbe6c3d7a52ed2db1d5a1a49a4508ffeee2dff1463 AS build
ARG TARGETOS
ARG TARGETARCH
ARG TARGETVARIANT
WORKDIR /src/
COPY ./go.mod ./go.sum ./
RUN go mod download
COPY ./ ./
RUN make test
RUN make build \
GOOS="${TARGETOS-}" \
GOARCH="${TARGETARCH-}" \
GOARM="$([ "${TARGETARCH-}" != 'arm' ] || printf '%s' "${TARGETVARIANT#v}")"
RUN test -z "$(readelf -x .interp ./dist/cetusguard-* 2>/dev/null)"
##################################################
## "main" stage
##################################################
FROM scratch AS main
COPY --from=build /src/dist/cetusguard-* /bin/cetusguard
ENV CETUSGUARD_FRONTEND_ADDR='tcp://:2375'
ENTRYPOINT ["/bin/cetusguard"]