Skip to content

Commit b4adfb7

Browse files
committed
build(base-image): make apt install resilient to transient mirror failures
ubuntu:24.04 ships no apt retry config (default is 0 retries), so a single dropped connection to the Ubuntu mirrors fails the whole base-image build. Recent flake: appsmith-ee run 34570186320 (IPv6 unreachable + IPv4 timeouts to archive.ubuntu.com), and a same-SHA run failed then passed on 2026-09-05. - Add a build-scoped apt drop-in (Acquire::Retries 3 + http/https Timeout 30s), removed in the same layer's cleanup so the shipped image is unchanged. - Add --retry/--retry-connrefused/--connect-timeout/--retry-max-time to the MongoDB and PostgreSQL GPG-key curls; add --fail to the PostgreSQL one so an HTTP error body is never piped into apt-key. Reduces flake frequency for transient mirror blips; does not rescue a sustained egress outage. CE-only: apt block is byte-identical CE/EE, sync carries to EE. Linear: APP-15960
1 parent fc8916f commit b4adfb7

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

deploy/docker/base.dockerfile

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ ENV LC_ALL=C.UTF-8
5252

5353
# Install dependency packages
5454
RUN set -o xtrace \
55+
# Make apt resilient to transient Ubuntu-mirror connection failures on the build
56+
# host. ubuntu:24.04 ships no retry config (apt default is 0 retries), so a single
57+
# dropped connection fails the whole build. This drop-in is build-scoped: it is
58+
# removed in the cleanup step below, so the shipped image's apt behavior is
59+
# unchanged. Does not rescue a sustained egress outage, only transient blips. APP-15960.
60+
&& printf 'Acquire::Retries "3";\nAcquire::http::Timeout "30";\nAcquire::https::Timeout "30";\n' > /etc/apt/apt.conf.d/80-appsmith-retries \
5561
&& apt-get update \
5662
&& apt-get upgrade --yes \
5763
&& DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends --yes \
@@ -64,10 +70,10 @@ RUN set -o xtrace \
6470
&& add-apt-repository -y ppa:git-core/ppa \
6571
# Install MongoDB v7, PostgreSQL v14
6672
# Note: MongoDB 7.0 does not publish apt packages for Ubuntu 24.04 (noble) yet, so we use the jammy (22.04) packages — same pattern used for the previous 6.0 install.
67-
&& curl -fsSL https://www.mongodb.org/static/pgp/server-7.0.asc | gpg --dearmor -o /usr/share/keyrings/mongodb-server-7.0.gpg \
73+
&& curl --retry 3 --retry-connrefused --connect-timeout 15 --retry-max-time 60 -fsSL https://www.mongodb.org/static/pgp/server-7.0.asc | gpg --dearmor -o /usr/share/keyrings/mongodb-server-7.0.gpg \
6874
&& echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-7.0.gpg ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/7.0 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-7.0.list \
6975
&& echo "deb http://apt.postgresql.org/pub/repos/apt $(grep CODENAME /etc/lsb-release | cut -d= -f2)-pgdg main" | tee /etc/apt/sources.list.d/pgdg.list \
70-
&& curl --silent --show-error --location https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \
76+
&& curl --fail --retry 3 --retry-connrefused --connect-timeout 15 --retry-max-time 60 --silent --show-error --location https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \
7177
&& apt update \
7278
&& DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends --yes \
7379
mongodb-org-server mongodb-org-mongos mongodb-mongosh \
@@ -87,6 +93,7 @@ RUN set -o xtrace \
8793
/usr/share/doc \
8894
/usr/share/man \
8995
/var/lib/apt/lists/* \
96+
/etc/apt/apt.conf.d/80-appsmith-retries \
9097
/tmp/*
9198

9299
# Install Redis from official image to avoid false positive CVE reports from dpkg-based scanners.

0 commit comments

Comments
 (0)