# Stage 1: Build FROM python:3.9 as builder WORKDIR /code COPY ./requirements.txt /code/requirements.txt RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt # Copy only necessary files to the next stage COPY ./app /code/app # Stage 2: Run FROM python:3.9-slim-buster WORKDIR /app COPY --from=builder /code/app /app CMD ["python", "main.py", "--host", "0.0.0.0", "--port", "7860"]