Spaces:
Running
Running
| FROM python:3.13-slim | |
| # Install uv | |
| COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/ | |
| # Change the working directory to the `app` directory | |
| WORKDIR /app | |
| # Install dependencies (separate layer for better caching) | |
| RUN --mount=type=cache,target=/root/.cache/uv \ | |
| --mount=type=bind,source=uv.lock,target=uv.lock \ | |
| --mount=type=bind,source=pyproject.toml,target=pyproject.toml \ | |
| uv sync --locked --no-install-project | |
| # Copy the project into the image | |
| COPY . /app | |
| # Sync the project | |
| RUN --mount=type=cache,target=/root/.cache/uv \ | |
| uv sync --locked | |
| # Expose port 7860 for Hugging Face Spaces | |
| EXPOSE 7860 | |
| # Set port environment variable for Hugging Face Spaces | |
| ENV PORT=7860 | |
| # Set UV cache directory to writable location for non-root user | |
| ENV UV_CACHE_DIR=/app/.cache/uv | |
| # Create cache directory with proper permissions | |
| RUN mkdir -p /app/.cache/uv && chmod -R 777 /app/.cache | |
| # Run the server | |
| CMD ["uv", "run", "server.py"] | |