Skip to content

Commit

Permalink
npm install 時のフェッチ回数とタムアウト時間を変更
Browse files Browse the repository at this point in the history
arm64 image のビルド失敗の回避のため
  • Loading branch information
l3tnun committed May 2, 2024
1 parent 0f3b2f1 commit 4c9f663
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
8 changes: 6 additions & 2 deletions Dockerfile.alpine
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
FROM --platform=$BUILDPLATFORM node:18-alpine AS client-builder
COPY client/package*.json /app/client/
WORKDIR /app/client
RUN npm config set fetch-retries 5
RUN npm config set fetch-retries 10 \
&& npm config set fetch-retry-mintimeout 100000 \
&& npm config set fetch-retry-maxtimeout 600000
RUN npm install --no-save --loglevel=info
COPY . /app/
RUN npm run build --loglevel=info
Expand All @@ -12,7 +14,9 @@ RUN apk add --no-cache g++ make pkgconf python3
WORKDIR /app
COPY package*.json /app/
ENV DOCKER="YES"
RUN npm config set fetch-retries 5
RUN npm config set fetch-retries 10 \
&& npm config set fetch-retry-mintimeout 100000 \
&& npm config set fetch-retry-maxtimeout 600000
RUN npm install --no-save --loglevel=info
COPY . .
RUN rm -rf client
Expand Down
8 changes: 6 additions & 2 deletions Dockerfile.debian
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
FROM --platform=$BUILDPLATFORM node:18-bookworm AS client-builder
COPY client/package*.json /app/client/
WORKDIR /app/client
RUN npm config set fetch-retries 5
RUN npm config set fetch-retries 10 \
&& npm config set fetch-retry-mintimeout 100000 \
&& npm config set fetch-retry-maxtimeout 600000
# どこで時間が掛かっているのか確認できるようにログレベルを変更。
RUN npm install --no-save --loglevel=info
# clientフォルダー外にビルドに必要なファイルが存在するため、全てコピーする。
Expand All @@ -26,7 +28,9 @@ RUN apt-get install -y build-essential python3
WORKDIR /app
COPY package*.json /app/
ENV DOCKER="YES"
RUN npm config set fetch-retries 5
RUN npm config set fetch-retries 10 \
&& npm config set fetch-retry-mintimeout 100000 \
&& npm config set fetch-retry-maxtimeout 600000
RUN npm install --no-save --loglevel=info
# 最終イメージのサイズ削減のため、すべてコピーした後でclientフォルダーを削除。clientフォルダー以外
# をコピーする方法は,ファイルが追加された場合に変更する必要があるため採用しない。
Expand Down

0 comments on commit 4c9f663

Please sign in to comment.