| # Get a distribution that has uv already installed | |
| FROM ghcr.io/astral-sh/uv:python3.13-bookworm-slim | |
| # Add user - this is the user that will run the app | |
| # If you do not set user, the app will run as root (undesirable) | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| # Set the home directory and path | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH | |
| # WebSocket and environment configuration | |
| ENV UVICORN_WS_PROTOCOL=websockets | |
| # Make logs more verbose for debugging | |
| ENV UVICORN_LOG_LEVEL=debug | |
| ENV CHAINLIT_LOG_LEVEL=debug | |
| # Set the working directory | |
| WORKDIR $HOME/app | |
| # Copy the app to the container | |
| COPY --chown=user . $HOME/app | |
| # Make launch script executable | |
| RUN chmod +x ./launch.sh | |
| # Install the dependencies | |
| RUN uv sync | |
| # Verify installed packages | |
| RUN python -m pip list | |
| # Expose the port - HF Spaces uses 7860 by default | |
| EXPOSE 7860 | |
| # Backend port | |
| EXPOSE 8000 | |
| # Run the app | |
| CMD ["sh", "-c", "uv run ./launch.sh"] | |