From 7d1dc66f77a61e767339f938570efda2c1dfe7dd Mon Sep 17 00:00:00 2001 From: Abdelrahman Omran Date: Sun, 24 Jun 2018 17:19:09 +0200 Subject: [PATCH] Conditionally install npm tools (#1641) --- DOCUMENTATION/content/documentation/index.md | 52 ++++++++++++++++++++ docker-compose.yml | 3 ++ env-example | 3 ++ workspace/Dockerfile | 27 +++++++--- 4 files changed, 77 insertions(+), 8 deletions(-) diff --git a/DOCUMENTATION/content/documentation/index.md b/DOCUMENTATION/content/documentation/index.md index 37e431e1..ed09c2ad 100644 --- a/DOCUMENTATION/content/documentation/index.md +++ b/DOCUMENTATION/content/documentation/index.md @@ -1243,6 +1243,58 @@ Yarn is a new package manager for JavaScript. It is so faster than npm, which yo +
+ +## 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` + + + + + + + +
+ +## 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` + + + + + + +
+ +## 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` + + + + + +
## Install Linuxbrew diff --git a/docker-compose.yml b/docker-compose.yml index 1b806b41..53747d71 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -61,6 +61,9 @@ services: - INSTALL_NODE=${WORKSPACE_INSTALL_NODE} - NPM_REGISTRY=${WORKSPACE_NPM_REGISTRY} - 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_DRUPAL_CONSOLE=${WORKSPACE_INSTALL_DRUPAL_CONSOLE} - INSTALL_AEROSPIKE=${WORKSPACE_INSTALL_AEROSPIKE} diff --git a/env-example b/env-example index de824431..e45eb131 100644 --- a/env-example +++ b/env-example @@ -80,6 +80,9 @@ WORKSPACE_NODE_VERSION=stable WORKSPACE_NPM_REGISTRY= WORKSPACE_INSTALL_YARN=true 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_WORKSPACE_SSH=false WORKSPACE_INSTALL_SUBVERSION=false diff --git a/workspace/Dockerfile b/workspace/Dockerfile index c3154f55..59d73f11 100644 --- a/workspace/Dockerfile +++ b/workspace/Dockerfile @@ -369,21 +369,32 @@ USER laradock ARG NODE_VERSION=stable ENV NODE_VERSION ${NODE_VERSION} ARG INSTALL_NODE=false +ARG INSTALL_NPM_GULP=false +ARG INSTALL_NPM_BOWER=false +ARG INSTALL_NPM_VUE_CLI=false ARG NPM_REGISTRY ENV NPM_REGISTRY ${NPM_REGISTRY} ENV NVM_DIR /home/laradock/.nvm RUN if [ ${INSTALL_NODE} = true ]; then \ # Install nvm (A Node Version Manager) - curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash && \ - . $NVM_DIR/nvm.sh && \ - nvm install ${NODE_VERSION} && \ - nvm use ${NODE_VERSION} && \ - nvm alias ${NODE_VERSION} && \ - if [ ${NPM_REGISTRY} ]; then \ + curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash \ + && . $NVM_DIR/nvm.sh \ + && nvm install ${NODE_VERSION} \ + && nvm use ${NODE_VERSION} \ + && nvm alias ${NODE_VERSION} \ + && if [ ${NPM_REGISTRY} ]; then \ npm config set registry ${NPM_REGISTRY} \ - ;fi && \ - npm install -g gulp bower vue-cli \ + ;fi \ + && 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 # Wouldn't execute when added to the RUN statement in the above block