FROM python:3.10-slim | |
# Set working directory | |
WORKDIR /app | |
# Install git and build tools | |
RUN apt-get update && \ | |
apt-get install -y git build-essential && \ | |
apt-get clean | |
# Install Python dependencies | |
COPY requirements.txt . | |
# Install dependencies for the current user (not system-wide) | |
RUN pip install --upgrade pip && \ | |
pip install --no-cache-dir --user -r requirements.txt | |
# Add user base binary directory to PATH (for --user installs) | |
ENV PATH="$PATH:/home/user/.local/bin" | |
# Copy application code | |
COPY app.py . | |
# Start the app | |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] | |