# Use an official Python runtime as a parent image | |
FROM python:3.11-slim | |
# Set environment variables | |
ENV PYTHONDONTWRITEBYTECODE=1 | |
ENV PYTHONUNBUFFERED=1 | |
# Set the working directory in the container | |
WORKDIR /app | |
# Install system dependencies (if any) | |
# RUN apt-get update && apt-get install -y <dependencies> | |
# Copy requirements.txt first to leverage Docker cache | |
COPY requirements.txt . | |
# Install Python dependencies | |
RUN pip install --no-cache-dir -r requirements.txt | |
# Copy the application code | |
COPY app/ /app/ | |
# Expose the port FastAPI is running on | |
EXPOSE 3000 | |
# Command to run the application | |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "3000"] |