Files
releases/Dockerfile
T
Patrick East 58ca7cd47a Fix *-debug docker images to be ":debug" tag based
We use the gcr.io/distroless/base:debug tag for the *-debug images of
OPA. At the point where we switched to the multi-stage build we dropped
defining the `VARIANT` argument so it wasn't being picked up correctly.

This lead to us just using gcr.io/distroless/base for the *-debug
image.. which isn't what we wanted.

Signed-off-by: Patrick East <east.patrick@gmail.com>
2019-09-24 13:01:21 -07:00

23 lines
859 B
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 VARIANT
ARG BUILD_COMMIT
# we cant use build-args in `COPY --from=...` below, so work around this
# see: https://medium.com/@tonistiigi/advanced-multi-stage-build-patterns-6f741b852fae
FROM build-${BUILD_COMMIT} AS copy-src
FROM gcr.io/distroless/base${VARIANT}
# make root (uid 0) default when not specified
ARG USER=0
MAINTAINER Torin Sandall <torinsandall@gmail.com>
COPY --from=copy-src /go/src/github.com/open-policy-agent/opa/opa_linux_amd64 /opa
# 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
USER ${USER}
ENTRYPOINT ["/opa"]
CMD ["run"]