diff --git a/docker-compose.yml b/docker-compose.yml index eabce3e4..726338fe 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -91,6 +91,10 @@ services: - NVM_NODEJS_ORG_MIRROR=${WORKSPACE_NVM_NODEJS_ORG_MIRROR} - INSTALL_NODE=${WORKSPACE_INSTALL_NODE} - NPM_REGISTRY=${WORKSPACE_NPM_REGISTRY} + - NPM_FETCH_RETRIES=${WORKSPACE_NPM_FETCH_RETRIES} + - NPM_FETCH_RETRY_FACTOR=${WORKSPACE_NPM_FETCH_RETRY_FACTOR} + - NPM_FETCH_RETRY_MINTIMEOUT=${WORKSPACE_NPM_FETCH_RETRY_MINTIMEOUT} + - NPM_FETCH_RETRY_MAXTIMEOUT=${WORKSPACE_NPM_FETCH_RETRY_MAXTIMEOUT} - INSTALL_PNPM=${WORKSPACE_INSTALL_PNPM} - INSTALL_YARN=${WORKSPACE_INSTALL_YARN} - INSTALL_NPM_GULP=${WORKSPACE_INSTALL_NPM_GULP} diff --git a/env-example b/env-example index 3b52a4b9..08b2f501 100644 --- a/env-example +++ b/env-example @@ -104,6 +104,10 @@ WORKSPACE_NVM_NODEJS_ORG_MIRROR= WORKSPACE_INSTALL_NODE=true WORKSPACE_NODE_VERSION=node WORKSPACE_NPM_REGISTRY= +WORKSPACE_NPM_FETCH_RETRIES=2 +WORKSPACE_NPM_FETCH_RETRY_FACTOR=10 +WORKSPACE_NPM_FETCH_RETRY_MINTIMEOUT=10000 +WORKSPACE_NPM_FETCH_RETRY_MAXTIMEOUT=60000 WORKSPACE_INSTALL_PNPM=false WORKSPACE_INSTALL_YARN=true WORKSPACE_YARN_VERSION=latest diff --git a/workspace/Dockerfile b/workspace/Dockerfile index 0043dd80..da6d95be 100644 --- a/workspace/Dockerfile +++ b/workspace/Dockerfile @@ -666,6 +666,14 @@ ARG INSTALL_NPM_VUE_CLI=false ARG INSTALL_NPM_ANGULAR_CLI=false ARG NPM_REGISTRY ENV NPM_REGISTRY ${NPM_REGISTRY} +ARG NPM_FETCH_RETRIES +ENV NPM_FETCH_RETRIES ${NPM_FETCH_RETRIES} +ARG NPM_FETCH_RETRY_FACTOR +ENV NPM_FETCH_RETRY_FACTOR ${NPM_FETCH_RETRY_FACTOR} +ARG NPM_FETCH_RETRY_MINTIMEOUT +ENV NPM_FETCH_RETRY_MINTIMEOUT ${NPM_FETCH_RETRY_MINTIMEOUT} +ARG NPM_FETCH_RETRY_MAXTIMEOUT +ENV NPM_FETCH_RETRY_MAXTIMEOUT ${NPM_FETCH_RETRY_MAXTIMEOUT} ENV NVM_DIR /home/laradock/.nvm ARG NVM_NODEJS_ORG_MIRROR ENV NVM_NODEJS_ORG_MIRROR ${NVM_NODEJS_ORG_MIRROR} @@ -678,6 +686,10 @@ RUN if [ ${INSTALL_NODE} = true ]; then \ && nvm install ${NODE_VERSION} \ && nvm use ${NODE_VERSION} \ && nvm alias ${NODE_VERSION} \ + && npm config set fetch-retries ${NPM_FETCH_RETRIES} \ + && npm config set fetch-retry-factor ${NPM_FETCH_RETRY_FACTOR} \ + && npm config set fetch-retry-mintimeout ${NPM_FETCH_RETRY_MINTIMEOUT} \ + && npm config set fetch-retry-maxtimeout ${NPM_FETCH_RETRY_MAXTIMEOUT} \ && if [ ${NPM_REGISTRY} ]; then \ npm config set registry ${NPM_REGISTRY} \ ;fi \