Spaces:
Runtime error
Runtime error
# Use the official Python 3.9 image as a base image | |
FROM python:3.9 | |
# Create a new user with UID 1000 and switch to that user | |
RUN useradd -m -u 1000 user | |
USER user | |
# Update PATH to include local bin | |
ENV PATH="/home/user/.local/bin:$PATH" | |
# Set the working directory inside the container | |
WORKDIR /app | |
# Copy the requirements file into the container and install dependencies | |
COPY --chown=user ./requirements.txt requirements.txt | |
RUN pip install --no-cache-dir --upgrade -r requirements.txt | |
# Copy all project files into the container | |
COPY --chown=user . /app | |
# Expose the port that FastAPI will listen on (Hugging Face Spaces requires port 7860) | |
EXPOSE 7860 | |
# Start the FastAPI app using uvicorn, listening on port 7860 | |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] | |