feat: The Other Dude v9.0.1 — full-featured email system

ci: add GitHub Pages deployment workflow for docs site

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Jason Staack
2026-03-08 17:46:37 -05:00
commit b840047e19
511 changed files with 106948 additions and 0 deletions

View File

@@ -0,0 +1,55 @@
# Multi-stage build for TOD API
# Stage 1: build — install Python deps
FROM python:3.12-slim AS builder
# Install system dependencies needed for asyncpg (libpq-dev) and cryptography
RUN apt-get update && apt-get install -y --no-install-recommends \
libpq-dev \
gcc \
build-essential \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /build
# Copy and install Python dependencies first (layer cache optimization)
COPY backend/pyproject.toml ./
# Create a minimal README.md so pip install doesn't fail (pyproject.toml references it)
RUN echo "# TOD API" > README.md
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir --prefix=/install .
# Stage 2: runtime — lean production image
FROM python:3.12-slim AS runtime
# Runtime system deps: libpq for asyncpg, pango/cairo/gdk-pixbuf for weasyprint PDF generation
RUN apt-get update && apt-get install -y --no-install-recommends \
libpq5 \
libpango-1.0-0 \
libpangocairo-1.0-0 \
libpangoft2-1.0-0 \
libcairo2 \
libgdk-pixbuf-2.0-0 \
libglib2.0-0 \
libffi8 \
&& rm -rf /var/lib/apt/lists/*
# Create a non-root user for security
RUN groupadd --gid 1001 appuser && \
useradd --uid 1001 --gid appuser --no-create-home appuser
WORKDIR /app
# Copy installed packages from builder
COPY --from=builder /install /usr/local
# Copy application source
COPY backend/ .
# Change ownership to non-root user
RUN chown -R appuser:appuser /app
USER appuser
EXPOSE 8000
CMD ["gunicorn", "app.main:app", "--config", "gunicorn.conf.py"]

View File

@@ -0,0 +1,39 @@
# Multi-stage build for TOD Frontend
# Stage 1: build — Node.js build environment
FROM node:18-alpine AS builder
# Cap Node.js heap to 512 MB so tsc + vite build don't OOM a low-RAM server.
# Vite's bundler defaults to using all available heap; on a 2-4 GB machine that
# competes directly with the Go and Python builds happening in parallel.
ENV NODE_OPTIONS="--max-old-space-size=1024"
WORKDIR /build
# Copy package files first (layer cache optimization)
COPY frontend/package.json frontend/package-lock.json* ./
# Install dependencies
RUN npm ci --ignore-scripts
# Copy frontend source and build
# Note: skip tsc type-check in Docker build (esbuild handles transpilation).
# Run `npm run build` locally or in CI for full type-checking.
COPY frontend/ .
RUN npx vite build
# Stage 2: runtime — nginx serving static SPA files
FROM nginx:alpine AS runtime
# Remove default nginx config
RUN rm /etc/nginx/conf.d/default.conf
# Custom nginx config for SPA routing (all routes -> index.html)
COPY infrastructure/docker/nginx-spa.conf /etc/nginx/conf.d/default.conf
# Copy built assets from builder stage
COPY --from=builder /build/dist /usr/share/nginx/html
# nginx runs as nginx user (non-root by convention)
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]

View File

@@ -0,0 +1,56 @@
server {
listen 80;
server_name _;
root /usr/share/nginx/html;
index index.html;
# Security headers (server-level -- inherited by all locations unless overridden)
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-XSS-Protection "0" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
add_header Permissions-Policy "camera=(), microphone=(), geolocation=()" always;
# CSP for React SPA with Tailwind CSS and Leaflet maps
# worker-src required for SRP key derivation Web Worker (Safari won't fall back to script-src)
add_header Content-Security-Policy "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data: https://*.tile.openstreetmap.org; font-src 'self'; connect-src 'self'; worker-src 'self'; frame-ancestors 'none'; base-uri 'self'; form-action 'self';" always;
# Proxy API requests to the backend service
# The api container is reachable via Docker internal DNS as "api" on port 8000
location /api/ {
proxy_pass http://api:8000/api/;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# Disable buffering for streaming/SSE endpoints
proxy_buffering off;
proxy_read_timeout 300s;
# Hide nginx server-level CSP — backend sets its own CSP on API responses
proxy_hide_header Content-Security-Policy;
}
# Serve static assets with long cache headers
# Note: add_header in a location block clears parent-block headers,
# so we re-add the essential security header for static assets.
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
expires 1y;
add_header Cache-Control "public, immutable" always;
add_header X-Content-Type-Options "nosniff" always;
try_files $uri =404;
}
# SPA routing: all other requests serve index.html
location / {
try_files $uri $uri/ /index.html;
}
# Health check endpoint for container probes
location /nginx-health {
access_log off;
return 200 "OK\n";
add_header Content-Type text/plain;
}
}