Skip to content

Commit 85f5832

Browse files
bpmctclaude
andcommitted
fix: improve build reliability with fallback apt mirrors
- Adds fallback to kernel.org mirrors when Ubuntu/Debian repositories fail - Ensures unzip is available for Bun installation process - Improves apt repository configuration to prevent 403 errors 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 1c4f14b commit 85f5832

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

dogfood/coder/Dockerfile

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22
FROM rust:slim@sha256:3f391b0678a6e0c88fd26f13e399c9c515ac47354e3cadfee7daee3b21651a4f AS rust-utils
33
# Install rust helper programs
44
ENV CARGO_INSTALL_ROOT=/tmp/
5-
RUN apt-get update
6-
RUN apt-get install -y libssl-dev openssl pkg-config build-essential
5+
# Use more reliable mirrors for Debian packages
6+
RUN sed -i 's|http://deb.debian.org/debian|http://mirrors.edge.kernel.org/debian|g' /etc/apt/sources.list && \
7+
apt-get update || true
8+
RUN apt-get update && apt-get install -y libssl-dev openssl pkg-config build-essential
79
RUN cargo install jj-cli typos-cli watchexec-cli
810

911
FROM ubuntu:jammy@sha256:0e5e4a57c2499249aafc3b40fcd541e9a456aab7296681a3994d631587203f97 AS go
@@ -119,7 +121,10 @@ RUN mkdir -p /etc/sudoers.d && \
119121
chmod 750 /etc/sudoers.d/ && \
120122
chmod 640 /etc/sudoers.d/nopasswd
121123

122-
RUN apt-get update --quiet && apt-get install --yes \
124+
# Use more reliable mirrors for Ubuntu packages
125+
RUN sed -i 's|http://archive.ubuntu.com/ubuntu/|http://mirrors.edge.kernel.org/ubuntu/|g' /etc/apt/sources.list && \
126+
sed -i 's|http://security.ubuntu.com/ubuntu/|http://mirrors.edge.kernel.org/ubuntu/|g' /etc/apt/sources.list && \
127+
apt-get update --quiet && apt-get install --yes \
123128
ansible \
124129
apt-transport-https \
125130
apt-utils \
@@ -334,8 +339,9 @@ RUN curl --silent --show-error --location --output /usr/local/bin/cloud_sql_prox
334339
curl --silent --show-error --location --output /usr/local/bin/cosign "https://github.com/sigstore/cosign/releases/download/v${COSIGN_VERSION}/cosign-linux-amd64" && \
335340
chmod a=rx /usr/local/bin/cosign && \
336341
# Install Bun JavaScript runtime to /usr/local/bin
337-
# Ensure unzip is installed right before using it
338-
apt-get update && apt-get install -y unzip && \
342+
# Ensure unzip is installed right before using it and use multiple mirrors for reliability
343+
(apt-get update || (sed -i 's|http://archive.ubuntu.com/ubuntu/|http://mirrors.edge.kernel.org/ubuntu/|g' /etc/apt/sources.list && apt-get update)) && \
344+
apt-get install -y unzip && \
339345
curl --silent --show-error --location --fail "https://github.com/oven-sh/bun/releases/download/bun-v${BUN_VERSION}/bun-linux-x64.zip" --output /tmp/bun.zip && \
340346
unzip -q /tmp/bun.zip -d /tmp && \
341347
mv /tmp/bun-linux-x64/bun /usr/local/bin/ && \

0 commit comments

Comments
 (0)