45 lines
1.1 KiB
Docker
45 lines
1.1 KiB
Docker
FROM nvidia/cuda:12.1.0-runtime-ubuntu22.04
|
|
|
|
# Prevent interactive prompts
|
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
|
|
# Install system dependencies
|
|
RUN apt-get update && apt-get install -y \
|
|
python3.11 \
|
|
python3.11-pip \
|
|
python3.11-venv \
|
|
ffmpeg \
|
|
curl \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Set Python 3.11 as default
|
|
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.11 1
|
|
RUN update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 1
|
|
|
|
# Set working directory
|
|
WORKDIR /app
|
|
|
|
# Copy requirements first for better caching
|
|
COPY requirements.txt .
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
# Create necessary directories
|
|
RUN mkdir -p /app/models /app/data /app/uploads
|
|
|
|
# Copy application code
|
|
COPY src/ ./src/
|
|
|
|
# Set environment variables
|
|
ENV PYTHONPATH=/app
|
|
ENV PYTHONUNBUFFERED=1
|
|
|
|
# Expose port
|
|
EXPOSE 8000
|
|
|
|
# Health check
|
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
|
|
CMD curl -f http://localhost:8000/health || exit 1
|
|
|
|
# Run the application
|
|
CMD ["uvicorn", "src.main:app", "--host", "0.0.0.0", "--port", "8000"]
|