-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Xun Jiang <[email protected]>
- Loading branch information
Xun Jiang
committed
Jan 12, 2023
1 parent
2b5281f
commit 03599b0
Showing
2 changed files
with
20 additions
and
11 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 |
---|---|---|
|
@@ -12,9 +12,8 @@ | |
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
# Setup build environment | ||
ARG GOLANG_VERSION=1.18.8 | ||
FROM --platform=$BUILDPLATFORM golang:${GOLANG_VERSION} as builder-env | ||
# Velero binary build section | ||
FROM --platform=$BUILDPLATFORM golang:1.18.8 as velero-builder | ||
|
||
ARG GOPROXY | ||
ARG BIN | ||
|
@@ -23,7 +22,6 @@ ARG VERSION | |
ARG REGISTRY | ||
ARG GIT_SHA | ||
ARG GIT_TREE_STATE | ||
ARG RESTIC_VERSION | ||
ARG TARGETOS | ||
ARG TARGETARCH | ||
ARG TARGETVARIANT | ||
|
@@ -40,18 +38,28 @@ WORKDIR /go/src/github.com/vmware-tanzu/velero | |
|
||
COPY . /go/src/github.com/vmware-tanzu/velero | ||
|
||
# Velero binary build section | ||
ARG GOLANG_VERSION=1.18.8 | ||
FROM --platform=$BUILDPLATFORM builder-env as builder | ||
|
||
RUN mkdir -p /output/usr/bin && \ | ||
export GOARM=$( echo "${GOARM}" | cut -c2-) && \ | ||
go build -o /output/${BIN} \ | ||
-ldflags "${LDFLAGS}" ${PKG}/cmd/${BIN} | ||
|
||
# Restic binary build section | ||
ARG GOLANG_VERSION=1.19.4-bullseye | ||
FROM --platform=$BUILDPLATFORM builder-env as restic-builder | ||
FROM --platform=$BUILDPLATFORM golang:1.19.4-bullseye 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-) && \ | ||
|
@@ -62,7 +70,7 @@ FROM gcr.io/distroless/base-debian11@sha256:99133cb0878bb1f84d1753957c6fd4b84f00 | |
|
||
LABEL maintainer="Nolan Brubaker <[email protected]>" | ||
|
||
COPY --from=builder /output / | ||
COPY --from=velero-builder /output / | ||
|
||
COPY --from=restic-builder /output / | ||
|
||
|
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 @@ | ||
Fix Dockerfile issue. |