ARG BASE_IMAGE # Build the cli binary FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.17-alpine as builder ARG GOPROXY ENV GOPROXY=${GOPROXY:-https://goproxy.cn} WORKDIR /workspace # Copy the Go Modules manifests COPY go.mod go.mod COPY go.sum go.sum # cache deps before building and copying source so that we don't need to re-download as much # and so that source changes don't invalidate our downloaded layer RUN go mod download # Copy the go source COPY apis/ apis/ COPY pkg/ pkg/ COPY version/ version/ COPY references/ references/ # Build ARG VERSION ARG GITVERSION RUN GO111MODULE=on CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \ go build -a -ldflags "-s -w -X github.com/oam-dev/kubevela/version.VelaVersion=${VERSION:-undefined} -X github.com/oam-dev/kubevela/version.GitRevision=${GITVERSION:-undefined}" \ -o vela ./references/cmd/cli/main.go FROM ghcr.io/cloudtty/cloudshell:v0.2.0 RUN apt-get install -y vim ENV API_TOKEN_PATH=/usr/local/kubeconfig/token COPY --from=builder /workspace/vela /usr/local/bin/vela