Spaces:
Sleeping
Sleeping
Download Dockerfile from YADUUG/NPS-ChatAgentBot: direct link, hf CLI and curl.
- Browser
- Download file 1.96 kB
-
https://huggingface.co/spaces/YADUUG/NPS-ChatAgentBot/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/YADUUG/NPS-ChatAgentBot/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/YADUUG/NPS-ChatAgentBot/resolve/main/Dockerfile
1.96 kB
| # Use the official Python image with Playwright pre-installed (v1.49.0 on Ubuntu Noble) | |
| # This includes Python 3.12 which is required by nanobot-ai | |
| FROM mcr.microsoft.com/playwright/python:v1.49.0-noble | |
| # Set non-interactive mode for apt | |
| ENV DEBIAN_FRONTEND=noninteractive | |
| # The base image already has a user with UID 1000 (likely 'pwuser' or 'ubuntu'). | |
| # We will check or just use it ensuring permissions. | |
| # HF Spaces expects the app to run as user 1000. | |
| # Set working directory | |
| WORKDIR /app | |
| # Switch to root to install dependencies and system packages if needed | |
| USER root | |
| # Install system dependencies if any additional ones are needed (e.g. for some python packages) | |
| RUN apt-get update && apt-get install -y \ | |
| build-essential \ | |
| software-properties-common \ | |
| git \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Copy requirements first to leverage Docker cache | |
| COPY requirements.txt . | |
| # Install Python dependencies | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Install Playwright browsers (already in base image, but ensure they are available for the user) | |
| # The base image puts them in specific locations. | |
| # We run `playwright install chromium` just to be safe and ensure links are set up if needed by the python lib | |
| RUN playwright install chromium | |
| # Copy application code | |
| COPY . . | |
| # Adjust permissions for the user (using UID 1000) | |
| RUN chown -R 1000:1000 /app | |
| # Create necessary directories for the app (data, cache) and ensure permission | |
| # HF Spaces likes /data for persistent storage if configured, but we map it in code. | |
| # Here we just make sure our app directories are writable | |
| RUN mkdir -p /app/data /app/memory /tmp/cache /tmp/hf && \ | |
| chown -R 1000:1000 /app/data /app/memory /tmp/cache /tmp/hf | |
| # Switch to the non-root user | |
| USER 1000 | |
| # Expose the port | |
| EXPOSE 7860 | |
| # Define environment variables | |
| ENV PYTHONUNBUFFERED=1 | |
| ENV HOME=/app | |
| # Start the application | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] | |