feat(deploy): docker image, caddy, compose, e2e script

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MMHQTtnQtQqL8muAXHr9kd
This commit is contained in:
2026-07-01 19:16:38 +07:00
parent 38005c0618
commit 1373aa0a77
12 changed files with 469 additions and 0 deletions
+29
View File
@@ -0,0 +1,29 @@
# syntax=docker/dockerfile:1
# 1) build web (React/Vite SPA)
FROM node:22-alpine AS web
WORKDIR /web
COPY web/package.json web/package-lock.json ./
RUN npm ci
COPY web/ ./
RUN npm run build
# 2) build go (embed web build via internal/httpapi/webdist)
FROM golang:1.24-alpine AS go
WORKDIR /src
COPY go.mod go.sum ./
RUN go mod download
COPY . .
# overwrite the committed webdist stub with the real SPA build
RUN rm -rf ./internal/httpapi/webdist
COPY --from=web /web/dist ./internal/httpapi/webdist
RUN CGO_ENABLED=0 go build -trimpath -o /out/server ./cmd/server
# 3) runtime
FROM alpine:3.20
RUN apk add --no-cache ca-certificates
WORKDIR /app
COPY --from=go /out/server /app/server
COPY migrations /app/migrations
EXPOSE 8080
ENTRYPOINT ["/app/server"]