File size: 979 Bytes
3eec113 c7b1ae2 f620980 3eec113 c7b1ae2 f620980 ca87c3c aa5a346 6c54971 f620980 ca87c3c 3eec113 933a887 6c54971 3eb1dea 6c54971 3eec113 3790034 |
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 |
# 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 \
&& 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 Python dependencies
RUN pip install --no-cache-dir --upgrade pip
RUN pip install --no-cache-dir -r requirements.txt
# Copy the current directory contents into the container
COPY . /app
# Expose the port that the FastAPI app runs on
EXPOSE 8001
# Environment variables (set your actual APP_SECRET securely)
# It's recommended to pass APP_SECRET at runtime rather than hardcoding it
# ENV APP_SECRET=your_app_secret_here
# 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"] |