Skip to content

Commit

Permalink
yarn
Browse files Browse the repository at this point in the history
  • Loading branch information
devosc committed Feb 24, 2020
1 parent 9d8f80e commit 489d200
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 3 deletions.
1 change: 1 addition & 0 deletions .build-sample.env
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export COMPOSER=true
export XDEBUG=false
export PHPUNIT=true
export NODE_JS=true
export YARN=true
export WP_CLI=false
export MAIL=true
export RELEASE_VERSION=apache
Expand Down
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,15 @@ RUN if [ $NODE_JS = "true" ]; then \
apt-get install -y --no-install-recommends nodejs && \
rm -rf /var/lib/apt/lists/*; fi

# yarn
ARG YARN=true
RUN if [ $YARN = "true" ]; then \
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \
apt-get update && \
apt-get install -qq -y yarn && \
rm -rf /var/lib/apt/lists/*; fi

# Mail
ARG MAIL=true
ARG MAIL_HOST="mailhog:1025"
Expand Down
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,13 @@ Mount the project directory path to `/var/www`. The document root is `/var/www/p
volumes:
- .:/var/www
```
[ Optional ] To use your `ssh` keys to connect to a git repository, mount your `.ssh` directory to the `app` user's home directory.
[ 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.
```
volumes:
- ~/.ssh:/home/app/.ssh
- ~/.cache:/home/app/.cache
```

## Start Project Container
Inside the project directory, start the project container and the shared services.
```
Expand All @@ -74,6 +76,7 @@ The URL is `https://docker-project`.
- Git: `docker-git`
- Logs: `docker-logs`
- npm: `docker-npm`
- yarn: `docker-yarn`
- PHPUnit: `docker-phpunit`
- Symfony: `docker-symfony [phpunit]`
- WP-CLI: `docker-wp [multisite-convert]`
Expand Down Expand Up @@ -114,11 +117,12 @@ The `EXTRA_HOSTS` build argument can be used to add additional hostname mappings
EXTRA_HOSTS=example.com:192.16.10.10,example2.com:192.16.10.11
```
## Build Args
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.
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.
```
args:
- XDEBUG=true
- NODE_JS=true
- YARN=true
- RELEASE_VERSION=apache
```
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.
Expand Down
3 changes: 3 additions & 0 deletions bin/docker-yarn
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash

docker-app yarn "$@"
4 changes: 3 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ services:
args:
- XDEBUG=${XDEBUG}
- NODE_JS=${NODE_JS}
- YARN=${YARN}
- WP_CLI=${WP_CLI}
- RELEASE_VERSION=${RELEASE_VERSION}
- USER_ID=${USER_ID}
Expand All @@ -34,5 +35,6 @@ services:
- public
working_dir: /var/www
volumes:
#- ${COMPOSER_DIR}:/home/app/.composer
#- ~/.composer:/home/app/.composer
#- ~/.cache:/home/app/.cache
- ./www:/var/www

0 comments on commit 489d200

Please sign in to comment.