Skip to content

Commit 8578ef7

Browse files
{  "message": "Bad credentials",  "documentation_url": "https://docs.github.com/rest",  "status": "401"}{  "message": "Bad credentials",  "documentation_url": "https://docs.github.com/rest",  "status": "401"}
authored andcommitted
ci: retry apt index refresh in generated dockerfiles
1 parent 7adcec8 commit 8578ef7

2 files changed

Lines changed: 28 additions & 2 deletions

File tree

packages/app/src/lib/core/templates/dockerfile.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,20 @@ const renderDockerfilePrelude = (): string =>
88
ENV DEBIAN_FRONTEND=noninteractive
99
ENV NVM_DIR=/usr/local/nvm
1010
11-
RUN apt-get update && apt-get install -y --no-install-recommends \
11+
RUN set -eu; \
12+
for attempt in 1 2 3 4 5; do \
13+
rm -rf /var/lib/apt/lists/*; \
14+
if apt-get -o Acquire::Retries=3 update; then \
15+
break; \
16+
fi; \
17+
if [ "$attempt" = "5" ]; then \
18+
echo "apt-get update failed after retries" >&2; \
19+
exit 1; \
20+
fi; \
21+
echo "apt-get update attempt \${attempt} failed; retrying..." >&2; \
22+
sleep $((attempt * 2)); \
23+
done; \
24+
apt-get -o Acquire::Retries=3 install -y --no-install-recommends \
1225
openssh-server git gh ca-certificates curl unzip bsdutils sudo \
1326
make docker.io docker-compose-v2 bash-completion zsh zsh-autosuggestions xauth \
1427
ncurses-term \

packages/lib/src/core/templates/dockerfile.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,20 @@ const renderDockerfilePrelude = (): string =>
77
ENV DEBIAN_FRONTEND=noninteractive
88
ENV NVM_DIR=/usr/local/nvm
99
10-
RUN apt-get update && apt-get install -y --no-install-recommends \
10+
RUN set -eu; \
11+
for attempt in 1 2 3 4 5; do \
12+
rm -rf /var/lib/apt/lists/*; \
13+
if apt-get -o Acquire::Retries=3 update; then \
14+
break; \
15+
fi; \
16+
if [ "$attempt" = "5" ]; then \
17+
echo "apt-get update failed after retries" >&2; \
18+
exit 1; \
19+
fi; \
20+
echo "apt-get update attempt \${attempt} failed; retrying..." >&2; \
21+
sleep $((attempt * 2)); \
22+
done; \
23+
apt-get -o Acquire::Retries=3 install -y --no-install-recommends \
1124
openssh-server git gh ca-certificates curl unzip bsdutils sudo \
1225
make docker.io docker-compose-v2 bash-completion zsh zsh-autosuggestions xauth \
1326
ncurses-term \

0 commit comments

Comments
 (0)