Spaces:
mxrkai
/
Runtime error

test24 / Dockerfile
Niansuh's picture
Update Dockerfile
f620980 verified
raw
history blame
1.04 kB
# Use an official Python runtime as a parent image
FROM python:3.10-slim
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
libpq-dev \
gcc \
&& rm -rf /var/lib/apt/lists/*
# Set the working directory in the container
WORKDIR /app
# Copy only the requirements file to leverage Docker cache
COPY requirements.txt /app/
# Install any needed packages specified in requirements.txt
RUN pip install --no-cache-dir --upgrade pip
# Install gunicorn separately to capture any errors
RUN pip install --no-cache-dir gunicorn
# Install the rest of the requirements
RUN pip install --no-cache-dir -r requirements.txt
# Verify gunicorn installation
RUN which gunicorn
# Copy the current directory contents into the container
COPY . /app
# Expose the port that the FastAPI app runs on
EXPOSE 8001
# Command to run the app with Gunicorn and Uvicorn workers
CMD ["gunicorn", "-k", "uvicorn.workers.UvicornWorker", "--workers", "4", "--bind", "0.0.0.0:8001", "main:app"]