Byte-Cats / microman

Minimal Go Backend Starter Kit without frameworks
MIT License
1 stars 1 forks source link

Dockerfile with multistep binary building #19

Closed 4cecoder closed 2 years ago

4cecoder commented 2 years ago
# build stage
FROM golang:alpine AS build-env
RUN apk --no-cache add build-base git bzr mercurial gcc
ADD . /src
RUN cd /src/cmd/microbro && go build -o mircoman
# final stage
FROM alpine
WORKDIR /app
COPY --from=build-env /src/cmd/microbro/mircroman /app/
ENTRYPOINT ./microman
4cecoder commented 2 years ago

https://fabianlee.org/2020/01/26/golang-using-multi-stage-builds-to-create-clean-docker-images/