Spaces:
Build error
Build error
| # 1. Use an official Python runtime as a parent image | |
| FROM python:3.10-slim | |
| # 2. Set the working directory in the container | |
| WORKDIR /code | |
| # 3. Copy the dependencies file and install them | |
| # This is done in a separate step to leverage Docker's layer caching. | |
| # The dependencies will only be re-installed if requirements.txt changes. | |
| COPY ./requirements.txt /code/requirements.txt | |
| RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt | |
| # 4. Copy the rest of the application's code into the container | |
| COPY . /code/ | |
| # 5. Expose the port that the app will run on | |
| # Hugging Face Spaces expect the app to listen on port 7860 | |
| EXPOSE 7860 | |
| # 6. Define the command to run your app | |
| # This command starts the Uvicorn server which serves your FastAPI app. | |
| # --host 0.0.0.0 makes the server accessible from outside the container. | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] | |