Skip to content

Commit 489d200

Browse files
committed
yarn
1 parent 9d8f80e commit 489d200

5 files changed

Lines changed: 22 additions & 3 deletions

File tree

.build-sample.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export COMPOSER=true
1212
export XDEBUG=false
1313
export PHPUNIT=true
1414
export NODE_JS=true
15+
export YARN=true
1516
export WP_CLI=false
1617
export MAIL=true
1718
export RELEASE_VERSION=apache

Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,15 @@ RUN if [ $NODE_JS = "true" ]; then \
8181
apt-get install -y --no-install-recommends nodejs && \
8282
rm -rf /var/lib/apt/lists/*; fi
8383

84+
# yarn
85+
ARG YARN=true
86+
RUN if [ $YARN = "true" ]; then \
87+
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
88+
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \
89+
apt-get update && \
90+
apt-get install -qq -y yarn && \
91+
rm -rf /var/lib/apt/lists/*; fi
92+
8493
# Mail
8594
ARG MAIL=true
8695
ARG MAIL_HOST="mailhog:1025"

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,13 @@ Mount the project directory path to `/var/www`. The document root is `/var/www/p
5050
volumes:
5151
- .:/var/www
5252
```
53-
[ Optional ] To use your `ssh` keys to connect to a git repository, mount your `.ssh` directory to the `app` user's home directory.
53+
[ Optional ] To use your `ssh` keys to connect to a git repository, mount your `.ssh` directory to the `app` user's home directory. For yarn, mount your local `.cache` directory.
5454
```
5555
volumes:
5656
- ~/.ssh:/home/app/.ssh
57+
- ~/.cache:/home/app/.cache
5758
```
59+
5860
## Start Project Container
5961
Inside the project directory, start the project container and the shared services.
6062
```
@@ -74,6 +76,7 @@ The URL is `https://docker-project`.
7476
- Git: `docker-git`
7577
- Logs: `docker-logs`
7678
- npm: `docker-npm`
79+
- yarn: `docker-yarn`
7780
- PHPUnit: `docker-phpunit`
7881
- Symfony: `docker-symfony [phpunit]`
7982
- WP-CLI: `docker-wp [multisite-convert]`
@@ -114,11 +117,12 @@ The `EXTRA_HOSTS` build argument can be used to add additional hostname mappings
114117
EXTRA_HOSTS=example.com:192.16.10.10,example2.com:192.16.10.11
115118
```
116119
## Build Args
117-
To use a specific `stretch/apache` [PHP Docker image](https://hub.docker.com/_/php/), set the `RELEASE_VERSION` build argument in the `docker-compose.yml` file. To install Xdebug and npm, set their attributes to true.
120+
To use a specific [PHP Docker image](https://hub.docker.com/_/php/), set the `RELEASE_VERSION` build argument in the `docker-compose.yml` file. To install Xdebug, npm and yarn, set their attributes to true.
118121
```
119122
args:
120123
- XDEBUG=true
121124
- NODE_JS=true
125+
- YARN=true
122126
- RELEASE_VERSION=apache
123127
```
124128
There are other build arguments available for Composer, WP-CLI, the document root, user and group. Trailing URL slashes can be removed and the Apache log level can be set to debug.

bin/docker-yarn

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env bash
2+
3+
docker-app yarn "$@"

docker-compose.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ services:
1111
args:
1212
- XDEBUG=${XDEBUG}
1313
- NODE_JS=${NODE_JS}
14+
- YARN=${YARN}
1415
- WP_CLI=${WP_CLI}
1516
- RELEASE_VERSION=${RELEASE_VERSION}
1617
- USER_ID=${USER_ID}
@@ -34,5 +35,6 @@ services:
3435
- public
3536
working_dir: /var/www
3637
volumes:
37-
#- ${COMPOSER_DIR}:/home/app/.composer
38+
#- ~/.composer:/home/app/.composer
39+
#- ~/.cache:/home/app/.cache
3840
- ./www:/var/www

0 commit comments

Comments
 (0)