Spaces:
Paused
Paused
File size: 900 Bytes
528b0d1 07520e6 db18de0 e87960a 07520e6 528b0d1 f900222 528b0d1 e87960a 07520e6 528b0d1 07520e6 528b0d1 fbcbeea | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | # Use the official Python image as the base image
FROM python:3.10-slim
# Set the working directory in the container
WORKDIR /app
# 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 Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy the application code into the container
COPY . /app/
# Expose the port the app will run on
EXPOSE 80
# Set the environment variable for Python to run in optimized mode
ENV PYTHONUNBUFFERED 1
# Install Uvicorn and Gunicorn for serving the app with FastAPI
RUN pip install uvicorn gunicorn
# Start the FastAPI app using Gunicorn with the Uvicorn worker class
CMD ["gunicorn", "-w", "4", "-k", "uvicorn.workers.UvicornWorker", "main:app"]
|