Spaces:
Paused
Paused
File size: 488 Bytes
0dd8a54 e357eb4 0dd8a54 776a99b 0dd8a54 d30162a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
# ---------- stage 1: build ----------
FROM python:3.9-slim AS builder
WORKDIR /src
COPY . .
RUN pip install --prefix=/install --no-cache-dir -r requirements.txt
# optional: compile to .pyc or a zipapp
RUN python -m compileall -b app.py
# ---------- stage 2: runtime ----------
FROM python:3.9-slim
WORKDIR /app
# bring in only what you need
COPY --from=builder /install /usr/local
COPY --from=builder /src/app.pyc ./app.pyc
ENTRYPOINT ["python", "app.pyc"] |