Skip to content

Commit

Permalink
feat-test: add ingressclass from ingress
Browse files Browse the repository at this point in the history
Signed-off-by: AlbeeSo <[email protected]>
  • Loading branch information
AlbeeSo committed May 22, 2024
1 parent 0094e1e commit 9d771a6
Showing 1 changed file with 21 additions and 58 deletions.
79 changes: 21 additions & 58 deletions Dockerfile
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.
Expand All @@ -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"]

0 comments on commit 9d771a6

Please sign in to comment.