Spaces:
Sleeping
Sleeping
Create Dockerfile
Browse files12345678910111213141516171819202122232425262728293031323334# 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 environment variablesENV PYTHONDONTWRITEBYTECODE 1 # Prevents python from writing .pyc filesENV PYTHONUNBUFFERED 1 # Ensures logs print directly to terminalENV PORT=7860 # Define the port the app will run on *inside* the container
# Set the working directory in the containerWORKDIR /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 containerCOPY requirements.txt .
# Install Python dependencies# --no-cache-dir reduces image sizeRUN pip install --no-cache-dir --upgrade pip && \ pip install --no-cache-dir -r requirements.txt
# Copy the rest of the application code into the containerCOPY . .
# Expose the port the app runs on# This informs Docker that the container listens on this portEXPOSE ${PORT}
# 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"]DockerfileAdded+34