Files
games/Dockerfile
Ryan Hamamura 8780b7c9b1
Some checks failed
CI / Deploy / test (push) Successful in 14s
CI / Deploy / lint (push) Successful in 25s
CI / Deploy / deploy (push) Failing after 34s
fix: run templ generate in Dockerfile before build
The _templ.go files are gitignored, so the Docker build context doesn't
include them. Generate them before compiling.
2026-03-02 22:53:00 -10:00

20 lines
464 B
Docker

FROM docker.io/golang:1.25.4-alpine AS build
RUN apk add --no-cache upx
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 \
CGO_ENABLED=0 go build -ldflags="-s" -o /bin/games .
RUN upx -9 -k /bin/games
FROM scratch
ENV PORT=8080
COPY --from=build /bin/games /
ENTRYPOINT ["/games"]