diff --git a/Dockerfile-velero-restore-helper.ubi b/Dockerfile-velero-restore-helper.ubi index 6ba5c1c33d..7c168c05ed 100644 --- a/Dockerfile-velero-restore-helper.ubi +++ b/Dockerfile-velero-restore-helper.ubi @@ -1,10 +1,16 @@ -FROM quay.io/konveyor/builder:latest AS builder +FROM quay.io/konveyor/builder:ubi9-latest AS builder +ARG TARGETOS +ARG TARGETARCH + 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-restore-helper github.com/vmware-tanzu/velero/cmd/velero-restore-helper -FROM registry.access.redhat.com/ubi8-minimal +RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -a -mod=mod -ldflags '-extldflags "-static"' -o $APP_ROOT/src/velero-restore-helper github.com/vmware-tanzu/velero/cmd/velero-restore-helper + +FROM registry.access.redhat.com/ubi9-minimal RUN microdnf -y update && microdnf clean all COPY --from=builder /opt/app-root/src/velero-restore-helper velero-restore-helper diff --git a/Dockerfile.ubi b/Dockerfile.ubi index 195ace4530..37e41d9665 100644 --- a/Dockerfile.ubi +++ b/Dockerfile.ubi @@ -1,18 +1,28 @@ -# TODO! Find a real ubi8 image for golang 1.16 FROM quay.io/konveyor/builder:ubi9-latest AS builder +ARG TARGETOS +ARG TARGETARCH + ENV GOPATH=$APP_ROOT + COPY . /go/src/github.com/vmware-tanzu/velero + WORKDIR /go/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=1.14.0' -o /go/src/velero github.com/vmware-tanzu/velero/cmd/velero -RUN CGO_ENABLED=0 GOOS=linux go build -a -mod=mod -ldflags '-extldflags "-static"' -o /go/src/velero-helper github.com/vmware-tanzu/velero/cmd/velero-helper +RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -a -mod=mod -ldflags '-extldflags "-static" -X github.com/vmware-tanzu/velero/pkg/buildinfo.Version=1.14.0' -o /go/src/velero github.com/vmware-tanzu/velero/cmd/velero +RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -a -mod=mod -ldflags '-extldflags "-static"' -o /go/src/velero-helper github.com/vmware-tanzu/velero/cmd/velero-helper FROM quay.io/konveyor/builder:ubi9-latest AS restic-builder +ARG TARGETOS +ARG TARGETARCH + 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 + && 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 + +RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -a -mod=mod -ldflags '-extldflags "-static"' -o $APP_ROOT/src/restic github.com/restic/restic/cmd/restic FROM registry.access.redhat.com/ubi9-minimal RUN microdnf -y update && microdnf -y install nmap-ncat && microdnf -y reinstall tzdata && microdnf clean all