30 lines
709 B
Docker
30 lines
709 B
Docker
FROM python:3.11-slim
|
|
|
|
# Set working directory
|
|
WORKDIR /app
|
|
|
|
# Install system dependencies
|
|
RUN apt-get update && apt-get install -y \
|
|
wget \
|
|
curl \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Copy requirements and install Python dependencies
|
|
COPY requirements-api.txt .
|
|
RUN pip install --no-cache-dir -r requirements-api.txt
|
|
|
|
# Copy application code
|
|
COPY api/ ./api/
|
|
|
|
# Set Python path
|
|
ENV PYTHONPATH=/app
|
|
|
|
# Expose port
|
|
EXPOSE 8000
|
|
|
|
# Health check
|
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \
|
|
CMD wget --quiet --tries=1 --spider http://localhost:8000/health || exit 1
|
|
|
|
# Run application
|
|
CMD ["python", "-m", "uvicorn", "api.main:app", "--host", "0.0.0.0", "--port", "8000"] |