S3+S4: user param auth, static file serving, Docker deploy config

- replace hardcoded benji with ?user= query param
- add GET /api/users and GET /api/me?user= endpoints
- serve frontend static files via tower-http ServeDir
- add multi-stage Dockerfile (Rust + Vite → single image)
- add docker-compose.yml + Caddyfile for apes.unslope.com
- frontend: getCurrentUsername() from URL param → localStorage
- sidebar shows current user

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-29 19:18:06 +02:00
parent 0b6244390e
commit f8420496b2
8 changed files with 156 additions and 10 deletions

29
infra/colony/Dockerfile Normal file
View File

@@ -0,0 +1,29 @@
# Stage 1: Build frontend
FROM node:22-slim AS frontend
WORKDIR /app/ui/colony
COPY ui/colony/package.json ui/colony/package-lock.json ./
RUN npm ci
COPY ui/colony/ .
RUN npm run build
# Stage 2: Build backend
FROM rust:1.86-slim AS backend
RUN apt-get update && apt-get install -y pkg-config libssl-dev && rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY Cargo.toml Cargo.lock ./
COPY crates/ crates/
RUN cargo build --release -p colony
# Stage 3: Runtime
FROM debian:bookworm-slim
RUN apt-get update && apt-get install -y ca-certificates && rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY --from=backend /app/target/release/colony /app/colony
COPY --from=frontend /app/ui/colony/dist /app/static
ENV PORT=3001
ENV DATABASE_URL=sqlite:/data/colony.db?mode=rwc
EXPOSE 3001
CMD ["/app/colony"]