fix: correctly inject the version from the VERION file into the code on build

This commit is contained in:
lone-cloud 2026-02-13 22:42:12 -08:00
parent 96f413c9f9
commit 98b18e28ca

View file

@ -1,7 +1,5 @@
FROM golang:1.26-alpine3.23 AS builder FROM golang:1.26-alpine3.23 AS builder
ARG VERSION=dev
WORKDIR /build WORKDIR /build
RUN apk add --no-cache git ca-certificates RUN apk add --no-cache git ca-certificates
@ -11,7 +9,8 @@ RUN go mod download
COPY . . COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build \ RUN VERSION=$(cat VERSION 2>/dev/null || echo "dev") && \
CGO_ENABLED=0 GOOS=linux go build \
-trimpath \ -trimpath \
-ldflags="-w -s -X main.version=${VERSION}" \ -ldflags="-w -s -X main.version=${VERSION}" \
-o prism . -o prism .