library: Dockerfile fails loudly and verifies the image
A '|| true' at the end of the install chain swallowed any earlier failure, so a transient/blocked apt step produced a successful build with no Koha in it (found when an update rebuilt without the proxy CA). Steps are now separate, memcached and cron are installed explicitly, and a final step refuses to produce an image that is missing koha-create, memcached, cron, apache2ctl, zebrasrv, ... Quick Add's image verifies yaz and python3 the same way. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013wi3ZSot4XbUViwRFgLpRf
This commit is contained in:
+14
-4
@@ -19,16 +19,26 @@ RUN apt-get update \
|
|||||||
COPY certs/ /usr/local/share/ca-certificates/extra/
|
COPY certs/ /usr/local/share/ca-certificates/extra/
|
||||||
RUN update-ca-certificates
|
RUN update-ca-certificates
|
||||||
|
|
||||||
|
# Each step stands alone and fails the build on error: a swallowed failure here once produced a
|
||||||
|
# "successful" image with no Koha in it. memcached and cron are named explicitly rather than
|
||||||
|
# trusted to arrive as dependencies of koha-common.
|
||||||
RUN curl -fsSL https://debian.koha-community.org/koha/gpg.asc | gpg --dearmor -o /usr/share/keyrings/koha.gpg \
|
RUN curl -fsSL https://debian.koha-community.org/koha/gpg.asc | gpg --dearmor -o /usr/share/keyrings/koha.gpg \
|
||||||
&& echo "deb [signed-by=/usr/share/keyrings/koha.gpg] https://debian.koha-community.org/koha ${KOHA_SUITE} main bookworm" \
|
&& echo "deb [signed-by=/usr/share/keyrings/koha.gpg] https://debian.koha-community.org/koha ${KOHA_SUITE} main bookworm" \
|
||||||
> /etc/apt/sources.list.d/koha.list \
|
> /etc/apt/sources.list.d/koha.list \
|
||||||
&& apt-get update \
|
&& apt-get update \
|
||||||
&& apt-get install -y --no-install-recommends koha-common mariadb-client \
|
&& apt-get install -y --no-install-recommends koha-common mariadb-client memcached cron
|
||||||
&& a2enmod rewrite headers proxy_http cgi deflate >/dev/null \
|
|
||||||
&& a2dissite 000-default >/dev/null 2>&1 || true \
|
RUN a2enmod rewrite headers proxy_http cgi deflate >/dev/null \
|
||||||
&& if [ "$KEEP_TRANSLATIONS" != "yes" ]; then rm -rf /usr/share/koha/misc/translator/po; fi \
|
&& (a2dissite 000-default >/dev/null 2>&1 || true)
|
||||||
|
|
||||||
|
RUN if [ "$KEEP_TRANSLATIONS" != "yes" ]; then rm -rf /usr/share/koha/misc/translator/po; fi \
|
||||||
&& rm -rf /var/lib/apt/lists/* /usr/share/doc/*
|
&& rm -rf /var/lib/apt/lists/* /usr/share/doc/*
|
||||||
|
|
||||||
|
# Refuse to produce an image that cannot run.
|
||||||
|
RUN for c in koha-create koha-plack koha-zebra koha-rebuild-zebra koha-upgrade-schema apache2ctl memcached cron mariadb zebrasrv; do \
|
||||||
|
command -v "$c" >/dev/null || { echo "BUILD ERROR: $c is missing from the image" >&2; exit 1; }; \
|
||||||
|
done
|
||||||
|
|
||||||
COPY bootstrap.pl entrypoint.sh /opt/koha-init/
|
COPY bootstrap.pl entrypoint.sh /opt/koha-init/
|
||||||
COPY seed/ /opt/koha-init/seed/
|
COPY seed/ /opt/koha-init/seed/
|
||||||
RUN chmod 0755 /opt/koha-init/entrypoint.sh && chmod -R a+rX /opt/koha-init
|
RUN chmod 0755 /opt/koha-init/entrypoint.sh && chmod -R a+rX /opt/koha-init
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ RUN apt-get update \
|
|||||||
COPY certs/ /usr/local/share/ca-certificates/extra/
|
COPY certs/ /usr/local/share/ca-certificates/extra/
|
||||||
RUN update-ca-certificates
|
RUN update-ca-certificates
|
||||||
|
|
||||||
|
RUN command -v yaz-client >/dev/null && command -v yaz-marcdump >/dev/null && command -v python3 >/dev/null
|
||||||
|
|
||||||
RUN useradd --system --uid 10001 --home-dir /app quickadd \
|
RUN useradd --system --uid 10001 --home-dir /app quickadd \
|
||||||
&& mkdir -p /app /data && chown quickadd /data
|
&& mkdir -p /app /data && chown quickadd /data
|
||||||
COPY app.py index.html /app/
|
COPY app.py index.html /app/
|
||||||
|
|||||||
Reference in New Issue
Block a user