Continuous Integration
- Pulls files from your github repo
- circle.yml → tells circle what steps to take
- Uses docker compose to build images & spin up containers
- Caution, resultant image names will have specific format
- When using docker-compose, image naming format is <folderName><serviceName (given in docker-compose.yml)>
- Caution, resultant image names will have specific format
- Pulls files from your github repo
Image name = <gh repo name (with dashes [-]removed) >_<service name given in docker-compose.yml
- 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:
- curl -sSL https://s3.amazonaws.com/circle-downloads/install-circleci-docker.sh | bash -s -- 1.10.0
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