Dockerfile 941 B

12345678910111213141516171819202122232425262728293031323334
  1. # PCB AFM Simulation System - Backend Dockerfile
  2. FROM python:3.11-slim
  3. WORKDIR /app
  4. # Install system dependencies
  5. RUN apt-get update && apt-get install -y --no-install-recommends \
  6. gcc \
  7. && rm -rf /var/lib/apt/lists/*
  8. # Copy and install Python dependencies
  9. COPY web/backend/requirements.txt .
  10. RUN pip install --no-cache-dir -r requirements.txt
  11. # Copy application code
  12. COPY web/backend/ .
  13. # Create output directories
  14. RUN mkdir -p /app/output/tasks /app/output/reports /app/output/scheduler_state
  15. # Environment variables
  16. ENV DATABASE_URL=sqlite:///./afm_sim.db
  17. ENV MAX_PARALLEL_TASKS=2
  18. ENV PYTHONUNBUFFERED=1
  19. # Expose port
  20. EXPOSE 8000
  21. # Health check
  22. HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
  23. CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:8000/api/health')" || exit 1
  24. # Start application
  25. CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]