diff --git a/README.md b/README.md new file mode 100644 index 00000000..c459f5c3 --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# dockerapp +Project source code for https://www.udemy.com/docker-tutorial-for-devops-run-docker-containers diff --git a/circle.yml b/circle.yml index 700c79f9..48b687b6 100644 --- a/circle.yml +++ b/circle.yml @@ -6,6 +6,7 @@ machine: dependencies: pre: + - sudo pip install --upgrade pip - sudo pip install docker-compose test: @@ -15,7 +16,7 @@ test: deployment: hub: - branch: /.*/ + branch: [circle_ci_publish, master] commands: - docker login -e $DOCKER_HUB_EMAIL -u $DOCKER_HUB_USER_ID -p $DOCKER_HUB_PWD - docker tag dockerapp_dockerapp $DOCKER_HUB_USER_ID/dockerapp:$CIRCLE_SHA1 diff --git a/common.yml b/common.yml new file mode 100644 index 00000000..99579bb3 --- /dev/null +++ b/common.yml @@ -0,0 +1,7 @@ +version: '2' +services: + dockerapp: + ports: + - "5000:5000" + redis: + image: redis:3.2.0 diff --git a/docker-compose.yml b/docker-compose.yml index 2c57eda6..8b6b1188 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,9 +1,12 @@ version: '2' services: dockerapp: + extends: + file: common.yml + service: dockerapp build: . - ports: - - "5000:5000" redis: - image: redis:3.2.0 + extends: + file: common.yml + service: redis diff --git a/prod.yml b/prod.yml index b0096ff1..7e54684e 100644 --- a/prod.yml +++ b/prod.yml @@ -1,9 +1,24 @@ version: '2' services: dockerapp: + extends: + file: common.yml + service: dockerapp image: jleetutorial/dockerapp - ports: - - "5000:5000" + environment: + - constraint:node==master + depends_on: + - redis + networks: + - mynet redis: - image: redis:3.2.0 + extends: + file: common.yml + service: redis + networks: + - mynet + +networks: + mynet: + driver: overlay