FROM docker.io/golang:1.25.4-alpine AS build RUN apk add --no-cache upx git WORKDIR /src COPY go.mod go.sum ./ RUN go mod download 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 \ 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 ENV PORT=8080 COPY --from=build /bin/games / ENTRYPOINT ["/games"]