Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 22 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,19 @@ ARG S6_CHECKSUM_ALGORITHM="sha256"
ARG QJS_CHECKSUM_ALGORITHM="sha256"


FROM debian:${DEBIAN_VERSION} AS tubesync-prepare-etc

COPY patches/ /var/tmp/patches/
RUN --mount=type=tmpfs,target=/cache \
set -eux && cd /var/tmp/patches/ && \
./fettle.pl --dry-run ./docker/tubesync-base/debconf.diff && \
./fettle.pl ./docker/tubesync-base/debconf.diff && \
./fettle.pl --clean ./docker/tubesync-base/debconf.diff

FROM scratch AS tubesync-etc

COPY --from=tubesync-prepare-etc /etc/ /etc/

FROM debian:${DEBIAN_VERSION} AS tubesync-base

ARG TARGETARCH
Expand All @@ -49,6 +62,8 @@ ENV DEBIAN_FRONTEND="noninteractive" \
PIP_NO_COMPILE=1 \
PIP_ROOT_USER_ACTION='ignore'

COPY --from=tubesync-etc /etc/debconf.conf /etc/debconf.conf

RUN --mount=type=cache,id=apt-lib-cache-${TARGETARCH},sharing=private,target=/var/lib/apt \
--mount=type=cache,id=apt-cache-cache,sharing=private,target=/var/cache/apt \
# to be careful, ensure that these files aren't from a different architecture
Expand All @@ -59,7 +74,9 @@ RUN --mount=type=cache,id=apt-lib-cache-${TARGETARCH},sharing=private,target=/va
# hopefully soon, this will be included in Debian images
printf -- >| /etc/apt/apt.conf.d/docker-disable-pkgcache \
'Dir::Cache::%spkgcache "";\n' '' src ; \
chmod a+r /etc/apt/apt.conf.d/docker-disable-pkgcache ; \
chmod a+r /etc/apt/apt.conf.d/docker-disable-pkgcache ; \
# Create the directory for debconf
mkdir -v /var/cache/debconf/docker-templates ; \
set -x && \
# When a new release is out but the debian image hasn't
# updated yet, upgrades cause more wasted space than
Expand All @@ -81,8 +98,7 @@ RUN --mount=type=cache,id=apt-lib-cache-${TARGETARCH},sharing=private,target=/va
locale-gen && \
# Clean up
apt-get -y autopurge && \
apt-get -y autoclean && \
rm -f /var/cache/debconf/*.dat-old
apt-get -y autoclean

FROM alpine:${ALPINE_VERSION} AS asfald-download
ARG ASFALD_VERSION
Expand Down Expand Up @@ -474,8 +490,7 @@ RUN --mount=type=cache,id=apt-lib-cache-${TARGETARCH},sharing=private,target=/va
&& \
# Clean up
apt-get -y autopurge && \
apt-get -y autoclean && \
rm -v -f /var/cache/debconf/*.dat-old
apt-get -y autoclean

FROM tubesync-openresty AS tubesync

Expand Down Expand Up @@ -534,8 +549,7 @@ RUN --mount=type=cache,id=apt-lib-cache-${TARGETARCH},sharing=private,target=/va
useradd -M -d /app -s /bin/false -g app app && \
# Clean up
apt-get -y autopurge && \
apt-get -y autoclean && \
rm -v -f /var/cache/debconf/*.dat-old
apt-get -y autoclean

# Install third party software
COPY --from=s6-overlay / /
Expand All @@ -560,8 +574,7 @@ RUN --mount=type=cache,id=apt-lib-cache-${TARGETARCH},sharing=private,target=/va
apt-get -y autoremove --purge file && \
# Clean up
apt-get -y autopurge && \
apt-get -y autoclean && \
rm -v -f /var/cache/debconf/*.dat-old
apt-get -y autoclean

# Switch workdir to the the app
WORKDIR /app
Expand Down Expand Up @@ -644,7 +657,6 @@ RUN --mount=type=tmpfs,target=/cache \
-exec du -h '{}' ';' \
-exec ldd '{}' ';' \
>| /cache/python-shared-objects 2>&1 && \
rm -v -f /var/cache/debconf/*.dat-old && \
rm -v -rf /tmp/* ; \
if grep >/dev/null -Fe ' => not found' /cache/python-shared-objects ; \
then \
Expand Down
28 changes: 28 additions & 0 deletions patches/docker/tubesync-base/debconf.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
--- /etc/debconf.conf.orig 2025-03-10 12:07:15.000000000 +0000
+++ /etc/debconf.conf 2026-03-01 12:49:05.110194306 +0000
@@ -33,13 +33,23 @@
Driver: Stack
Stack: config, passwords

-# Set up the templatedb database, which is a single flat text file
+# Set up the templates database, which is a single flat text file
# by default.
-Name: templatedb
+Name: templates
Driver: File
Mode: 644
+Readonly: true
Filename: /var/cache/debconf/templates.dat

+Name: docker-templates
+Driver: PackageDir
+Mode: 644
+Directory: /var/cache/debconf/docker-templates
+
+Name: templatedb
+Driver: Stack
+Stack: docker-templates, templates
+
# Well that was pretty straightforward, and it will be enough for most
# people's needs, but debconf's database drivers can be used to do much
# more interesting things. For example, suppose you want to use config
Loading