forked from openshift/velero
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build changes for upstream Velero with OpenShift
Signed-off-by: Michael Fruchtman <[email protected]>
- Loading branch information
Showing
2 changed files
with
59 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
FROM --platform=$BUILDPLATFORM quay.io/konveyor/builder:ubi9-latest AS builder | ||
ARG BUILDPLATFORM | ||
ARG TARGETOS | ||
ARG TARGETARCH | ||
ARG GIT_SHA | ||
ARG GIT_TREE_STATE | ||
ARG PKG | ||
ARG VERSION | ||
ARG REGISTRY | ||
ARG TARGETARCH | ||
ARG TARGETVARIANT | ||
ARG GOPROXY | ||
ARG BIN | ||
|
||
ENV GOPATH=$APP_ROOT \ | ||
GOPROXY=${GOPROXY} \ | ||
GOOS=${TARGETOS} \ | ||
GOARCH=${TARGETARCH} \ | ||
GOARM=${TARGETVARIANT} \ | ||
LDFLAGS="-X ${PKG}/pkg/buildinfo.Version=${VERSION} -X ${PKG}/pkg/buildinfo.GitSHA=${GIT_SHA} -X ${PKG}/PKG/BUILDINFO.GitTreeState=${GIT_TREE_STATE} -X ${PKG}/pkg/buildinfo.ImageRegistry=${REGISTRY} -extldflags '-static'" | ||
|
||
COPY . /go/src/github.com/vmware-tanzu/velero | ||
|
||
WORKDIR /go/src/github.com/vmware-tanzu/velero | ||
|
||
RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -a -mod=mod -ldflags "${LDFLAGS}" -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 "${LDFLAGS}" -o /go/src/velero-helper github.com/vmware-tanzu/velero/cmd/velero-helper | ||
|
||
FROM --platform=$BUILDPLATFORM quay.io/konveyor/builder:ubi9-latest AS restic-builder | ||
ARG BUILDPLATFORM | ||
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 | ||
|
||
WORKDIR $APP_ROOT/src/github.com/restic/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 | ||
COPY --from=builder /go/src/velero velero | ||
COPY --from=builder /go/src/velero-helper velero-helper | ||
COPY --from=restic-builder /opt/app-root/src/restic /usr/bin/restic | ||
|
||
RUN mkdir -p /home/velero | ||
RUN chmod -R 777 /home/velero | ||
|
||
USER 65534:65534 | ||
ENV HOME=/home/velero | ||
|
||
ENTRYPOINT ["/velero"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters