kuaifan il y a 5 ans
Parent
commit
111d8a6f7e
3 fichiers modifiés avec 12 ajouts et 3 suppressions
  1. 4 1
      cmd
  2. 7 0
      docker-compose.yml
  3. 1 2
      docker/php.Dockerfile

+ 4 - 1
cmd

@@ -17,7 +17,10 @@ if [ $# -gt 0 ];then
         $COMPOSE run --rm -w /var/www php ./vendor/bin/phpunit "$@"
     elif [[ "$1" == "npm" ]]; then
         shift 1
-        $COMPOSE run --rm -w /var/www php npm "$@"
+        $COMPOSE run --rm -w /var/www nodejs npm "$@"
+    elif [[ "$1" == "yarn" ]]; then
+        shift 1
+        $COMPOSE run --rm -w /var/www nodejs yarn "$@"
     elif [[ "$1" == "mysql" ]]; then
         shift 1
         $COMPOSE run --rm -w / mariadb mysql "$@"

+ 7 - 0
docker-compose.yml

@@ -38,3 +38,10 @@ services:
       - "MYSQL_USER=${DB_USERNAME}"
       - "MYSQL_PASSWORD=${DB_PASSWORD}"
     restart: always
+
+  nodejs:
+    hostname: nodejs
+    image: node:12.18.0
+    working_dir: /var/www
+    volumes:
+      - ./:/var/www

+ 1 - 2
docker/php.Dockerfile

@@ -2,7 +2,7 @@ FROM phpswoole/swoole:4.5.2-php7.4
 
 # Installation dependencies and PHP core extensions
 RUN apt-get update \
-        && apt-get install -y \
+        && apt-get -y install --no-install-recommends \
         libpng-dev \
         libzip-dev \
         libzip4 \
@@ -11,7 +11,6 @@ RUN apt-get update \
         git \
         net-tools \
         iputils-ping \
-        npm \
         vim \
         supervisor \
         && rm -r /var/lib/apt/lists/* \