diff --git a/monitor/server/Dockerfile b/monitor/server/Dockerfile index 9716c58..4c487cf 100644 --- a/monitor/server/Dockerfile +++ b/monitor/server/Dockerfile @@ -1,62 +1,53 @@ # === STAGE 1: BUILDER (For installing uv and resolving/installing dependencies) === -FROM python:3.11-slim as builder -#USER root -WORKDIR /app - -# 1. Install uv as a standalone, fast package manager -# We use pipx to install it outside of the main environment -ENV PATH="/root/.local/bin:$PATH" -RUN pip install --upgrade pip \ - && pip install --no-cache-dir pipx \ - && pipx install uv +FROM python:3.14-slim as builder -# 2. install vim for quick edits directly on the image (for shell-mode only) -##RUN apt-get update && apt-get install -y --no-install-recommends vim-tiny \ -## && rm -rf /var/lib/apt/lists/* +# 1. Install uv as a standalone binary (prevents 'root' user pip warnings) +COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/ +USER root +WORKDIR /app -# 3. Use uv to create the production environment and install required modules -# 'uv venv' creates the venv; 'uv pip sync' installs locked dependencies fast -RUN uv venv --system-site-packages .venv && \ +# 3. Use uv to create the production environment +RUN uv venv .venv && \ . .venv/bin/activate && \ - uv pip install webpie pythreader jinja2 \ - uv clean - -# 4. copy local files as needed + uv pip install --no-cache-dir --python .venv/bin/python webpie pythreader jinja2 legacy-cgi +# 4. Prepare app environment as needed ADD start.sh /app/start.sh RUN mkdir app samples # === STAGE 2: RUNNER (The minimal, clean production image) === -FROM python:3.11-slim as runner +FROM python:3.14-slim as runner -# 1. Set the working directory +# 1. Setup environment WORKDIR /app +ENV PATH="/app/.venv/bin:$PATH" -# 2. Copy the *clean virtual environment* and application files from the builder stage +#### 2. Interactive mode only (to be removed for the production image): ###### +## Install vim for quick edits directly on the image (for shell-mode only debugging) +#RUN apt-get update && \ +# mkdir -p /usr/share/man/man1 && \ +# apt-get install -y -qq --no-install-recommends vim-tiny && \ +# rm -rf /var/lib/apt/lists/* +# +##.. test data from /var/cache/consistency-dump - usually not needed +#ADD reports /reports +####( END of section to be removed for production image )###### + +# 3. Copy the *clean virtual environment* and application files from the builder stage # This drastically reduces the size of the final image by excluding build tools and cache COPY --from=builder app /app/ - -ADD start.sh /root/start.sh -RUN mkdir -p /var/cache/consistency-dump /var/cache/consistency-temp /reports/unmerged ADD app ./app -###.. test data from /var/cache/consistency-dump - usually not needed -#ADD app/reports /reports - -RUN chmod +x *.sh - - -# 3. Ensure the virtual environment is used -ENV PATH="/app/.venv/bin:$PATH" - - -# 4. Define how the container starts +# 4. Final setup EXPOSE 8400 -ENTRYPOINT ["/root/start.sh"] +RUN mkdir -p /var/cache/consistency-dump /var/cache/consistency-temp /reports/unmerged \ + && chmod +x *.sh +# 5. Define how the container starts - enable EITHER (a) OR (b) +# a) For production mode: start app right away +ENTRYPOINT ["/app/start.sh"] -# 5. For interactive mode: comment out the ENTRYPOINT line above -#COPY --from=builder /usr/bin/vi /usr/bin/vi -CMD [ "/bin/bash", "--login" ] +# b) For interactive / testing mode: comment out the ENTRYPOINT line above +#CMD [ "/bin/bash", "--login" ] diff --git a/monitor/server/app/ce_index.html b/monitor/server/app/ce_index.html index f4a08a2..8de1593 100644 --- a/monitor/server/app/ce_index.html +++ b/monitor/server/app/ce_index.html @@ -144,6 +144,7 @@