chore: add multistage build to optimize the image size

This commit is contained in:
Lakhan Samani
2021-07-21 17:53:22 +05:30
parent a528fe2f26
commit 40ad01e6b7
4 changed files with 24 additions and 5 deletions

View File

@@ -6,6 +6,9 @@ COPY . .
RUN apk add build-base && cd server && go mod download && go build && chmod 777 server && ls -l
FROM alpine:latest
RUN apk --no-cache add ca-certificates
WORKDIR /root/
COPY --from=builder /app/server/server .
EXPOSE 8080
ENTRYPOINT [ "/app/server/server" ]
CMD [ "./server" ]