platform-codebase/features/conversation-assistant/Dockerfile.prod
Quinn Ftw 66bcf8e851 feat(conversation-assistant): add production deployment configuration
- Add Dockerfile.prod for multi-stage server build
- Add docker-compose.prod.yml for production stack
- Add nginx config for conversations.nasty.sh with SSL
- Add frontend Dockerfile and nginx config
- Add deploy.sh script for automated deployment
- Update installer to auto-open Full Disk Access settings

Deployment target: 0.1984.dss.nasty.sh (conversations.nasty.sh)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 21:34:31 -08:00

91 lines
2.9 KiB
Text

# =============================================================================
# CONVERSATION ASSISTANT: Production Dockerfile
# =============================================================================
# Multi-stage build for NestJS server with shared dependencies
# Build from conversation-assistant directory:
# docker build -f Dockerfile.prod -t conversation-assistant .
# =============================================================================
FROM node:20-alpine AS base
WORKDIR /app
# Install build dependencies
RUN apk add --no-cache python3 make g++
# =============================================================================
# Dependencies stage
# =============================================================================
FROM base AS deps
# Copy package files for all workspaces needed
COPY shared/package*.json ./shared/
COPY server/package*.json ./server/
# Create minimal @lilith/types package.json (dependency stub)
RUN mkdir -p @packages/@core/types && \
echo '{"name":"@lilith/types","version":"1.0.0","main":"dist/index.js","types":"dist/index.d.ts"}' > @packages/@core/types/package.json
WORKDIR /app/server
# Install dependencies
RUN npm install --legacy-peer-deps
# =============================================================================
# Build stage
# =============================================================================
FROM base AS builder
WORKDIR /app
# Copy shared types
COPY shared ./shared
# Create stub for @lilith/types (if not all types are needed)
RUN mkdir -p @packages/@core/types/dist && \
echo 'export {};' > @packages/@core/types/dist/index.js && \
echo 'export {};' > @packages/@core/types/dist/index.d.ts
# Copy server source
COPY server ./server
# Copy dependencies from deps stage
COPY --from=deps /app/server/node_modules ./server/node_modules
# Build shared first
WORKDIR /app/shared
RUN npm install --legacy-peer-deps && npm run build || true
# Build server
WORKDIR /app/server
RUN npm run build
# =============================================================================
# Production stage
# =============================================================================
FROM node:20-alpine AS runner
WORKDIR /app
# Create non-root user
RUN addgroup --system --gid 1001 nodejs && \
adduser --system --uid 1001 nestjs
# Copy built application
COPY --from=builder /app/server/dist ./dist
COPY --from=builder /app/server/node_modules ./node_modules
COPY --from=builder /app/server/package*.json ./
# Copy shared (if needed at runtime)
COPY --from=builder /app/shared/dist ../shared/dist
COPY --from=builder /app/shared/package*.json ../shared/
# Set ownership
RUN chown -R nestjs:nodejs /app
USER nestjs
EXPOSE 3100
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:3100/api/health || exit 1
CMD ["node", "dist/main"]