1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-06 16:06:56 +00:00
kyverno/cmd/initContainer/Dockerfile
shuting 0ee045be4f
update Golang base image to 1.17.2 (#2596)
Signed-off-by: ShutingZhao <shutting06@gmail.com>
2021-10-25 21:32:07 -07:00

31 lines
671 B
Docker

# Multi-stage docker build
# Build stage
FROM golang:1.17.2 AS builder
LABEL maintainer="Kyverno"
# LD_FLAGS is passed as argument from Makefile. It will be empty, if no argument passed
ARG LD_FLAGS
ARG TARGETPLATFORM
ADD . /kyverno
WORKDIR /kyverno
RUN export GOOS=$(echo ${TARGETPLATFORM} | cut -d / -f1) && \
export GOARCH=$(echo ${TARGETPLATFORM} | cut -d / -f2)
RUN go env
RUN CGO_ENABLED=0 go build -o /output/kyvernopre -ldflags="${LD_FLAGS}" -v ./cmd/initContainer/
# Packaging stage
FROM scratch
LABEL maintainer="Kyverno"
COPY --from=builder /output/kyvernopre /
COPY --from=builder /etc/passwd /etc/passwd
USER 10001
ENTRYPOINT ["./kyvernopre"]