Skip to content

Commit 8d1ba2e

Browse files
authored
Merge pull request laradock#361 from LaraDock/yarn
Support Yarn package manager for JavaScript
2 parents a284731 + c9415b1 commit 8d1ba2e

4 files changed

Lines changed: 51 additions & 0 deletions

File tree

README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ It's like Laravel Homestead but for Docker instead of Vagrant.
6868
- [Enable Global Composer Build Install](#Enable-Global-Composer-Build-Install)
6969
- [Install Prestissimo](#Install-Prestissimo)
7070
- [Install Node + NVM](#Install-Node)
71+
- [Install Node + YARN](#Install-Yarn)
7172
- [Debugging](#debugging)
7273
- [Upgrading LaraDock](#upgrading-laradock)
7374
- [Help & Questions](#Help)
@@ -1125,6 +1126,30 @@ It should be like this:
11251126

11261127
3 - Re-build the container `docker-compose build workspace`
11271128

1129+
<br>
1130+
<a name="Install-Yarn"></a>
1131+
### Install Node + YARN
1132+
1133+
Yarn is a new package manager for JavaScript. It is so faster than npm, which you can find [here](http://yarnpkg.com/en/compare).To install NodeJS and [Yarn](https://yarnpkg.com/) in the Workspace container:
1134+
1135+
1 - Open the `docker-compose.yml` file
1136+
1137+
2 - Search for the `INSTALL_NODE` and `INSTALL_YARN` argument under the Workspace Container and set it to `true`
1138+
1139+
It should be like this:
1140+
1141+
```yml
1142+
workspace:
1143+
build:
1144+
context: ./workspace
1145+
args:
1146+
- INSTALL_NODE=true
1147+
- INSTALL_YARN=true
1148+
...
1149+
```
1150+
1151+
3 - Re-build the container `docker-compose build workspace`
1152+
11281153
<br>
11291154
<a name="Install-Aerospike-Extension"></a>
11301155
### Install Aerospike extension

docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ services:
1111
- INSTALL_XDEBUG=false
1212
- INSTALL_MONGO=false
1313
- INSTALL_NODE=false
14+
- INSTALL_YARN=false
1415
- INSTALL_DRUSH=false
1516
- INSTALL_AEROSPIKE_EXTENSION=false
1617
- COMPOSER_GLOBAL_INSTALL=false

production-docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ services:
1111
- INSTALL_XDEBUG=false
1212
- INSTALL_MONGO=false
1313
- INSTALL_NODE=false
14+
- INSTALL_YARN=false
1415
- INSTALL_DRUSH=false
1516
- INSTALL_AEROSPIKE_EXTENSION=false
1617
- COMPOSER_GLOBAL_INSTALL=false

workspace/Dockerfile

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,30 @@ RUN if [ ${INSTALL_NODE} = true ]; then \
181181
echo '[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm' >> ~/.bashrc \
182182
;fi
183183

184+
#####################################
185+
# YARN:
186+
#####################################
187+
188+
USER laradock
189+
190+
ARG INSTALL_YARN=false
191+
ENV INSTALL_YARN ${INSTALL_YARN}
192+
193+
RUN if [ ${INSTALL_YARN} = true ]; then \
194+
curl -o- -L https://yarnpkg.com/install.sh | bash && \
195+
echo "" >> ~/.bashrc && \
196+
echo 'export PATH="$HOME/.yarn/bin:$PATH"' >> ~/.bashrc \
197+
;fi
198+
199+
# Add YARN binaries to root's .bashrc
200+
USER root
201+
202+
RUN if [ ${INSTALL_YARN} = true ]; then \
203+
echo "" >> ~/.bashrc && \
204+
echo 'export YARN_DIR="/home/laradock/.yarn"' >> ~/.bashrc && \
205+
echo 'export PATH="$YARN_DIR/bin:$PATH"' >> ~/.bashrc \
206+
;fi
207+
184208
#####################################
185209
# PHP Aerospike:
186210
#####################################

0 commit comments

Comments
 (0)