FROM python:3.10-slim WORKDIR /app # Copy only requirements first to cache dependencies layer (faster rebuilds) COPY requirements.txt . # Install dependencies (only reruns if requirements.txt changes) RUN pip install --no-cache-dir -r requirements.txt # Copy source code (changes won’t invalidate cached dependencies) COPY . /app CMD ["python", "server.py"]