Skip to content

Commit 7d1dc66

Browse files
Omranicbestlong
authored andcommitted
Conditionally install npm tools (laradock#1641)
1 parent f3c9342 commit 7d1dc66

4 files changed

Lines changed: 77 additions & 8 deletions

File tree

DOCUMENTATION/content/documentation/index.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1243,6 +1243,58 @@ Yarn is a new package manager for JavaScript. It is so faster than npm, which yo
12431243

12441244

12451245

1246+
<br>
1247+
<a name="Install-NPM-GULP"></a>
1248+
## Install NPM GULP toolkit
1249+
1250+
To install NPM GULP toolkit in the Workspace container
1251+
1252+
1 - Open the `.env` file
1253+
1254+
2 - Search for the `WORKSPACE_INSTALL_NPM_GULP` argument under the Workspace Container and set it to `true`
1255+
1256+
3 - Re-build the container `docker-compose build workspace`
1257+
1258+
1259+
1260+
1261+
1262+
1263+
1264+
<br>
1265+
<a name="Install-NPM-BOWER"></a>
1266+
## Install NPM BOWER package manager
1267+
1268+
To install NPM BOWER package manager in the Workspace container
1269+
1270+
1 - Open the `.env` file
1271+
1272+
2 - Search for the `WORKSPACE_INSTALL_NPM_BOWER` argument under the Workspace Container and set it to `true`
1273+
1274+
3 - Re-build the container `docker-compose build workspace`
1275+
1276+
1277+
1278+
1279+
1280+
1281+
<br>
1282+
<a name="Install-NPM-VUE-CLI"></a>
1283+
## Install NPM VUE CLI
1284+
1285+
To install NPM VUE CLI in the Workspace container
1286+
1287+
1 - Open the `.env` file
1288+
1289+
2 - Search for the `WORKSPACE_INSTALL_NPM_VUE_CLI` argument under the Workspace Container and set it to `true`
1290+
1291+
3 - Re-build the container `docker-compose build workspace`
1292+
1293+
1294+
1295+
1296+
1297+
12461298
<br>
12471299
<a name="Install-Linuxbrew"></a>
12481300
## Install Linuxbrew

docker-compose.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ services:
6161
- INSTALL_NODE=${WORKSPACE_INSTALL_NODE}
6262
- NPM_REGISTRY=${WORKSPACE_NPM_REGISTRY}
6363
- INSTALL_YARN=${WORKSPACE_INSTALL_YARN}
64+
- INSTALL_NPM_GULP=${WORKSPACE_INSTALL_NPM_GULP}
65+
- INSTALL_NPM_BOWER=${WORKSPACE_INSTALL_NPM_BOWER}
66+
- INSTALL_NPM_VUE_CLI=${WORKSPACE_INSTALL_NPM_VUE_CLI}
6467
- INSTALL_DRUSH=${WORKSPACE_INSTALL_DRUSH}
6568
- INSTALL_DRUPAL_CONSOLE=${WORKSPACE_INSTALL_DRUPAL_CONSOLE}
6669
- INSTALL_AEROSPIKE=${WORKSPACE_INSTALL_AEROSPIKE}

env-example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ WORKSPACE_NODE_VERSION=stable
8080
WORKSPACE_NPM_REGISTRY=
8181
WORKSPACE_INSTALL_YARN=true
8282
WORKSPACE_YARN_VERSION=latest
83+
WORKSPACE_INSTALL_NPM_GULP=true
84+
WORKSPACE_INSTALL_NPM_BOWER=true
85+
WORKSPACE_INSTALL_NPM_VUE_CLI=true
8386
WORKSPACE_INSTALL_PHPREDIS=true
8487
WORKSPACE_INSTALL_WORKSPACE_SSH=false
8588
WORKSPACE_INSTALL_SUBVERSION=false

workspace/Dockerfile

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -369,21 +369,32 @@ USER laradock
369369
ARG NODE_VERSION=stable
370370
ENV NODE_VERSION ${NODE_VERSION}
371371
ARG INSTALL_NODE=false
372+
ARG INSTALL_NPM_GULP=false
373+
ARG INSTALL_NPM_BOWER=false
374+
ARG INSTALL_NPM_VUE_CLI=false
372375
ARG NPM_REGISTRY
373376
ENV NPM_REGISTRY ${NPM_REGISTRY}
374377
ENV NVM_DIR /home/laradock/.nvm
375378

376379
RUN if [ ${INSTALL_NODE} = true ]; then \
377380
# Install nvm (A Node Version Manager)
378-
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash && \
379-
. $NVM_DIR/nvm.sh && \
380-
nvm install ${NODE_VERSION} && \
381-
nvm use ${NODE_VERSION} && \
382-
nvm alias ${NODE_VERSION} && \
383-
if [ ${NPM_REGISTRY} ]; then \
381+
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash \
382+
&& . $NVM_DIR/nvm.sh \
383+
&& nvm install ${NODE_VERSION} \
384+
&& nvm use ${NODE_VERSION} \
385+
&& nvm alias ${NODE_VERSION} \
386+
&& if [ ${NPM_REGISTRY} ]; then \
384387
npm config set registry ${NPM_REGISTRY} \
385-
;fi && \
386-
npm install -g gulp bower vue-cli \
388+
;fi \
389+
&& if [ ${INSTALL_NPM_GULP} = true ]; then \
390+
npm install -g gulp \
391+
;fi \
392+
&& if [ ${INSTALL_NPM_BOWER} = true ]; then \
393+
npm install -g bower \
394+
;fi \
395+
&& if [ ${INSTALL_NPM_VUE_CLI} = true ]; then \
396+
npm install -g vue-cli \
397+
;fi \
387398
;fi
388399

389400
# Wouldn't execute when added to the RUN statement in the above block

0 commit comments

Comments
 (0)