FROM openshift/golang-builder:1.14 AS builder
ADD . .
RUN mkdir -p /go/src/github.com/vmware-tanzu/velero
RUN tar --strip-components=1 -xvf release-1.4.4.tar.gz -C /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"' ./cmd/velero-restic-restore-helper

FROM registry.redhat.io/ubi8/ubi-minimal
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" ]

LABEL \
        com.redhat.component="openshift-migration-velero-restic-restore-helper-container" \
        version="v1.4.4" \
        name="rhmtc/openshift-migration-velero-restic-restore-helper" \
        summary="Migration Toolkit for Containers Velero Restic Restore Helper" \
        maintainer="Migration Team <ocp-migrate-team@redhat.com>" \
        License="BSD 2-Clause" \
        io.k8s.display-name="Migration Toolkit for Containers" \
        io.openshift.tags="migration" \
        io.k8s.description="Migration Toolkit for Containers Velero Restic Restore Helper" \
        io.openshift.build.commit.id="6e664dc7a1cb3abea72c58cb44340028f6ba44ef" \
        io.openshift.build.source-location="https://github.com/konveyor/velero" \
        io.openshift.build.commit.url="https://github.com/konveyor/velero/commit/6e664dc7a1cb3abea72c58cb44340028f6ba44ef"
