-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
30 lines (20 loc) · 965 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
FROM --platform=$BUILDPLATFORM golang:1.23-alpine as builder
# Install our build tools
RUN apk add --update ca-certificates
WORKDIR /app
ARG DEBUG
ARG TARGETOS
ARG TARGETARCH
ENV LDFLAGS "-X 'main.VERSION=${RELEASE_VERSION}' "
COPY . ./
RUN if [ DEBUG -eq 1 ]; then export DEBUGFLAGS='-gcflags=all="-N -l"'; fi && \
CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go build $DEBUGFLAGS -o bin/vault-autounseal github.com/camaeel/vault-autounseal-operator/cmd/vault-autounseal-operator
FROM golang:1.23-alpine as debug
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder /app/bin/vault-autounseal-operator /vault-autounseal-operator
RUN go install github.com/go-delve/delve/cmd/dlv@latest
ENTRYPOINT ["dlv"]
FROM scratch
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder /app/bin/vault-autounseal-operator /vault-autounseal-operator
ENTRYPOINT ["/vault-autounseal-operator"]