# Use the official Python slim image | |
FROM python:3.9-slim | |
# Set the working directory inside the container | |
WORKDIR /app | |
# Install system dependencies | |
RUN apt-get update && apt-get install -y \ | |
build-essential \ | |
libffi-dev \ | |
libssl-dev \ | |
&& rm -rf /var/lib/apt/lists/* | |
# Copy the requirements file to the working directory | |
COPY requirements.txt /app | |
# Install Python dependencies | |
RUN pip install --no-cache-dir -r requirements.txt | |
# Copy the rest of the application code to the working directory | |
COPY . /app | |
# Expose the FastAPI default port | |
EXPOSE 8000 | |
# Command to run your application using Uvicorn | |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"] | |