Spaces:
Sleeping
Sleeping
# Use Python 3.11 as base image | |
FROM python:3.11-slim | |
# Create a non-root user to run the app | |
RUN useradd -m -u 1000 user | |
USER user | |
# Set environment variables | |
ENV PATH="/home/user/.local/bin:$PATH" | |
WORKDIR /app | |
# Copy requirements and install dependencies | |
COPY --chown=user requirements.txt ./requirements.txt | |
RUN pip install --no-cache-dir --upgrade pip && \ | |
pip install --no-cache-dir -r requirements.txt | |
# Copy the rest of the application code | |
COPY --chown=user . /app | |
# Default command to run the FastAPI app with uvicorn | |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] | |