blob: 149e2439baac93d603341188137cce9247edb480 [file] [log] [blame]
# Copyright 2017 The Go Authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
FROM golang:1.13 AS build
LABEL maintainer ""
RUN mkdir /gocache
ENV GOCACHE /gocache
COPY go.mod /go/src/
COPY go.sum /go/src/
WORKDIR /go/src/
# Optimization for iterative docker build speed, not necessary for correctness:
# TODO: write a tool to make writing Go module-friendly Dockerfiles easier.
RUN go install
COPY . /go/src/
# Install binary to /go/bin/stage0
RUN go install
RUN CGO_ENABLED=0 go build -o /go/bin/stage0.static
FROM golang:1.13
COPY --from=build /go/bin/stage0 /go/bin/stage0
COPY --from=build /go/bin/stage0.static /go/bin/stage0.static