From 489d200125424e5015ae060e2f86c68b6fd74081 Mon Sep 17 00:00:00 2001 From: devosc Date: Sun, 23 Feb 2020 19:37:44 -0600 Subject: [PATCH] yarn --- .build-sample.env | 1 + Dockerfile | 9 +++++++++ README.md | 8 ++++++-- bin/docker-yarn | 3 +++ docker-compose.yml | 4 +++- 5 files changed, 22 insertions(+), 3 deletions(-) create mode 100755 bin/docker-yarn diff --git a/.build-sample.env b/.build-sample.env index 99cc38f..2a7e947 100644 --- a/.build-sample.env +++ b/.build-sample.env @@ -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 diff --git a/Dockerfile b/Dockerfile index 9056646..207a6e4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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" diff --git a/README.md b/README.md index 63837be..d94499a 100644 --- a/README.md +++ b/README.md @@ -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. ``` @@ -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]` @@ -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. diff --git a/bin/docker-yarn b/bin/docker-yarn new file mode 100755 index 0000000..cd3bcb3 --- /dev/null +++ b/bin/docker-yarn @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +docker-app yarn "$@" diff --git a/docker-compose.yml b/docker-compose.yml index 319e059..6d01e2d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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} @@ -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