Spaces:
Runtime error
Runtime error
| # 1. Use an official lightweight Python runtime as a parent image | |
| FROM python:3.11-slim | |
| # 2. Set the working directory inside the container | |
| WORKDIR /app | |
| # 3. Copy the requirements file into the container at /app | |
| COPY requirements.txt . | |
| # 4. Install any needed packages specified in requirements.txt | |
| # --no-cache-dir keeps the image small | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # 5. Copy the rest of the application code | |
| COPY . . | |
| # 6. Create a non-root user (Required for Hugging Face Spaces) | |
| # This creates a user named "user" with ID 1000 | |
| RUN useradd -m -u 1000 user | |
| # 7. Switch to the new user | |
| USER user | |
| # 8. Set environment variables to ensure the user's home path works | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH | |
| # 9. Run the bot when the container launches | |
| CMD ["python", "bot.py"] | |