experimenter/circle.yml

58 строки
1.6 KiB
YAML

machine:
services:
- docker
dependencies:
# make sure to keep the docker cache dir
pre:
- sudo service postgresql stop
- sudo /etc/init.d/postgresql stop
- sudo apt-get remove -y postgresql-9.5
- sudo apt-get remove -y postgresql-9.6
- mv docker-compose.yml.circleci docker-compose.yml
cache_directories:
- "~/docker"
override:
- docker info
# build the container, use circleci's docker cache workaround
# only use 1 image per day to keep the cache size from getting
# too big and slowing down the build
- I="image-$(date +%j).tar"; if [[ -e ~/docker/$I ]]; then echo "Loading $I"; docker load -i ~/docker/$I; fi
# setup env file
- cp .env.circle .env
# build the container
- make build
# Clean up any old images and save the new one
- I="image-$(date +%j).tar"; mkdir -p ~/docker; rm ~/docker/*; docker save app:build > ~/docker/$I; ls -l ~/docker
test:
override:
- make check
# appropriately tag and push the container to dockerhub
deployment:
hub_latest:
branch: "master"
commands:
- "[ -n \"$DOCKERHUB_REPO\" ]"
- docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS
- "docker tag app:build ${DOCKERHUB_REPO}:latest"
- "docker push ${DOCKERHUB_REPO}:latest"
hub_releases:
# push all tags
tag: /.*/
commands:
- "[ -n \"$DOCKERHUB_REPO\" ]"
- docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS
- "echo ${DOCKERHUB_REPO}:${CIRCLE_TAG}"
- "docker tag app:build ${DOCKERHUB_REPO}:${CIRCLE_TAG}"
- "docker images"
- "docker push ${DOCKERHUB_REPO}:${CIRCLE_TAG}"