From 2066be621f26c99e1b3e88cb5ab031ba6b23f215 Mon Sep 17 00:00:00 2001 From: Federico Gonzalez Date: Thu, 25 Aug 2016 11:36:07 -0300 Subject: [PATCH] feat(docker): Update docker-compose to version 2 Add data container for docker-compose and update to docker compose version 2 (#1437) Change containers, add environment for mongodb host, change version to 2. Fixes #1434 * feat(deploy): Add data container for mongodb Add db-data for mongodb, remove container_name. Fixes #1434 * feat(deploy): Use networking of compose version 2 (remove links) Remove links Fixes #1434 * feat(deploy): Use depends_on for db containers Add depends_on for db Fixes #1434 * feat(deploy): Add data container for web data Add data container, add volumes and remove command. Fixes #1434 * feat(deploy): Change image for container data Change busybox to build . for data container Fixes #1434 * feat(deploy): Change entrypoint for web-data container Change entrypoint for web-data container Fixes #1434 --- docker-compose.yml | 65 +++++++++++++++++++++++++++------------------- 1 file changed, 39 insertions(+), 26 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 90eb818f2c..6fbe2d6ff2 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,26 +1,39 @@ -web: - restart: always - build: . - container_name: meanjs - command: npm start - links: - - db - ports: - - "3000:3000" - - "5858:5858" - - "35729:35729" - environment: - - NODE_ENV=development - volumes: - - ./:/opt/mean.js - - /opt/mean.js/node_modules - - /opt/mean.js/public - - /opt/mean.js/uploads -db: - image: mongo:3.2 - container_name: db_1 - restart: always - ports: - - "27017:27017" - volumes: - - db:/data/db +version: '2' +services: + web: + restart: always + build: . + container_name: meanjs + ports: + - "3000:3000" + - "5858:5858" + - "35729:35729" + environment: + - NODE_ENV=development + - DB_1_PORT_27017_TCP_ADDR=db + depends_on: + - db + volumes_from: + - web-data + web-data: + build: . + entrypoint: /bin/true + volumes: + - ./:/opt/mean.js + - /opt/mean.js/node_modules + - /opt/mean.js/public + - /opt/mean.js/uploads + db: + image: mongo:3.2 + restart: always + ports: + - "27017:27017" + volumes_from: + - db-data + db-data: + image: mongo:3.2 + volumes: + - /data/db + - /var/lib/mongodb + - /var/log/mongodb + entrypoint: /bin/true