Continuous Integration

    1. Pulls files from your github repo
      1. circle.yml → tells circle what steps to take
    2. Uses docker compose to build images & spin up containers
      1. Caution, resultant image names will have specific format
        1. When using docker-compose, image naming format is <folderName><serviceName (given in docker-compose.yml)>

Image name = <gh repo name (with dashes [-]removed) >_<service name given in docker-compose.yml

    1. Once tests pass, can push passing image to DockerHub.com

github.com/dougwells/docker-web-app

File: docker-compose.yml


version: '2'

services:

Dockerapp:

build: .

ports:

  • "5000:5000"

Volumes: //Delete Volumes if deploy to cloud service

  • ./app:/app //Cannot guarantee access to Volumes

//Rather-COPY in Dockerfile. Source files baked in image

redis:

image: redis:3.2.0

File: circle.yml


machine:

pre:

services:

  • docker

dependencies:

pre:

  • sudo pip install docker-compose

test:

override:

  • docker-compose up -d

  • docker-compose run dockerapp python test.py

deployment:

hub:

branch: [circle_ci_publish, master]

commands:

  • docker login -e $DOCKER_HUB_EMAIL -u $DOCKER_HUB_USER_ID -p $DOCKER_HUB_PWD

  • docker tag dockerwebapp_dockerapp $DOCKER_HUB_USER_ID/dockerapp:$CIRCLE_SHA1

  • docker tag dockerwebapp_dockerapp $DOCKER_HUB_USER_ID/dockerapp:latest

  • docker push $DOCKER_HUB_USER_ID/dockerapp:$CIRCLE_SHA1

  • docker push $DOCKER_HUB_USER_ID/dockerapp:latest

results matching ""

    No results matching ""