From c64717c73374f97e8c1c7f75dcc17d1fd62999c4 Mon Sep 17 00:00:00 2001 From: Quentin Legot Date: Fri, 29 Sep 2023 23:35:20 +0200 Subject: [PATCH] Optimized image size from 1.1GB to 20MB --- application/Dockerfile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/application/Dockerfile b/application/Dockerfile index 1679bb8..4f5bb93 100644 --- a/application/Dockerfile +++ b/application/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.21 +FROM golang:1.21-alpine as builder WORKDIR /usr/src/app @@ -7,6 +7,9 @@ RUN go mod download && go mod verify COPY main.go main.go RUN go build -v -o /usr/local/bin/app ./main.go +FROM alpine:latest + +COPY --from=builder /usr/local/bin/app /usr/local/bin/app ENV PORT_LISTENING=8080 ENV JSON_LOCATION=https://git.altarik.fr/Altarik/launcher_json/raw/branch/master/launcher.json EXPOSE 8080