forked from vmware-tanzu/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.
feat-test: add ingressclass from ingress
Signed-off-by: AlbeeSo <[email protected]>
- Loading branch information
Showing
1 changed file
with
21 additions
and
58 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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Copyright 2020 the Velero contributors. | ||
# Copyright 2017, 2019 the Velero contributors. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
|
@@ -12,71 +12,34 @@ | |
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
# Velero binary build section | ||
FROM --platform=$BUILDPLATFORM golang:1.22-bookworm as velero-builder | ||
#FROM ubuntu:focal | ||
|
||
ARG GOPROXY | ||
ARG BIN | ||
ARG PKG | ||
ARG VERSION | ||
ARG REGISTRY | ||
ARG GIT_SHA | ||
ARG GIT_TREE_STATE | ||
ARG TARGETOS | ||
ARG TARGETARCH | ||
ARG TARGETVARIANT | ||
FROM --platform=$BUILDPLATFORM golang:1.22-bookworm as builder-env | ||
|
||
ENV CGO_ENABLED=0 \ | ||
GO111MODULE=on \ | ||
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}" | ||
|
||
WORKDIR /go/src/github.com/vmware-tanzu/velero | ||
ARG TARGETPLATFORM | ||
ARG BUILDPLATFORM | ||
|
||
COPY . /go/src/github.com/vmware-tanzu/velero | ||
|
||
RUN mkdir -p /output/usr/bin && \ | ||
export GOARM=$( echo "${GOARM}" | cut -c2-) && \ | ||
go build -o /output/${BIN} \ | ||
-ldflags "${LDFLAGS}" ${PKG}/cmd/${BIN} && \ | ||
go build -o /output/velero-helper \ | ||
-ldflags "${LDFLAGS}" ${PKG}/cmd/velero-helper && \ | ||
go clean -modcache -cache | ||
|
||
# Restic binary build section | ||
FROM --platform=$BUILDPLATFORM golang:1.22-bookworm as restic-builder | ||
|
||
ARG BIN | ||
ARG TARGETOS | ||
ARG TARGETARCH | ||
ARG TARGETVARIANT | ||
ARG RESTIC_VERSION | ||
|
||
ENV CGO_ENABLED=0 \ | ||
GO111MODULE=on \ | ||
GOPROXY=${GOPROXY} \ | ||
GOOS=${TARGETOS} \ | ||
GOARCH=${TARGETARCH} \ | ||
GOARM=${TARGETVARIANT} | ||
|
||
COPY . /go/src/github.com/vmware-tanzu/velero | ||
|
||
RUN mkdir -p /output/usr/bin && \ | ||
export GOARM=$(echo "${GOARM}" | cut -c2-) && \ | ||
/go/src/github.com/vmware-tanzu/velero/hack/build-restic.sh && \ | ||
go clean -modcache -cache | ||
WORKDIR /go/src/github.com/vmware-tanzu/velero | ||
|
||
# Velero image packing section | ||
FROM paketobuildpacks/run-jammy-tiny:latest | ||
RUN mkdir -p /output/bin | ||
RUN env GOARCH=$(echo $TARGETPLATFORM | cut -f2 -d '/') CGO_ENABLED=0 GO111MODULE=on GOPROXY=proxy.golang.com.cn,direct \ | ||
go build -o /output/bin ./cmd/velero | ||
|
||
LABEL maintainer="Xun Jiang <[email protected]>" | ||
|
||
COPY --from=velero-builder /output / | ||
FROM --platform=$TARGETPLATFORM registry.cn-hangzhou.aliyuncs.com/acs/alpine:3.16-update | ||
|
||
COPY --from=restic-builder /output / | ||
RUN apk add --update curl tzdata iproute2 libc6-compat && \ | ||
rm -rf /var/cache/apk/* && \ | ||
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \ | ||
echo "Asia/Shanghai" > /etc/timezone | ||
|
||
USER cnb:cnb | ||
COPY --from=builder-env /output/bin/velero /velero | ||
RUN chmod +x /velero && \ | ||
addgroup -S nonroot && adduser -u 65530 -S nonroot -G nonroot && \ | ||
rm -rf /sbin/* && \ | ||
rm -rf /bin/* | ||
USER 65530 | ||
|
||
ENTRYPOINT ["/velero","--features=EnableAPIGroupVersions"] |