Spaces:
Sleeping
Sleeping
| # 1. Start with an official Python base image | |
| FROM python:3.10-slim | |
| # <<< THIS IS THE PERMANENT FIX >>> | |
| # As the ROOT user, create the /data directory and give ownership | |
| # to the standard non-root user (user ID 1000), which the app will run as. | |
| RUN mkdir -p /data && chown -R 1000:1000 /data | |
| # 2. Set the working directory for the application code | |
| WORKDIR /code | |
| # 3. Copy and install requirements | |
| COPY ./requirements.txt /code/requirements.txt | |
| RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt | |
| # 4. Copy the application code | |
| COPY ./main.py /code/ | |
| # 5. This command runs the server as the non-root user, which can now write to /data | |
| CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"] |