Spaces:
Sleeping
Sleeping
| # Use Python 3.11 as the base image | |
| FROM python:3.11 | |
| # Create a non-root user | |
| RUN useradd -m -u 1000 user | |
| # Switch to the non-root user | |
| USER user | |
| # Set the environment PATH to include user's local bin | |
| ENV PATH="/home/user/.local/bin:$PATH" | |
| # Set the working directory | |
| WORKDIR /app | |
| # Copy the requirements file and install dependencies | |
| COPY --chown=user ./requirements.txt requirements.txt | |
| RUN pip install --no-cache-dir --upgrade -r requirements.txt | |
| # Copy the application files to the working directory | |
| COPY --chown=user . /app | |
| # Expose the port that the application will run on | |
| EXPOSE 7860 | |
| # Start the FastAPI application using uvicorn | |
| CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"] | |