logging_bot / Dockerfile
AstraOS's picture
Update Dockerfile
a69ec7f verified
raw
history blame
905 Bytes
######################## builder stage ########################
FROM python:3.9-slim AS builder
WORKDIR /build
# --- install dependencies into /install ---
COPY requirements.txt .
RUN pip install --prefix=/install --no-cache-dir -r requirements.txt
# --- copy source and compile to byte-code ---
COPY app.py .
RUN python -m compileall -b -f app.py # produces /build/app.pyc
# --- pack the .pyc into a gzip tarball ---
RUN tar -C /build -czf /build/app.tgz app.pyc
######################## runtime stage ########################
FROM python:3.9-slim
WORKDIR /app
# 1) bring in site-packages from builder
COPY --from=builder /install /usr/local/
# 2) bring in the compressed payload only
COPY --from=builder /build/app.tgz ./app.tgz
# 3) entry-point that unpacks β†’ runs β†’ deletes
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
EXPOSE 7860
ENTRYPOINT ["/entrypoint.sh"]