pyrtan / sourcev0.13.0 · main

pyrtan / Dockerfile

1,598 bytes · last changed 2026-10-27 in Drop "hardcoded" from the tagline; describe the trees as inspectable

1# Pyrtan: one image for a service or a hub. The command decides which.
2#
3# docker run -p 8701:8701 -v ./trees:/trees pyrtan serve /trees --host 0.0.0.0
4# docker run -p 8700:8700 pyrtan hub --host 0.0.0.0
5#
6# The examples are baked in at /examples so the image demos on its own.
7FROM python:3.12-slim AS build
8WORKDIR /src
9COPY pyproject.toml README.md LICENSE ./
10COPY src ./src
11RUN pip install --no-cache-dir --prefix=/install .
12
13FROM python:3.12-slim
14LABEL org.opencontainers.image.title="pyrtan" \
15 org.opencontainers.image.description="A core set of expandable services that act on all forms of I/O through inspectable decision trees." \
16 org.opencontainers.image.source="https://github.com/b-i-t-8/pyrtan" \
17 org.opencontainers.image.licenses="AGPL-3.0-or-later"
18COPY --from=build /install /usr/local
19COPY examples /examples
20# The build context keeps the host checkout's modes, which a NAS share
21# can leave unreadable to others; the non-root user must read the examples.
22RUN chmod -R a+rX /examples \
23 && useradd --system --uid 10001 --home /nonexistent --shell /usr/sbin/nologin pyrtan \
24 && mkdir -p /trees && chown pyrtan:pyrtan /trees
25USER pyrtan
26VOLUME ["/trees"]
27ENV PYTHONUNBUFFERED=1 PYRTAN_TREES=/trees
28EXPOSE 8700 8701
29HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 \
30 CMD python -c "import os,sys,urllib.request;p=os.environ.get('PYRTAN_PORT','8701');sys.exit(0 if urllib.request.urlopen(f'http://127.0.0.1:{p}/health',timeout=4).status==200 else 1)"
31ENTRYPOINT ["pyrtan"]
32CMD ["serve", "/examples", "--host", "0.0.0.0", "--port", "8701"]