2023-05-22 04:06:42 +03:00
|
|
|
ARG REGISTRY
|
2024-09-25 01:01:53 +03:00
|
|
|
FROM ${REGISTRY}/ubi8/go-toolset:1.21.13-1 AS builder
|
2023-05-22 04:06:42 +03:00
|
|
|
ARG GATEKEEPER_VERSION
|
2023-07-14 13:22:33 +03:00
|
|
|
ENV DOWNLOAD_URL=https://github.com/open-policy-agent/gatekeeper/archive/${GATEKEEPER_VERSION}.tar.gz
|
2023-05-22 04:06:42 +03:00
|
|
|
|
|
|
|
ARG BUILDKIT_SBOM_SCAN_STAGE=true
|
|
|
|
|
|
|
|
ENV GO111MODULE=on \
|
|
|
|
GOOS=linux \
|
|
|
|
GOPATH=/go/ \
|
2023-06-02 02:27:18 +03:00
|
|
|
GOARCH=amd64
|
2023-05-22 04:06:42 +03:00
|
|
|
|
|
|
|
WORKDIR ${GOPATH}/src/github.com/open-policy-agent/gatekeeper
|
|
|
|
USER root
|
|
|
|
RUN curl -Lq $DOWNLOAD_URL | tar -xz --strip-components=1
|
|
|
|
|
2024-05-07 08:32:04 +03:00
|
|
|
RUN go build -mod vendor -a -ldflags "-X github.com/open-policy-agent/gatekeeper/pkg/version.Version=$GATEKEEPER_VERSION" -o manager
|
2023-05-22 04:06:42 +03:00
|
|
|
|
|
|
|
#### Runtime container
|
|
|
|
FROM ${REGISTRY}/ubi8/ubi-minimal:latest
|
|
|
|
|
|
|
|
ENV USER_UID=1001 \
|
|
|
|
USER_NAME=guardrails-operator
|
|
|
|
|
|
|
|
WORKDIR /
|
|
|
|
RUN microdnf update && microdnf clean all
|
|
|
|
COPY --from=builder /go/src/github.com/open-policy-agent/gatekeeper/manager .
|
|
|
|
ENTRYPOINT ["/manager"]
|
|
|
|
|
|
|
|
USER ${USER_UID}
|
|
|
|
LABEL io.openshift.managed.name="guardrails-operator" \
|
2024-03-05 10:18:36 +03:00
|
|
|
io.openshift.managed.description="Operator to enforce guardrails policies for Openshift version 4 clusters"
|