1
0
mirror of https://github.com/go-micro/go-micro.git synced 2024-11-30 08:06:40 +02:00

Optimize Dockerfile generated by Gomu (#2253)

This change prevents having to rebuild the entire Docker image when your
source code changes.
This commit is contained in:
Niek den Breeje 2021-09-08 13:50:30 +02:00 committed by GitHub
parent a36f52c6d2
commit 0dd6afe128
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,8 +5,10 @@ var Dockerfile = `FROM golang:alpine AS builder
ENV CGO_ENABLED=0 GOOS=linux
WORKDIR /go/src/{{.Alias}}
RUN apk --update --no-cache add ca-certificates gcc libtool make musl-dev protoc
COPY . /go/src/{{.Alias}}
RUN make {{if not .Client}}init proto {{end}}tidy build
COPY {{if not .Client}}Makefile {{end}go.mod go.sum ./
RUN {{if not .Client}}make init && {{end}}go mod download
COPY . .
RUN make {{if not .Client}}proto {{end}}tidy build
FROM scratch
COPY --from=builder /etc/ssl/certs /etc/ssl/certs