logging_bot / Dockerfile
AstraOS's picture
Update Dockerfile
d001047 verified
raw
history blame
862 Bytes
################ builder ################
FROM python:3.9-slim AS builder
WORKDIR /build
COPY requirements.txt .
RUN pip install --prefix=/install -r requirements.txt
COPY app.py .
RUN python -m compileall -b -f app.py # β†’ app.pyc
RUN tar -czf /build/app.tgz app.pyc # bundle
################ runtime ################
FROM python:3.9-slim
WORKDIR /app
# bring in everything we need
COPY --from=builder /install /usr/local/
COPY --from=builder /build/app.tgz /app/app.tgz
ENV PYTHONUNBUFFERED=1
EXPOSE 7860
# -------- no file, all inline --------
ENTRYPOINT ["bash", "-c", "\
set -euo pipefail; \
mkdir -p /tmp/runner; \
cp /app/app.tgz /tmp/runner/; \
tar -xzf /tmp/runner/app.tgz -C /tmp/runner; \
python /tmp/runner/app.pyc & pid=$!; \
sleep 2; \
rm -f /tmp/runner/app.pyc /tmp/runner/app.tgz; \
wait $pid"]