blob: a55ec1fc9bd3f1ecc6d4dd2c451804bdae84a717 [file] [log] [blame]
Koichi Shiraishid64abbe2020-03-03 02:28:19 +09001# target: cue-builder
2ARG GOLANG_VERSION
3FROM docker.io/golang:${GOLANG_VERSION}-alpine AS cue-builder
4ARG CUE_VERSION
5ENV \
6 OUTDIR='/out' \
7 GO111MODULE='on'
8RUN set -eux && \
9 apk add --no-cache \
10 git
11WORKDIR /go/src/cuelang.org/go
12COPY go.mod /go/src/cuelang.org/go/
13COPY go.sum /go/src/cuelang.org/go/
14RUN set -eux && \
15 go mod download
16COPY . /go/src/cuelang.org/go/
17RUN set -eux && \
18 CGO_ENABLED=0 GOBIN=${OUTDIR}/usr/bin/ go install \
19 -a -v \
20 -tags='osusergo,netgo' \
21 -installsuffix='netgo' \
22 -ldflags="-s -w -X cuelang.org/go/cmd/cue/cmd.version=${CUE_VERSION} \"-extldflags=-static\"" \
23 ./cmd/cue
24
25# target: cue
26FROM gcr.io/distroless/static:latest AS cue
27COPY --from=cue-builder /out/ /
28ENTRYPOINT ["/usr/bin/cue"]