diff --git a/Dockerfile b/Dockerfile index 0b62d6c..8062ee1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ FROM docker.io/golang:1.25.4-alpine AS build -RUN apk add --no-cache upx +RUN apk add --no-cache upx git WORKDIR /src COPY go.mod go.sum ./ @@ -10,7 +10,10 @@ COPY . . RUN go tool templ generate RUN go tool gotailwind -i assets/css/input.css -o assets/css/output.css --minify RUN --mount=type=cache,target=/root/.cache/go-build \ - CGO_ENABLED=0 go build -ldflags="-s" -o /bin/games . + MODULE=$(head -1 go.mod | awk '{print $2}') && \ + VERSION=$(git describe --tags --always) && \ + COMMIT=$(git rev-parse --short HEAD) && \ + CGO_ENABLED=0 go build -ldflags="-s -X $MODULE/version.Version=$VERSION -X $MODULE/version.Commit=$COMMIT" -o /bin/games . RUN upx -9 -k /bin/games FROM scratch diff --git a/features/common/layouts/base.templ b/features/common/layouts/base.templ index 86d563a..5029e7f 100644 --- a/features/common/layouts/base.templ +++ b/features/common/layouts/base.templ @@ -1,6 +1,9 @@ package layouts -import "github.com/ryanhamamura/games/config" +import ( + "github.com/ryanhamamura/games/config" + "github.com/ryanhamamura/games/version" +) templ Base(title string) { @@ -16,6 +19,9 @@ templ Base(title string) {
} { children... } +