Skip to content

Commit

Permalink
fix: proper version insertion in Docker build
Browse files Browse the repository at this point in the history
  • Loading branch information
tobbee committed Nov 1, 2024
1 parent b23eaad commit c6007d7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,15 @@

# Build Stage
FROM golang:1.23.1-alpine3.20 AS BuildStage
RUN apk add git
WORKDIR /work
COPY . .
RUN go mod download
RUN go build -ldflags "-X github.com/Dash-Industry-Forum/livesim2/internal.commitVersion=$$(git describe --tags HEAD) -X github.com/Dash-Industry-Forum/livesim2/internal.commitDate=$$(git log -1 --format=%ct)" -o ./out/livesim2 ./cmd/livesim2/main.go
ARG COMMIT_DATE
RUN COMMIT_DATE=$(git log -1 --format=%ct)
ARG VERSION
RUN VERSION=$(git describe --tags HEAD)
RUN go build -ldflags "-X github.com/Dash-Industry-Forum/livesim2/internal.commitVersion=$VERSION -X github.com/Dash-Industry-Forum/livesim2/internal.commitDate=$COMMIT_DATE" -o ./out/livesim2 ./cmd/livesim2/main.go
# Deploy Stage
FROM alpine:latest
WORKDIR /
Expand Down

0 comments on commit c6007d7

Please sign in to comment.