Skip to content

Commit

Permalink
Fix Dockerfile: Properly set the LDFLAG to bake in version information.
Browse files Browse the repository at this point in the history
  • Loading branch information
jlewi committed Nov 12, 2024
1 parent af95d2f commit 1295ac3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ WORKDIR /workspace/app
## Build
# The LDFLAG can't be specified multiple times so we use an environment variable to build it up over multiple lines
# -a flag forces a rebuild of the package and its sources; is that what we want?
RUN LDFLAGS="-s -w -X github.com/jlewi/foyle/app/cmd/commands.version=${VERSION}" && \
LDFLAGS="${LDFLAGS} -X github.com/jlewi/foyle/app/cmd/commands.commit=${COMMIT}" && \
LDFLAGS="${LDFLAGS} -X github.com/jlewi/foyle/app/cmd/commands.date=${DATE}" && \
RUN LDFLAGS="-s -w -X github.com/jlewi/foyle/app/cmd.version=${VERSION}" && \
LDFLAGS="${LDFLAGS} -X github.com/jlewi/foyle/app/cmd.commit=${COMMIT}" && \
LDFLAGS="${LDFLAGS} -X github.com/jlewi/foyle/app/cmd.date=${DATE}" && \
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on \
go build \
-ldflags "${LDFLAGS}" \
Expand Down

0 comments on commit 1295ac3

Please sign in to comment.