Really-amin's picture
Upload 313 files
78ba448 verified
raw
history blame
1.11 kB
# Use Python 3.11 Slim base image
FROM python:3.11-slim
# Set environment variables
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
PIP_NO_CACHE_DIR=1 \
PIP_DISABLE_PIP_VERSION_CHECK=1 \
ENABLE_AUTO_DISCOVERY=false
# Install system dependencies
RUN apt-get update && apt-get install -y \
gcc \
g++ \
curl \
&& rm -rf /var/lib/apt/lists/*
# Set working directory
WORKDIR /app
# Copy dependency files
COPY requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Copy application code
COPY . .
# Create necessary directories
RUN mkdir -p logs data data/exports data/backups
# Expose ports (Hugging Face uses PORT env variable, default 7860)
EXPOSE 7860 8000
# Health check (simplified to avoid requests dependency in healthcheck)
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
CMD curl -f http://localhost:${PORT:-8000}/health || exit 1
# Run server with uvicorn (supports Hugging Face PORT env variable)
CMD ["sh", "-c", "uvicorn api_server_extended:app --host 0.0.0.0 --port ${PORT:-8000}"]