Spaces:
Running
Running
# Use an official Python runtime as a parent image | |
FROM python:3.10-slim | |
# Set the working directory in the container | |
WORKDIR /app | |
# Copy the requirements file into the container at /app | |
COPY requirements.txt . | |
# Install any needed system dependencies (if any - bs4, requests usually don't need much) | |
# RUN apt-get update && apt-get install -y --no-install-recommends some-package && rm -rf /var/lib/apt/lists/* | |
# For this bot, we likely don't need extra apt packages currently. | |
# Install Python dependencies | |
# Using --no-cache-dir reduces image size slightly | |
RUN pip install --no-cache-dir -r requirements.txt | |
# Copy the rest of the application code into the container at /app | |
COPY . . | |
# Make port 7860 available to the world outside this container | |
# Hugging Face Spaces typically expect apps to run on port 7860 | |
EXPOSE 7860 | |
# Define environment variable to ensure Python output is sent straight to logs | |
ENV PYTHONUNBUFFERED=1 | |
# Command to run the application using Gunicorn | |
# It will run the Flask 'app' object found in the 'main' module (main.py) | |
# Listen on all interfaces (0.0.0.0) on the port specified by HF (usually 7860) | |
CMD ["gunicorn", "--bind", "0.0.0.0:7860", "main:app"] |