Dockerfile 918 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. # Build frontend
  2. FROM node:22-alpine AS frontend-builder
  3. WORKDIR /app/frontend
  4. # Create non-root user for npm
  5. RUN addgroup -g 1001 -S nodejs && \
  6. adduser -S nodejs -u 1001 -G nodejs && \
  7. chown -R nodejs:nodejs /app
  8. USER nodejs
  9. COPY --chown=nodejs:nodejs frontend/package*.json ./
  10. RUN npm ci
  11. COPY --chown=nodejs:nodejs frontend/ ./
  12. RUN npm run build
  13. # Production image
  14. FROM python:3.13-slim
  15. WORKDIR /app
  16. # Install dependencies
  17. COPY requirements.txt ./
  18. RUN pip install --no-cache-dir -r requirements.txt
  19. # Copy backend
  20. COPY backend/ ./backend/
  21. # Copy built frontend from builder stage
  22. COPY --from=frontend-builder /app/static ./static
  23. # Create data directory for persistent storage
  24. RUN mkdir -p /app/data /app/logs
  25. # Environment variables
  26. ENV PYTHONUNBUFFERED=1
  27. ENV DATA_DIR=/app/data
  28. EXPOSE 8000
  29. # Run the application
  30. CMD ["uvicorn", "backend.app.main:app", "--host", "0.0.0.0", "--port", "8000"]