Spaces:
Sleeping
Sleeping
| FROM python:3.11-slim-bookworm | |
| # Set working directory | |
| WORKDIR /app | |
| # Install uv | |
| RUN pip install --no-cache-dir uv | |
| # Copy dependency files | |
| COPY pyproject.toml uv.lock README.md ./ | |
| # Copy application code | |
| COPY app ./app | |
| # Install dependencies | |
| # --frozen: use exact versions from uv.lock | |
| # --no-dev: do not install development dependencies | |
| RUN uv sync --frozen --no-dev | |
| # Set environment variables | |
| # Add the virtual environment to PATH | |
| ENV PATH="/app/.venv/bin:$PATH" | |
| ENV HOST=0.0.0.0 | |
| # Expose the port (Hugging Face typically uses 7860, local uses 8000) | |
| ENV PORT=7860 | |
| EXPOSE $PORT | |
| # Command to run the application (using shell form to expand variables) | |
| CMD ["sh", "-c", "uvicorn app.main:app --loop asyncio --host 0.0.0.0 --port $PORT"] |