FROM openshift/origin-release:golang-1.14 AS builder
COPY . /go/src/github.com/vmware-tanzu/velero
RUN cd /go/src/github.com/vmware-tanzu/velero \
&& CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-extldflags "-static"' -mod=mod ./cmd/velero-restic-restore-helper

FROM registry.access.redhat.com/ubi8-minimal
RUN microdnf -y update && microdnf clean all

COPY --from=builder /go/src/github.com/vmware-tanzu/velero/velero-restic-restore-helper /velero-restic-restore-helper

USER nobody:nobody

ENTRYPOINT [ "/velero-restic-restore-helper" ]
