Datastar-pro is fetched from a private Gitea repo (ryan/vendor-libs) using VENDOR_TOKEN for CI/Docker builds, with a local fallback from ../optional/ for development. DaisyUI is pinned to v5.5.19 instead of tracking latest. Downloaded files are now gitignored and fetched at build time via 'task download', which is a dependency of both build and live tasks.
29 lines
753 B
Docker
29 lines
753 B
Docker
FROM docker.io/golang:1.25.4-alpine AS build
|
|
|
|
ARG VERSION=dev
|
|
ARG COMMIT=unknown
|
|
|
|
RUN apk add --no-cache upx
|
|
|
|
WORKDIR /src
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download
|
|
|
|
COPY . .
|
|
|
|
RUN --mount=type=secret,id=vendor_token \
|
|
VENDOR_TOKEN=$(cat /run/secrets/vendor_token) \
|
|
go run cmd/downloader/main.go
|
|
|
|
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}') && \
|
|
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"]
|