From b90e61cf66e36476f9d808e7a3d6d568bbefc57a Mon Sep 17 00:00:00 2001 From: Quentin Legot Date: Fri, 29 Sep 2023 23:25:00 +0200 Subject: [PATCH] Adding a dockerfile to application --- application/Dockerfile | 13 +++++++++++++ application/main.go | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 application/Dockerfile diff --git a/application/Dockerfile b/application/Dockerfile new file mode 100644 index 0000000..1679bb8 --- /dev/null +++ b/application/Dockerfile @@ -0,0 +1,13 @@ +FROM golang:1.21 + +WORKDIR /usr/src/app + +COPY go.mod go.sum ./ +RUN go mod download && go mod verify +COPY main.go main.go +RUN go build -v -o /usr/local/bin/app ./main.go + +ENV PORT_LISTENING=8080 +ENV JSON_LOCATION=https://git.altarik.fr/Altarik/launcher_json/raw/branch/master/launcher.json +EXPOSE 8080 +CMD ["app"] diff --git a/application/main.go b/application/main.go index f0f8355..958afcc 100644 --- a/application/main.go +++ b/application/main.go @@ -14,7 +14,7 @@ import ( func main() { err := godotenv.Load() if err != nil { - log.Fatal("Error loading .env file") + log.Println("Error loading .env file -- ignore if production") } r := gin.Default() r.GET("/", getLauncherJson)