@@ -33,6 +33,19 @@ ARG S6_CHECKSUM_ALGORITHM="sha256"
3333ARG QJS_CHECKSUM_ALGORITHM="sha256"
3434
3535
36+ FROM debian:${DEBIAN_VERSION} AS tubesync-prepare-etc
37+
38+ COPY patches/ /var/tmp/patches/
39+ RUN --mount=type=tmpfs,target=/cache \
40+ set -eux && cd /var/tmp/patches/ && \
41+ ./fettle.pl --dry-run ./docker/tubesync-base/debconf.diff && \
42+ ./fettle.pl ./docker/tubesync-base/debconf.diff && \
43+ ./fettle.pl --clean ./docker/tubesync-base/debconf.diff
44+
45+ FROM scratch AS tubesync-etc
46+
47+ COPY --from=tubesync-prepare-etc /etc/ /etc/
48+
3649FROM debian:${DEBIAN_VERSION} AS tubesync-base
3750
3851ARG TARGETARCH
@@ -49,6 +62,8 @@ ENV DEBIAN_FRONTEND="noninteractive" \
4962 PIP_NO_COMPILE=1 \
5063 PIP_ROOT_USER_ACTION='ignore'
5164
65+ COPY --from=tubesync-etc /etc/debconf.conf /etc/debconf.conf
66+
5267RUN --mount=type=cache,id=apt-lib-cache-${TARGETARCH},sharing=private,target=/var/lib/apt \
5368 --mount=type=cache,id=apt-cache-cache,sharing=private,target=/var/cache/apt \
5469 # to be careful, ensure that these files aren't from a different architecture
@@ -59,7 +74,9 @@ RUN --mount=type=cache,id=apt-lib-cache-${TARGETARCH},sharing=private,target=/va
5974 # hopefully soon, this will be included in Debian images
6075 printf -- >| /etc/apt/apt.conf.d/docker-disable-pkgcache \
6176 'Dir::Cache::%spkgcache "";\n ' '' src ; \
62- chmod a+r /etc/apt/apt.conf.d/docker-disable-pkgcache ; \
77+ chmod a+r /etc/apt/apt.conf.d/docker-disable-pkgcache ; \
78+ # Create the directory for debconf
79+ mkdir -v /var/cache/debconf/docker-templates ; \
6380 set -x && \
6481 apt-get update && \
6582 # Install locales
@@ -70,8 +87,7 @@ RUN --mount=type=cache,id=apt-lib-cache-${TARGETARCH},sharing=private,target=/va
7087 locale-gen && \
7188 # Clean up
7289 apt-get -y autopurge && \
73- apt-get -y autoclean && \
74- rm -f /var/cache/debconf/*.dat-old
90+ apt-get -y autoclean
7591
7692FROM alpine:${ALPINE_VERSION} AS asfald-download
7793ARG ASFALD_VERSION
@@ -463,8 +479,7 @@ RUN --mount=type=cache,id=apt-lib-cache-${TARGETARCH},sharing=private,target=/va
463479 && \
464480 # Clean up
465481 apt-get -y autopurge && \
466- apt-get -y autoclean && \
467- rm -v -f /var/cache/debconf/*.dat-old
482+ apt-get -y autoclean
468483
469484FROM tubesync-openresty AS tubesync
470485
@@ -523,8 +538,7 @@ RUN --mount=type=cache,id=apt-lib-cache-${TARGETARCH},sharing=private,target=/va
523538 useradd -M -d /app -s /bin/false -g app app && \
524539 # Clean up
525540 apt-get -y autopurge && \
526- apt-get -y autoclean && \
527- rm -v -f /var/cache/debconf/*.dat-old
541+ apt-get -y autoclean
528542
529543# Install third party software
530544COPY --from=s6-overlay / /
@@ -549,8 +563,7 @@ RUN --mount=type=cache,id=apt-lib-cache-${TARGETARCH},sharing=private,target=/va
549563 apt-get -y autoremove --purge file && \
550564 # Clean up
551565 apt-get -y autopurge && \
552- apt-get -y autoclean && \
553- rm -v -f /var/cache/debconf/*.dat-old
566+ apt-get -y autoclean
554567
555568# Switch workdir to the the app
556569WORKDIR /app
@@ -639,7 +652,6 @@ RUN --mount=type=tmpfs,target=/cache \
639652 -exec du -h '{}' ';' \
640653 -exec ldd '{}' ';' \
641654 >| /cache/python-shared-objects 2>&1 && \
642- rm -v -f /var/cache/debconf/*.dat-old && \
643655 rm -v -rf /tmp/* ; \
644656 if grep >/dev/null -Fe ' => not found' /cache/python-shared-objects ; \
645657 then \
0 commit comments