Files
vnctalk-prosody/Dockerfile
T
Stefan-Sanger e1c78e7358 feat: add pre-upgrade and post-upgrade DB migration hooks
Dockerfile: add postgresql-client and bake db-customization/ SQL scripts
into the image at /vnc/db-customization/.

config/migrate.sh: detection + migration script with two modes:
- pre-upgrade: runs idempotent prosody-13-new-deployment.sql on 13.0.x
  databases; skips 0.11.6 (unsafe pre-upgrade) and new deployments.
- post-upgrade: waits for Prosody table, then runs the appropriate
  scripts — full 0.11.6->13.0.6 migration (rules-triggers + migration-once
  + new-deployment) or idempotent drift correction for 13.0.x.

Helm chart: two Job templates (db-migration-pre-upgrade.yaml,
db-migration-post-upgrade.yaml) gated by dbMigration.enabled (default
true). Both reuse the Prosody image and DB credentials from existing
values. backoffLimit: 0, hook-delete-policy: hook-succeeded.

Also tracks the db-customization SQL files (previously untracked, now
referenced by the Dockerfile ADD).

Part-of: <http://gitlab.vnc.biz/uxf/vnctalk-prosody/-/merge_requests/3>
2026-07-15 17:59:09 +02:00

65 lines
2.5 KiB
Docker

FROM alpine:3.23.4 AS builder
RUN apk update && apk upgrade && \
apk add gettext lua5.4 lua5.4-socket lua5.4-dbi-postgresql lua5.4-expat lua5.4-sql-postgres \
lua5.4-filesize lua5.4-lpeg lua5.4-hiredis lua5.4-filesystem lua5.4-ldap \
lua5.4-sec lua5.4-lzlib lua5.4-cjson lua5.4-dev \
libidn-dev libidn icu icu-dev libpq postgresql-dev make gcc expat expat-dev \
libxmlb-dev libc-dev openssl openssl-dev htop nodejs nodejs-dev \
libc-dev g++ yarn nagios-plugins-tcp patch && \
rm -rf /var/cache/apk/*
ARG PROSODY_VERSION=13.0.6
ARG PROSODY_TARBALL_SHA256=ec696f9cf562c3af4a04b07d3fb36a1cedcc4e69a392fddcfc524bc67d93050f
# Download the Prosody source and verify its SHA256 so a tampered or corrupt
# download fails the build loudly instead of producing a broken image.
RUN wget -O prosody-${PROSODY_VERSION}.tar.gz https://prosody.im/downloads/source/prosody-${PROSODY_VERSION}.tar.gz && \
echo "${PROSODY_TARBALL_SHA256} prosody-${PROSODY_VERSION}.tar.gz" | sha256sum -c - && \
tar xzf prosody-${PROSODY_VERSION}.tar.gz && \
rm prosody-${PROSODY_VERSION}.tar.gz
ADD patches /vnc/patches
RUN cd prosody-${PROSODY_VERSION}/ && \
for p in /vnc/patches/*.patch; do patch -p1 --fuzz=0 < "$p"; done
# --idn-library=idn: 0.12+ defaults to ICU, but the runtime image ships no ICU
# data files (U_FILE_ACCESS_ERROR); stick with libidn as 0.11 did
RUN cd prosody-${PROSODY_VERSION}/ && ./configure --sysconfdir="/etc/prosody" --no-example-certs --idn-library=idn --lua-version=5.4 && \
make && make install
RUN mkdir -p /vnc && mkdir -p /var/run/prosody/ && \
mkdir -p /var/log/prosody/ && \
mkdir -p /etc/prosody/public && mkdir -p /etc/tls-update
RUN yarn global add http-server@14.1.1
FROM alpine:3.23.4
RUN apk update && apk upgrade && \
apk add gettext lua5.4 lua5.4-socket lua5.4-dbi-postgresql lua5.4-expat lua5.4-sql-postgres \
lua5.4-filesize lua5.4-lpeg lua5.4-hiredis lua5.4-filesystem lua5.4-ldap \
lua5.4-sec lua5.4-lzlib lua5.4-cjson \
libidn-dev libidn icu libpq postgresql-client expat \
openssl nodejs nagios-plugins-tcp && \
rm -rf /var/cache/apk/*
COPY --from=builder /usr/local/ /usr/local/
RUN mkdir /vnc && mkdir -p /var/log/prosody/ && \
mkdir -p /etc/prosody/public && mkdir -p /etc/tls-update
RUN addgroup -g 1001 prosody
RUN adduser -D -u 1001 -S -h /var/lib/prosody -H -G prosody prosody
ADD vnctalk /vnc/vnctalk
RUN cd /vnc/vnctalk && cp -Rp * /usr/local/lib/prosody/modules/
ADD config /vnc/config
ADD db-customization /vnc/db-customization
USER prosody
ENV __FLUSH_LOG=yes
CMD ["/vnc/config/startup.sh"]