get -d -v github.com/pkg/errors COPY app.go . RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o app . CMD ["./app"] Ɩƹżƶű۪̌ȥŹƷƛLjȅȜǜǙLjǞƘűŹůƸŸ FROM golang:1.8.2 AS builder WORKDIR /go/src/github.com/toricls/repos RUN go get -d -v github.com/pkg/errors COPY app.go . RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o app . FROM scratch COPY --from=builder /go/src/github.com/ toricls/repos/app / CMD ["/app"] ڰƘǷȏǭƄƌƱƑ multi-stage buildsƄƌƱƑ
get -d -v github.com/pkg/errors COPY app.go . RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o app . CMD ["./app"] Ɩƹżƶű۪̌ȥŹƷƛLjȅȜǜǙLjǞƘűŹůƸŸ FROM golang:1.8.2 AS builder WORKDIR /go/src/github.com/toricls/repos RUN go get -d -v github.com/pkg/errors COPY app.go . RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o app . FROM scratch COPY --from=builder /go/src/github.com/ toricls/repos/app / CMD ["/app"] ڰƘǷȏǭƄƌƱƑ multi-stage buildƄƌƱƑ + +
WORKDIR /go/src/github.com/toricls/repos RUN go get -d -v github.com/pkg/errors COPY app.go . RUN CGO_ENABLED=0 GOOS=linux \ go build -a -installsuffix cgo -o app . FROM scratch COPY app / CMD ["/app"] ./Dockerfile.build ./Dockerfile (ҩࣄ)