# Reuse a reviewed image only when the locked Python dependencies are identical. # For a fresh installation use the repository's main Dockerfile instead. ARG BASE_IMAGE FROM ${BASE_IMAGE} AS prepared # Cleanup runs only in the disposable preparation stage. USER 0 COPY requirements.lock /app/requirements.expected.lock RUN python -c "from pathlib import Path; assert Path('/app/requirements.lock').read_bytes() == Path('/app/requirements.expected.lock').read_bytes(), 'Dependency lock changed; use the full Dockerfile'" COPY pigway_frame_flow /app/pigway_frame_flow COPY vendor /app/vendor # Publish only the cleaned filesystem, without retaining build-stage layers. RUN rm -rf /usr/local/lib/python*/site-packages/pip \ /usr/local/lib/python*/site-packages/pip-*.dist-info \ /usr/local/lib/python*/ensurepip \ && rm -f /usr/local/bin/pip /usr/local/bin/pip[0-9]* \ && find / -name .DS_Store -type f -delete FROM scratch COPY --from=prepared / / ENV PATH=/usr/local/bin:/usr/local/sbin:/usr/sbin:/usr/bin:/sbin:/bin LANG=C.UTF-8 ENV PYTHONDONTWRITEBYTECODE=1 PYTHONUNBUFFERED=1 TZ=Asia/Shanghai \ DATA_DIR=/data CONFIG_DIR=/config WORKDIR /app USER 10333:10333 EXPOSE 18787 HEALTHCHECK --interval=30s --timeout=5s --start-period=20s --retries=3 \ CMD python -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:18787/health',timeout=3)" CMD ["python", "-m", "uvicorn", "pigway_frame_flow.main:app", "--host", "0.0.0.0", "--port", "18787", "--workers", "1", "--no-access-log"] ARG BUILD_COMMIT ARG BUILD_TIME ENV BUILD_COMMIT=$BUILD_COMMIT BUILD_TIME=$BUILD_TIME LABEL org.opencontainers.image.title="Pigway Frame Flow" org.opencontainers.image.version="0.1.11" org.opencontainers.image.revision=$BUILD_COMMIT