FROM python:3.11-slim # Set working directory WORKDIR /app # Install system dependencies RUN apt-get update && apt-get install -y \ curl \ wget \ git \ && rm -rf /var/lib/apt/lists/* # Install Python ML dependencies RUN pip install --no-cache-dir \ torch \ transformers \ accelerate \ bitsandbytes \ huggingface_hub # Create directories for model and cache RUN mkdir -p /app/models /app/cache # Set environment variables ENV MODEL_NAME="ai/deepcoder-preview" ENV MODEL_VARIANT="14B-Q4_K_M" ENV HUGGINGFACE_HUB_CACHE="/app/cache" ENV TRANSFORMERS_CACHE="/app/cache" # Copy application files COPY requirements.txt . COPY app.py . COPY download_model.py . # Install Python dependencies RUN pip install --no-cache-dir -r requirements.txt # Expose port for API EXPOSE 8000 # Health check HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \ CMD curl -f http://localhost:8000/health || exit 1 # Run the application CMD ["python", "app.py"]