From 5f1064132d2326963e8dc11aeefa1ca0d18526f3 Mon Sep 17 00:00:00 2001 From: Boris van Katwijk Date: Wed, 12 Sep 2018 23:10:27 +0200 Subject: [PATCH] Add docker compose yml --- docker-compose.yml | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 docker-compose.yml diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000000..b6dbbfd1ca --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,38 @@ +version: '3.5' + +services: + db: + image: mysql:5.7 + restart: always + command: --init-file /docker-entrypoint-initdb.d/sample.sql + environment: + MYSQL_ROOT_PASSWORD: 'pass' + MYSQL_USER: 'root' + MYSQL_PASSWORD: 'pass' + MYSQL_DATABASE: 'classicmodels' + volumes: + - ./tests/docker-sample.sql:/docker-entrypoint-initdb.d/sample.sql + - db-data:/var/lib/mysql + ports: + - "3306:3306" + + db-api: &db-api + build: + context: ./ + dockerfile: ./dev.Dockerfile + environment: + DATABASE_HOST: 'db' + DATABASE_USER: 'root' + DATABASE_PASSWORD: 'pass' + DATABASE_NAME: 'classicmodels' + ports: + - "3002:80" + depends_on: + - db + + test: + <<: *db-api + command: sh -c "npm test" + +volumes: + db-data: