Spaces:
Running
Running
| # Dockerfile | |
| FROM python:3.10-slim | |
| # create non-root user (Spaces prefers UID 1000) | |
| RUN useradd -m -u 1000 appuser | |
| # copy files | |
| WORKDIR /app | |
| COPY . /app | |
| # install system deps if needed | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| build-essential git-lfs && \ | |
| rm -rf /var/lib/apt/lists/* | |
| # install python deps | |
| RUN pip install --upgrade pip | |
| RUN pip install --no-cache-dir -r /app/requirements.txt | |
| # expose the port Spaces expects | |
| ENV PORT=7860 | |
| EXPOSE 7860 | |
| # run uvicorn (app:app must be your FastAPI object) | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] | |