From 1f9a6f49be321b95481fb0a0e85f9b34e66dec5b Mon Sep 17 00:00:00 2001 From: Scott Seago Date: Wed, 16 Jun 2021 10:52:57 -0400 Subject: [PATCH] Don't use builder from docker.io --- Dockerfile-velero-restic-restore-helper.ubi | 11 ++++---- Dockerfile.ubi | 29 +++++++++++---------- 2 files changed, 21 insertions(+), 19 deletions(-) diff --git a/Dockerfile-velero-restic-restore-helper.ubi b/Dockerfile-velero-restic-restore-helper.ubi index f713e342ec..7d7a8767b2 100644 --- a/Dockerfile-velero-restic-restore-helper.ubi +++ b/Dockerfile-velero-restic-restore-helper.ubi @@ -1,12 +1,13 @@ -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/go-toolset:1.14.7 AS builder +ENV GOPATH=$APP_ROOT +COPY . $APP_ROOT/src/github.com/vmware-tanzu/velero +WORKDIR $APP_ROOT/src/github.com/vmware-tanzu/velero +RUN CGO_ENABLED=0 GOOS=linux go build -a -mod=mod -ldflags '-extldflags "-static"' -o $APP_ROOT/src/velero-restic-restore-helper github.com/vmware-tanzu/velero/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 +COPY --from=builder /opt/app-root/src/velero-restic-restore-helper velero-restic-restore-helper USER nobody:nobody diff --git a/Dockerfile.ubi b/Dockerfile.ubi index ff50793291..f85c5f2095 100644 --- a/Dockerfile.ubi +++ b/Dockerfile.ubi @@ -1,20 +1,21 @@ -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" -X github.com/vmware-tanzu/velero/pkg/buildinfo.Version=v1.6.0-konveyor' -mod=mod ./cmd/velero +FROM registry.access.redhat.com/ubi8/go-toolset:1.14.7 AS builder +ENV GOPATH=$APP_ROOT +COPY . $APP_ROOT/src/github.com/vmware-tanzu/velero +WORKDIR $APP_ROOT/src/github.com/vmware-tanzu/velero +RUN CGO_ENABLED=0 GOOS=linux go build -a -mod=mod -ldflags '-extldflags "-static" -X github.com/vmware-tanzu/velero/pkg/buildinfo.Version=v1.6.0-konveyor' -o $APP_ROOT/src/velero github.com/vmware-tanzu/velero/cmd/velero -RUN mkdir /go/src/github.com/restic \ -&& cd /go/src/github.com/restic \ -&& git clone https://github.com/konveyor/restic -b konveyor-dev \ -&& cd /go/src/github.com/restic/restic \ -&& CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-extldflags "-static"' -mod=mod ./cmd/restic +FROM registry.access.redhat.com/ubi8/go-toolset:1.14.7 AS restic-builder +ENV GOPATH=$APP_ROOT +RUN mkdir -p $APP_ROOT/src/github.com/restic \ +&& cd $APP_ROOT/src/github.com/restic \ +&& git clone https://github.com/konveyor/restic -b konveyor-dev +WORKDIR $APP_ROOT/src/github.com/restic/restic +RUN CGO_ENABLED=0 GOOS=linux go build -a -mod=mod -ldflags '-extldflags "-static"' -o $APP_ROOT/src/restic github.com/restic/restic/cmd/restic FROM registry.access.redhat.com/ubi8-minimal -RUN microdnf -y install nmap-ncat && microdnf clean all -RUN microdnf -y update && microdnf clean all - -COPY --from=builder /go/src/github.com/vmware-tanzu/velero/velero velero -COPY --from=builder /go/src/github.com/restic/restic/restic /usr/bin/restic +RUN microdnf -y update && microdnf -y install nmap-ncat && microdnf clean all +COPY --from=builder /opt/app-root/src/velero velero +COPY --from=restic-builder /opt/app-root/src/restic /usr/bin/restic USER nobody:nobody