From cba264f1a69723e1afdd0325a667b850ab882958 Mon Sep 17 00:00:00 2001 From: belajarqywok Date: Mon, 15 Jul 2024 20:03:32 +0700 Subject: [PATCH] update: change image golang:1.20 to golang:1.20-alpine3.19 --- Dockerfile | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1fe8b37..e3d1f62 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,15 +1,23 @@ -FROM golang:1.20 +FROM golang:1.20-alpine3.19 LABEL creator="qywok" -WORKDIR /app +ENV APP_DIR=/tebakaja_proxy \ + GO111MODULE=on \ + CGO_ENABLED=0 + +WORKDIR ${APP_DIR} COPY go.mod go.sum ./ RUN go mod download COPY . . -RUN go build -o main +RUN go build -o main . && \ + go clean -modcache && \ + rm -rf /var/cache/apk/* /root/.cache/go-build /root/go/pkg && \ + find . -type f ! -name 'main' ! -name '.env' -delete && \ + find . -type d -empty -not -path './docs' -delete EXPOSE 7860