51 строка
1.7 KiB
YAML
51 строка
1.7 KiB
YAML
machine:
|
|
services:
|
|
- docker
|
|
python:
|
|
version: 3.5.2
|
|
dependencies:
|
|
cache_directories:
|
|
- "~/docker"
|
|
override:
|
|
- docker info
|
|
- I="image-$(date +%j).tar";if [[ -e ~/docker/$I ]]; then echo "Loading $I";docker load -i ~/docker/$I;fi
|
|
- >
|
|
printf '{"commit":"%s","version":"%s","source":"https://github.com/%s/%s","build":"%s"}\n'
|
|
"$CIRCLE_SHA1"
|
|
"$CIRCLE_TAG"
|
|
"$CIRCLE_PROJECT_USERNAME"
|
|
"$CIRCLE_PROJECT_REPONAME"
|
|
"$CIRCLE_BUILD_URL"
|
|
> version.json
|
|
- cp version.json $CIRCLE_ARTIFACTS
|
|
- cd docker; docker build -t app:build .
|
|
- >
|
|
I="image-$(date +%j).tar"; mkdir -p ~/docker; rm ~/docker/*; docker save app:build > ~/docker/$I; ls -l ~/docker
|
|
test:
|
|
override:
|
|
- cd docker; docker run -d -e SERVICEBOOK=http://localhost:5001/api/ -i -p 127.0.0.1:5000:80 app:build; sleep 10
|
|
- curl --retry 10 --retry-delay 5 -v 'http://localhost:5000/__version__'
|
|
deployment:
|
|
hub_latest:
|
|
branch: "master"
|
|
commands:
|
|
- "[ ! -z $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:
|
|
- "[ ! -z $DOCKERHUB_REPO ]"
|
|
- docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS
|
|
- "docker tag app:build ${DOCKERHUB_REPO}:${CIRCLE_TAG}"
|
|
- "docker images"
|
|
- "docker push ${DOCKERHUB_REPO}:${CIRCLE_TAG}"
|
|
hub_testing:
|
|
branch: /testing_.*/
|
|
commands:
|
|
- docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS
|
|
- "docker tag app:build ${DOCKERHUB_REPO}:${CIRCLE_BRANCH}"
|
|
- "docker push ${DOCKERHUB_REPO}:${CIRCLE_BRANCH}"
|