Spaces:
Paused
Paused
| # ---------- builder ---------- | |
| FROM python:3.9-slim AS builder | |
| WORKDIR /build | |
| COPY app.py requirements.txt . | |
| RUN pip install --prefix=/install -r requirements.txt | |
| RUN python -m compileall -b -f app.py | |
| RUN tar -C /build -cf /build/app.tgz app.pyc | |
| # ---------- runtime ---------- | |
| FROM python:3.9-slim | |
| WORKDIR /app | |
| COPY --from=builder /install /usr/local/ | |
| COPY --from=builder /build/app.tgz ./app.tgz | |
| # entrypoint will unpack into /tmp, run, then delete | |
| COPY entrypoint.sh /entrypoint.sh | |
| RUN chmod +x /entrypoint.sh | |
| ENTRYPOINT ["/entrypoint.sh"] | |