Skip to content

Commit 682b21a

Browse files
committed
fix(docker): improve build robustness and suppress locale warnings
- Generate en_US.UTF-8 locale to prevent setlocale warnings at startup - Add retry loop (5 attempts) for npm global installs to handle flaky network - Verify CLI tools by invoking binaries directly instead of npm list - Add set -eux for stricter error handling in user npm install step
1 parent dc9d3a6 commit 682b21a

1 file changed

Lines changed: 25 additions & 2 deletions

File tree

Dockerfile

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
3333
procps psmisc zsh socat \
3434
libevent-dev libncurses-dev bison
3535

36+
# Prevent noisy setlocale warnings at shell startup
37+
RUN sed -i 's/^# *en_US\.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
38+
locale-gen en_US.UTF-8 && \
39+
update-locale LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8
40+
3641
RUN git lfs install --system
3742

3843
# Install language runtimes in parallel-friendly layers
@@ -72,7 +77,20 @@ ARG COPILOT_API_VERSION
7277
LABEL org.opencontainers.image.copilot_api_version=${COPILOT_API_VERSION}
7378

7479
RUN --mount=type=cache,target=/root/.npm,sharing=locked \
75-
npm install -g npm@latest pnpm && \
80+
set -eu && \
81+
i=0 && \
82+
while :; do \
83+
i=$((i + 1)) && \
84+
if npm install -g npm@latest pnpm; then \
85+
break; \
86+
fi; \
87+
if [ "$i" -ge 5 ]; then \
88+
echo "npm install failed after $i attempts" >&2; \
89+
exit 1; \
90+
fi; \
91+
echo "npm install failed (attempt $i), retrying..." >&2; \
92+
sleep $((i * 5)); \
93+
done && \
7694
git clone --branch "${COPILOT_API_BRANCH}" "${COPILOT_API_REPO}" /tmp/copilot-api && \
7795
cd /tmp/copilot-api && \
7896
git checkout "${COPILOT_API_COMMIT}" && \
@@ -202,14 +220,19 @@ LABEL org.opencontainers.image.gemini_cli_version=${GEMINI_CLI_VERSION}
202220

203221
# Install CLI tools via npm
204222
RUN --mount=type=cache,target=/home/deva/.npm,uid=${DEVA_UID},gid=${DEVA_GID},sharing=locked \
223+
set -eux && \
205224
npm config set prefix "$DEVA_HOME/.npm-global" && \
206225
npm install -g --no-audit --no-fund \
207226
@anthropic-ai/claude-code@${CLAUDE_CODE_VERSION} \
208227
@mariozechner/claude-trace \
209228
@openai/codex@${CODEX_VERSION} \
210229
@google/gemini-cli@${GEMINI_CLI_VERSION} && \
211230
npm cache clean --force && \
212-
npm list -g --depth=0 @anthropic-ai/claude-code @openai/codex @google/gemini-cli || true
231+
"$DEVA_HOME/.npm-global/bin/claude" --version && \
232+
"$DEVA_HOME/.npm-global/bin/codex" --version && \
233+
"$DEVA_HOME/.npm-global/bin/gemini" --version && \
234+
"$DEVA_HOME/.npm-global/bin/claude-trace" --help >/dev/null && \
235+
(npm list -g --depth=0 @anthropic-ai/claude-code @openai/codex @google/gemini-cli || true)
213236

214237
# Volatile packages: Install at the end to avoid cascading rebuilds
215238
ARG ATLAS_CLI_VERSION=main

0 commit comments

Comments
 (0)