Spaces:
Running
Running
# Use an official Python runtime as a parent image | |
# Using a specific version like 3.10 or 3.11 is recommended over 'latest' | |
FROM python:3.10-slim | |
# Set the working directory in the container | |
WORKDIR /app | |
# Install system dependencies if needed (e.g., build tools) - add if required later | |
# RUN apt-get update && apt-get install -y --no-install-recommends some-package && rm -rf /var/lib/apt/lists/* | |
# Copy the requirements file into the container | |
COPY requirements.txt . | |
# Install Python dependencies | |
# --no-cache-dir reduces image size | |
RUN pip install --no-cache-dir --upgrade pip && \ | |
pip install --no-cache-dir -r requirements.txt | |
# Copy the rest of the application code into the container | |
COPY . . | |
# Expose the port the app runs on | |
# This informs Docker that the container listens on this port | |
EXPOSE 7860 | |
# Define the command to run the application | |
# Use 0.0.0.0 to listen on all network interfaces inside the container | |
# Uvicorn will listen on the port defined by the $PORT env var (7860) | |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"] |