Spaces:
Paused
Paused
Update Dockerfile
Browse files12123456787891011121013141516131417181920212223242526272816172930311920# Use the official Python 3.9 slim imageFROM python:3.9-slim# Use the official Python image as the base imageFROM python:3.10-slim
# Set the working directory in the containerWORKDIR /app
# Copy the requirements.txt file into the containerCOPY requirements.txt .# Install system dependencies (e.g., for building wheel, working with requests, etc.)RUN apt-get update && apt-get install -y --no-install-recommends \ gcc \ libpq-dev \ && rm -rf /var/lib/apt/lists/*
# Install the dependencies specified in requirements.txt# Install Python dependenciesCOPY requirements.txt .RUN pip install --no-cache-dir -r requirements.txt
# Copy the entire application code into the containerCOPY . .# Copy the application code into the containerCOPY . /app/
# Expose the port the app will run onEXPOSE 80
# Set the environment variable for Python to run in optimized modeENV PYTHONUNBUFFERED 1
# Install Uvicorn and Gunicorn for serving the app with FastAPIRUN pip install uvicorn gunicorn
# Expose the port that FastAPI will useEXPOSE 8000# Start the FastAPI app using Gunicorn with the Uvicorn worker classCMD ["gunicorn", "-w", "4", "-k", "uvicorn.workers.UvicornWorker", "main:app_"]
# Start the FastAPI app with Gunicorn for better performanceCMD ["gunicorn", "app:app_", "--bind", "0.0.0.0:8000", "--log-level", "debug", "--access-logfile", "-"]Dockerfile+22-11