88e00e5d41
Introduce server-rendered guestbook and moderation portal. Persist data in SQLite (better-sqlite3); add WebAuthn YubiKey admin auth, rate-limiting, spam heuristics, and sanitization. Switch Docker image to run Node/standalone Astro (remove nginx), update docker-compose, Dockerfile, astro.config, and package.json. Add .env.example, docs/guestbook.md, gitignore updates, layouts, API routes, and supporting lib/components/pages for the feature.
45 lines
803 B
Docker
45 lines
803 B
Docker
# Stage 1: Build the Astro app
|
|
FROM node:20-alpine AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
# Install build dependencies for native modules (e.g. better-sqlite3)
|
|
RUN apk add --no-cache python3 make g++
|
|
|
|
COPY package*.json ./
|
|
RUN npm ci
|
|
|
|
COPY . .
|
|
RUN npm run build
|
|
|
|
# Stage 2: Install production dependencies only
|
|
FROM node:20-alpine AS deps
|
|
|
|
WORKDIR /app
|
|
|
|
RUN apk add --no-cache python3 make g++
|
|
|
|
COPY package*.json ./
|
|
RUN npm ci --omit=dev
|
|
|
|
# Stage 3: Runtime image
|
|
FROM node:20-alpine AS runtime
|
|
|
|
WORKDIR /app
|
|
|
|
# Data directory for SQLite database
|
|
RUN mkdir -p /data
|
|
|
|
COPY --from=builder /app/dist ./dist
|
|
COPY --from=deps /app/node_modules ./node_modules
|
|
COPY package*.json ./
|
|
|
|
ENV NODE_ENV=production
|
|
ENV HOST=0.0.0.0
|
|
ENV PORT=3000
|
|
ENV DB_PATH=/data/guestbook.db
|
|
|
|
EXPOSE 3000
|
|
|
|
CMD ["node", "dist/server/entry.mjs"]
|