From 14e3377f7e495d4f86bfded9ffd15a4178cdb0c8 Mon Sep 17 00:00:00 2001 From: George Petrakis Date: Thu, 19 Dec 2024 18:03:10 +0200 Subject: [PATCH] Add GIN_MODE build argument to Dockerfile for release mode --- Dockerfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 3f95e7e..e9eaee4 100755 --- a/Dockerfile +++ b/Dockerfile @@ -6,12 +6,14 @@ COPY . . # Add build arguments for debug mode and versioning ARG DEBUG=false +ARG GIN_MODE=release ARG GIT_COMMIT_SHA ARG GIT_VERSION +ENV GIN_MODE=${GIN_MODE} # Set build tags based on the DEBUG flag and include versioning information RUN if [ "$DEBUG" = "true" ]; then \ - go mod download && go build -o server -tags debug -ldflags="-X main.version=${GIT_VERSION}-${GIT_COMMIT_SHA}" ./cmd/server/main.go; \ + go mod download && go build -o server -tags debug -ldflags="-X main.version=DEBUG" ./cmd/server/main.go; \ else \ go mod download && go build -o server -ldflags="-X main.version=${GIT_VERSION}-${GIT_COMMIT_SHA}" ./cmd/server/main.go; \ fi