Menggunakan Multi-stage Build pada Dockerfile
# Stage 1: Build
FROM python:3.9-slim-buster as builder
WORKDIR /app
COPY requirements.txt requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
RUN python setup.py build_ext --inplace
# Stage 2: Runtime
FROM python:3.9-slim-buster
WORKDIR /app
COPY --from=builder /app .
EXPOSE 5000
CMD ["python", "app.py"]Last updated