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
Shubham Gupta f70cd4222f
Update hash of dependencies instead of mutable version (#3582)
Co-authored-by: Vyankatesh Kudtarkar <vyankateshkd@gmail.com>
2022-04-12 10:22:38 +01:00

31 lines
736 B
Docker

# Multi-stage docker build
# Build stage
FROM golang@sha256:ec67c62f48ddfbca1ccaef18f9b3addccd707e1885fa28702a3954340786fcf6 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"]