github.com/kubevela/workflow@v0.6.0/Dockerfile (about) 1 ARG BASE_IMAGE 2 # Build the manager binary 3 FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.19-alpine as builder 4 ARG GOPROXY 5 ENV GOPROXY=${GOPROXY:-https://goproxy.cn} 6 WORKDIR /workspace 7 # Copy the Go Modules manifests 8 COPY go.mod go.mod 9 COPY go.sum go.sum 10 # cache deps before building and copying source so that we don't need to re-download as much 11 # and so that source changes don't invalidate our downloaded layer 12 RUN go mod download 13 14 # Copy the go source 15 COPY cmd/main.go cmd/main.go 16 COPY api/ api/ 17 COPY controllers/ controllers/ 18 COPY pkg/ pkg/ 19 COPY version/ version/ 20 21 # Build 22 ARG TARGETARCH 23 ARG VERSION 24 ARG GITVERSION 25 RUN GO111MODULE=on CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH} \ 26 go build -a -ldflags "-s -w -X github.com/kubevela/workflow/version.VelaVersion=${VERSION:-undefined} -X github.com/kubevela/workflow/version.GitRevision=${GITVERSION:-undefined}" \ 27 -o vela-workflow-${TARGETARCH} cmd/main.go 28 29 FROM ${BASE_IMAGE:-alpine:3.15} 30 # This is required by daemon connecting with cri 31 RUN apk add --no-cache ca-certificates bash expat 32 33 WORKDIR / 34 35 ARG TARGETARCH 36 COPY --from=builder /workspace/vela-workflow-${TARGETARCH} /usr/local/bin/vela-workflow 37 38 ENTRYPOINT ["vela-workflow"]