Skip to content

Commit

Permalink
more temurin attempt
Browse files Browse the repository at this point in the history
  • Loading branch information
Fallen-Breath committed Dec 29, 2023
1 parent 7a5e1c4 commit df5809a
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions src/Dockerfile-temurin
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,23 @@ RUN <<EOT
set -eux
export DEBIAN_FRONTEND="noninteractive"

# hopefully this fixes the random connection error issue
# https://github.com/adoptium/installer/issues/766#issuecomment-1856884963
cat <<EOF > /etc/apt/apt.conf.d/timeout_tweak.conf
Acquire::http::Timeout "30";
Acquire::http::ConnectionAttemptDelayMsec "2000";
Acquire::https::Timeout "30";
Acquire::https::ConnectionAttemptDelayMsec "2000";
Acquire::ftp::Timeout "30";
Acquire::ftp::ConnectionAttemptDelayMsec "2000";
Acquire::Retries "15";
EOF

apt-get update
apt-get install -y gnupg ca-certificates curl apt-transport-https
curl -so- https://packages.adoptium.net/artifactory/api/gpg/key/public | gpg --dearmor -o /etc/apt/trusted.gpg.d/adoptium.gpg
echo "deb https://packages.adoptium.net/artifactory/deb $(awk -F= '/^VERSION_CODENAME/{print$2}' /etc/os-release) main" | tee /etc/apt/sources.list.d/adoptium.list
curl -so- https://packages.adoptium.net/artifactory/api/gpg/key/public | tee /etc/apt/keyrings/adoptium.asc
echo "deb [signed-by=/etc/apt/keyrings/adoptium.asc] https://packages.adoptium.net/artifactory/deb $(awk -F= '/^VERSION_CODENAME/{print$2}' /etc/os-release) main" | tee /etc/apt/sources.list.d/adoptium.list
apt-get update
apt-get install -y "temurin-${JAVA}-jdk"
rm -rf /var/lib/apt/lists/* /etc/apt/apt.conf.d/timeout_tweak.conf

# The temurin source is currently very unstable, add more retries for it
# https://github.com/adoptium/installer/issues/766
set +e
for attempt in $(seq 1 10); do
if apt-get install -y "temurin-${JAVA}-jdk"; then
break
fi
echo "Install attempt #$attempt failed. Waiting 30 seconds for another attempt..."
sleep 30
done
set -e

rm -rf /var/lib/apt/lists/*
EOT

0 comments on commit df5809a

Please sign in to comment.