Skip to content

Commit

Permalink
Add GIN_MODE build argument to Dockerfile for release mode
Browse files Browse the repository at this point in the history
  • Loading branch information
kek-Sec committed Dec 19, 2024
1 parent 3e60fd5 commit 14e3377
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 14e3377

Please sign in to comment.