docker: auto-detect image upgrades and include install stage

Without version tracking, if a new image requires the install stage
(e.g. new package versions), the default configure,activate will skip
it and potentially fail silently.

At build time, the git hash is written to /etc/chatmail-image-version.
At runtime, setup_chatmail_docker.sh compares it against the persisted
/home/.chatmail-running-version (survives container restarts via the
/home volume). If they differ, the install stage is automatically
prepended to CMDEPLOY_STAGES. After a successful deploy, the running
version is updated.

Files: docker/chatmail_relay.dockerfile:68-69, docker/files/setup_chatmail_docker.sh:27-48
This commit is contained in:
j4n
2026-02-16 20:17:03 +01:00
parent f017f88901
commit 77dc67dde9
2 changed files with 28 additions and 1 deletions

View File

@@ -61,6 +61,9 @@ RUN CMDEPLOY_STAGES=install \
RUN cp -a www/ /opt/chatmail-www/
RUN rm -f /tmp/chatmail.ini
# Record image version for upgrade detection at runtime
RUN git rev-parse HEAD > /etc/chatmail-image-version 2>/dev/null || echo "unknown" > /etc/chatmail-image-version
# --- End build-time install ---
ENV CHATMAIL_INI=/etc/chatmail/chatmail.ini