From 3710f3bd72ccfe28c8cc0d608405e6ec61eb2654 Mon Sep 17 00:00:00 2001 From: MaolinPan Date: Fri, 11 Jun 2021 16:22:27 +0800 Subject: [PATCH] running multiple containers using docker-compose --- docker-compose.yml | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index bdf8534..1a943cb 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,12 +1,27 @@ version: "3.7" services: - docs: - build: - context: . - dockerfile: Dockerfile - target: dev + app: + image: node:12-alpine + command: sh -c "yarn install && yarn run dev" ports: - - 8000:8000 + - 3000:3000 + working_dir: /app volumes: - ./:/app + environment: + MYSQL_HOST: mysql + MYSQL_USER: root + MYSQL_PASSWORD: secret + MYSQL_DB: todos + + mysql: + image: mysql:5.7 + volumes: + - todo-mysql-data:/var/lib/mysql + environment: + MYSQL_ROOT_PASSWORD: secret + MYSQL_DATABASE: todos + +volumes: + todo-mysql-data: \ No newline at end of file