-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
43 lines (32 loc) · 933 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
35
36
37
38
39
40
41
42
43
# syntax = docker/dockerfile:1.3
FROM --platform=$BUILDPLATFORM golang:1.20-alpine AS builder
ARG REPOSITORY=Lirt
ARG PLUGIN=k8s-secret-replicator
ARG PKG=github.com/Lirt/k8s-secret-replicator
ARG VERSION=0.0.0
ARG GIT_SHA=nil
ARG TARGETOS
ARG TARGETARCH
ARG TARGETVARIANT
ARG GOOS=linux
ARG GOARCH=amd64
ENV GOOS=${TARGETOS}
ENV GOARCH=${TARGETARCH}
ENV GOARM=${TARGETVARIANT}
ENV GOPROXY=https://proxy.golang.org
WORKDIR /build
COPY . .
RUN \
export GOARM=$( echo "${GOARM}" | cut -c2-) && \
CGO_ENABLED=0 \
go build \
-ldflags "-s -w" \
-o bin/k8s-secret-replicator \
.
# Use distroless as minimal base image to package the k8s-secret-replicator binary
# Refer to https://github.com/GoogleContainerTools/distroless for more details
FROM gcr.io/distroless/static:nonroot
WORKDIR /
COPY --from=builder /build/bin/k8s-secret-replicator ./k8s-secret-replicator
USER 65532
ENTRYPOINT [ "/k8s-secret-replicator" ]