# build stage FROM golang:1.13-stretch AS build-env COPY . /src WORKDIR /src ENV GO113MODULE=on RUN CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go test ./... -cover -coverprofile=c.out #gosetup RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o goapp # final stage FROM alpine LABEL maintainer="Alphyron " RUN apk update \ && apk upgrade \ && apk add --no-cache \ ca-certificates \ && update-ca-certificates 2>/dev/null || true WORKDIR /app COPY --from=build-env /src . RUN chmod +x ./goapp CMD [ "./goapp"]