Conditionally install npm tools (#1641)

This commit is contained in:
Abdelrahman Omran 2018-06-24 17:19:09 +02:00 committed by Shao Yu-Lung (Allen)
parent f3c934222f
commit 7d1dc66f77
4 changed files with 77 additions and 8 deletions

View File

@ -1243,6 +1243,58 @@ Yarn is a new package manager for JavaScript. It is so faster than npm, which yo
<br>
<a name="Install-NPM-GULP"></a>
## Install NPM GULP toolkit
To install NPM GULP toolkit in the Workspace container
1 - Open the `.env` file
2 - Search for the `WORKSPACE_INSTALL_NPM_GULP` argument under the Workspace Container and set it to `true`
3 - Re-build the container `docker-compose build workspace`
<br>
<a name="Install-NPM-BOWER"></a>
## Install NPM BOWER package manager
To install NPM BOWER package manager in the Workspace container
1 - Open the `.env` file
2 - Search for the `WORKSPACE_INSTALL_NPM_BOWER` argument under the Workspace Container and set it to `true`
3 - Re-build the container `docker-compose build workspace`
<br>
<a name="Install-NPM-VUE-CLI"></a>
## Install NPM VUE CLI
To install NPM VUE CLI in the Workspace container
1 - Open the `.env` file
2 - Search for the `WORKSPACE_INSTALL_NPM_VUE_CLI` argument under the Workspace Container and set it to `true`
3 - Re-build the container `docker-compose build workspace`
<br> <br>
<a name="Install-Linuxbrew"></a> <a name="Install-Linuxbrew"></a>
## Install Linuxbrew ## Install Linuxbrew

View File

@ -61,6 +61,9 @@ services:
- INSTALL_NODE=${WORKSPACE_INSTALL_NODE} - INSTALL_NODE=${WORKSPACE_INSTALL_NODE}
- NPM_REGISTRY=${WORKSPACE_NPM_REGISTRY} - NPM_REGISTRY=${WORKSPACE_NPM_REGISTRY}
- INSTALL_YARN=${WORKSPACE_INSTALL_YARN} - INSTALL_YARN=${WORKSPACE_INSTALL_YARN}
- INSTALL_NPM_GULP=${WORKSPACE_INSTALL_NPM_GULP}
- INSTALL_NPM_BOWER=${WORKSPACE_INSTALL_NPM_BOWER}
- INSTALL_NPM_VUE_CLI=${WORKSPACE_INSTALL_NPM_VUE_CLI}
- INSTALL_DRUSH=${WORKSPACE_INSTALL_DRUSH} - INSTALL_DRUSH=${WORKSPACE_INSTALL_DRUSH}
- INSTALL_DRUPAL_CONSOLE=${WORKSPACE_INSTALL_DRUPAL_CONSOLE} - INSTALL_DRUPAL_CONSOLE=${WORKSPACE_INSTALL_DRUPAL_CONSOLE}
- INSTALL_AEROSPIKE=${WORKSPACE_INSTALL_AEROSPIKE} - INSTALL_AEROSPIKE=${WORKSPACE_INSTALL_AEROSPIKE}

View File

@ -80,6 +80,9 @@ WORKSPACE_NODE_VERSION=stable
WORKSPACE_NPM_REGISTRY= WORKSPACE_NPM_REGISTRY=
WORKSPACE_INSTALL_YARN=true WORKSPACE_INSTALL_YARN=true
WORKSPACE_YARN_VERSION=latest WORKSPACE_YARN_VERSION=latest
WORKSPACE_INSTALL_NPM_GULP=true
WORKSPACE_INSTALL_NPM_BOWER=true
WORKSPACE_INSTALL_NPM_VUE_CLI=true
WORKSPACE_INSTALL_PHPREDIS=true WORKSPACE_INSTALL_PHPREDIS=true
WORKSPACE_INSTALL_WORKSPACE_SSH=false WORKSPACE_INSTALL_WORKSPACE_SSH=false
WORKSPACE_INSTALL_SUBVERSION=false WORKSPACE_INSTALL_SUBVERSION=false

View File

@ -369,21 +369,32 @@ USER laradock
ARG NODE_VERSION=stable ARG NODE_VERSION=stable
ENV NODE_VERSION ${NODE_VERSION} ENV NODE_VERSION ${NODE_VERSION}
ARG INSTALL_NODE=false ARG INSTALL_NODE=false
ARG INSTALL_NPM_GULP=false
ARG INSTALL_NPM_BOWER=false
ARG INSTALL_NPM_VUE_CLI=false
ARG NPM_REGISTRY ARG NPM_REGISTRY
ENV NPM_REGISTRY ${NPM_REGISTRY} ENV NPM_REGISTRY ${NPM_REGISTRY}
ENV NVM_DIR /home/laradock/.nvm ENV NVM_DIR /home/laradock/.nvm
RUN if [ ${INSTALL_NODE} = true ]; then \ RUN if [ ${INSTALL_NODE} = true ]; then \
# Install nvm (A Node Version Manager) # Install nvm (A Node Version Manager)
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash && \ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash \
. $NVM_DIR/nvm.sh && \ && . $NVM_DIR/nvm.sh \
nvm install ${NODE_VERSION} && \ && nvm install ${NODE_VERSION} \
nvm use ${NODE_VERSION} && \ && nvm use ${NODE_VERSION} \
nvm alias ${NODE_VERSION} && \ && nvm alias ${NODE_VERSION} \
if [ ${NPM_REGISTRY} ]; then \ && if [ ${NPM_REGISTRY} ]; then \
npm config set registry ${NPM_REGISTRY} \ npm config set registry ${NPM_REGISTRY} \
;fi && \ ;fi \
npm install -g gulp bower vue-cli \ && if [ ${INSTALL_NPM_GULP} = true ]; then \
npm install -g gulp \
;fi \
&& if [ ${INSTALL_NPM_BOWER} = true ]; then \
npm install -g bower \
;fi \
&& if [ ${INSTALL_NPM_VUE_CLI} = true ]; then \
npm install -g vue-cli \
;fi \
;fi ;fi
# Wouldn't execute when added to the RUN statement in the above block # Wouldn't execute when added to the RUN statement in the above block