Some checks failed
Build and Push Docker Image / build (push) Has been cancelled
- Node.js/Express backend with TypeScript - SQLite database for users, sessions, and content metadata - Authentication with TOTP and WebAuthn MFA support - Admin user auto-created on first startup - User content gallery with view/delete functionality - RunPod API proxy (keeps API keys server-side) - Docker setup with CI/CD for Gitea registry 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
65 lines
1.3 KiB
Docker
65 lines
1.3 KiB
Docker
# Build stage
|
|
FROM node:22-alpine AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
# Install build dependencies for native modules (argon2, better-sqlite3)
|
|
RUN apk add --no-cache python3 make g++ sqlite-dev
|
|
|
|
# Copy package files
|
|
COPY package*.json ./
|
|
|
|
# Install all dependencies (including dev)
|
|
RUN npm ci
|
|
|
|
# Copy source
|
|
COPY tsconfig.json ./
|
|
COPY src/ ./src/
|
|
|
|
# Build TypeScript
|
|
RUN npm run build
|
|
|
|
# Prune dev dependencies
|
|
RUN npm prune --production
|
|
|
|
# Production stage
|
|
FROM node:22-alpine
|
|
|
|
WORKDIR /app
|
|
|
|
# Install runtime dependencies
|
|
RUN apk add --no-cache sqlite-libs
|
|
|
|
# Create non-root user
|
|
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
|
|
|
|
# Copy built files
|
|
COPY --from=builder /app/dist ./dist
|
|
COPY --from=builder /app/node_modules ./node_modules
|
|
COPY package*.json ./
|
|
|
|
# Copy public files
|
|
COPY public/ ./public/
|
|
|
|
# Copy database migrations
|
|
COPY src/db/migrations/ ./dist/db/migrations/
|
|
|
|
# Create data directory
|
|
RUN mkdir -p /app/data/content && chown -R appuser:appgroup /app/data
|
|
|
|
# Switch to non-root user
|
|
USER appuser
|
|
|
|
# Environment
|
|
ENV NODE_ENV=production
|
|
ENV DATA_DIR=/app/data
|
|
ENV PORT=3000
|
|
|
|
EXPOSE 3000
|
|
|
|
# Health check
|
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
|
CMD wget -q --spider http://localhost:3000/health || exit 1
|
|
|
|
CMD ["node", "dist/index.js"]
|