From cd05aa35c5703b5b1e595849f794e7da7da88aaf Mon Sep 17 00:00:00 2001 From: ngn Date: Sat, 13 Apr 2024 18:07:11 +0300 Subject: [PATCH] make the docker container smaller --- Dockerfile | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 052218a..47f0e7f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.21.4 +FROM golang:1.21.4 as build WORKDIR /app @@ -10,6 +10,11 @@ COPY static ./static COPY views ./views COPY routes ./routes -RUN go build . +EXPOSE 8080 +RUN CGO_ENABLED=0 go build . +FROM alpine as main +COPY --from=build /app /app + +WORKDIR /app ENTRYPOINT ["/app/note-server"]