# Use the official lightweight Python image as the base FROM python:3.9-slim # Set environment variables to prevent Python from buffering outputs ENV PYTHONDONTWRITEBYTECODE 1 ENV PYTHONUNBUFFERED 1 # Set the working directory inside the container WORKDIR /app # Install system dependencies (optional, adjust as needed) RUN apt-get update && apt-get install -y \ gcc \ libpq-dev \ && rm -rf /var/lib/apt/lists/* # Copy the requirements file into the container COPY requirements.txt /app/ # Install Python dependencies RUN pip install --no-cache-dir -r requirements.txt # Copy the application code into the container COPY . /app/ # Expose the port FastAPI will run on EXPOSE 7860 # Command to run the FastAPI application CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]