Dockerfile 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. # Build frontend
  2. FROM node:22-bookworm-slim AS frontend-builder
  3. WORKDIR /app/frontend
  4. COPY frontend/package*.json ./
  5. RUN npm ci
  6. COPY frontend/ ./
  7. RUN npm run build
  8. # Production image
  9. FROM python:3.13-slim
  10. WORKDIR /app
  11. # Install system dependencies
  12. ENV DEBIAN_FRONTEND=noninteractive
  13. RUN apt-get update && apt-get install -y --no-install-recommends \
  14. curl \
  15. ffmpeg \
  16. && rm -rf /var/lib/apt/lists/*
  17. # Install Python dependencies
  18. COPY requirements.txt ./
  19. RUN pip install --no-cache-dir --root-user-action=ignore -r requirements.txt
  20. # Copy backend
  21. COPY backend/ ./backend/
  22. # Copy built frontend from builder stage
  23. COPY --from=frontend-builder /app/static ./static
  24. # Create data directory for persistent storage
  25. RUN mkdir -p /app/data /app/logs
  26. # Environment variables
  27. ENV PYTHONUNBUFFERED=1
  28. ENV DATA_DIR=/app/data
  29. ENV LOG_DIR=/app/logs
  30. EXPOSE 8000
  31. # Health check
  32. HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=3 \
  33. CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')" || exit 1
  34. # Run the application
  35. CMD ["uvicorn", "backend.app.main:app", "--host", "0.0.0.0", "--port", "8000"]