FROM openshift/golang-builder:1.12 AS builder
ADD . .
RUN mkdir -p /go/src/github.com/vmware-tanzu/velero
RUN tar --strip-components=1 -xvf konveyor-1.3.2.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 ubi8-minimal:8-released
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.2" \
        name="rhcam/openshift-migration-velero-restic-restore-helper" \
        License="BSD 2-Clause" \
        release="2" \
        io.k8s.display-name="Cluster Application Migration" \
        io.openshift.tags="migration" \
        io.k8s.description="Cluster Application Migration Velero Restic Restore Helper" \
        summary="Cluster Application Migration Velero Restic Restore Helper" \
        maintainer="Migration Team <ocp-migrate-team@redhat.com>"
