mirror of
https://github.com/open-policy-agent/opa.git
synced 2026-08-12 19:32:48 -06:00
239d35f2a2
We should now be able to more easily use the opa images in Gitlab CI. Fixes #5003. Signed-off-by: Matúš Ferech <matus.ferech@gmail.com>
35 lines
1.2 KiB
Docker
35 lines
1.2 KiB
Docker
# Copyright 2019 The OPA Authors. All rights reserved.
|
|
# Use of this source code is governed by an Apache2
|
|
# license that can be found in the LICENSE file.
|
|
|
|
ARG BASE
|
|
|
|
FROM ${BASE}
|
|
|
|
LABEL org.opencontainers.image.authors="Torin Sandall <torinsandall@gmail.com>"
|
|
LABEL org.opencontainers.image.source="https://github.com/open-policy-agent/opa"
|
|
|
|
# Temporarily allow us to identify whether running from within an offical
|
|
# Docker image, so that we may print a warning when uid or gid == 0 (root)
|
|
# Remove once https://github.com/open-policy-agent/opa/issues/4295 is done
|
|
ENV OPA_DOCKER_IMAGE="official"
|
|
|
|
# Any non-zero number will do, and unfortunately a named user will not, as k8s
|
|
# pod securityContext runAsNonRoot can't resolve the user ID:
|
|
# https://github.com/kubernetes/kubernetes/issues/40958. Make root (uid 0) when
|
|
# not specified.
|
|
ARG USER=0
|
|
USER ${USER}
|
|
|
|
# TARGETOS and TARGETARCH are automatic platform args injected by BuildKit
|
|
# https://docs.docker.com/engine/reference/builder/#automatic-platform-args-in-the-global-scope
|
|
ARG TARGETOS
|
|
ARG TARGETARCH
|
|
ARG BIN_DIR=.
|
|
ARG BIN_SUFFIX=
|
|
COPY ${BIN_DIR}/opa_${TARGETOS}_${TARGETARCH}${BIN_SUFFIX} /opa
|
|
ENV PATH=${PATH}:/
|
|
|
|
ENTRYPOINT ["/opa"]
|
|
CMD ["run"]
|