The pages are now a Vue 3 + Vite + TypeScript app in web/, built into internal/web/dist/app and embedded in the binary. Go still serves index.html for / and /setup behind the admin gate, plus the hashed /assets/* (public, cached forever). The router takes its base from the current URL, so it works under nginx's /tracker/ prefix unchanged. Only dist/.gitkeep is committed, so go build and go test need no Node; an unbuilt binary shows a "run make web" page at /. The Dockerfile gains a Node stage, CI typechecks and builds the app, and make build/run build it first. Co-Authored-By: Claude Opus 5.5 <[email protected]>
31 lines
1.1 KiB
Docker
31 lines
1.1 KiB
Docker
# Build from the repo root: docker build -f deploy/Dockerfile -t activity-tracker .
|
|
#
|
|
# Multi-arch by construction: all the base images are published for arm64, and
|
|
# the Pi's CI (.gitea/workflows/ci.yaml) builds natively there. No
|
|
# `RUN --mount` cache lines, so it also builds on the Pi's legacy builder.
|
|
FROM node:24-alpine AS web
|
|
WORKDIR /src/web
|
|
COPY web/package.json web/package-lock.json ./
|
|
RUN npm ci
|
|
COPY web/ ./
|
|
# Writes ../internal/web/dist/app, which the Go build embeds.
|
|
RUN npm run build
|
|
|
|
FROM golang:1.27 AS build
|
|
WORKDIR /src
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download
|
|
COPY . .
|
|
COPY --from=web /src/internal/web/dist/app internal/web/dist/app
|
|
RUN CGO_ENABLED=0 go build -trimpath -ldflags="-s -w" -o /out/tracker ./cmd/tracker
|
|
|
|
FROM gcr.io/distroless/static-debian12:nonroot
|
|
COPY --from=build /out/tracker /usr/local/bin/tracker
|
|
EXPOSE 8080
|
|
# distroless has no shell or wget, so the binary probes its own /readyz
|
|
# (process up and database reachable).
|
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
|
|
CMD ["/usr/local/bin/tracker", "healthcheck"]
|
|
ENTRYPOINT ["/usr/local/bin/tracker"]
|
|
CMD ["serve"]
|