зеркало из https://github.com/mozilla/doorman.git
Merge pull request #66 from mozilla/add-circle-ci
Enable CircleCI config (fixes #56)
This commit is contained in:
Коммит
e426113b68
|
@ -0,0 +1,63 @@
|
|||
# These environment variables must be set in CircleCI UI
|
||||
#
|
||||
# DOCKERHUB_REPO - docker hub repo, format: <username>/<repo>
|
||||
# DOCKER_EMAIL - login info for docker hub
|
||||
# DOCKER_USER
|
||||
# DOCKER_PASS
|
||||
#
|
||||
machine:
|
||||
services:
|
||||
- docker
|
||||
|
||||
dependencies:
|
||||
cache_directories:
|
||||
- "~/docker"
|
||||
|
||||
pre:
|
||||
- sudo apt-get update; sudo apt-get install pigz
|
||||
|
||||
override:
|
||||
- docker info
|
||||
|
||||
# Build the container, using Circle's Docker cache. Only use 1 image per
|
||||
# day to keep the cache size down.
|
||||
- I="image-$(date +%j).gz"; if [[ -e ~/docker/$I ]]; then echo "Loading $I"; pigz -d -c ~/docker/$I | docker load; fi
|
||||
|
||||
# create a version.json
|
||||
- >
|
||||
printf '{"name":"%s","commit":"%s","version":"%s","source":"https://github.com/%s/%s","build":"%s"}\n'
|
||||
"doorman"
|
||||
"$CIRCLE_SHA1"
|
||||
"$CIRCLE_TAG"
|
||||
"mozilla"
|
||||
"$CIRCLE_PROJECT_REPONAME"
|
||||
"$CIRCLE_BUILD_URL"
|
||||
> version.json
|
||||
|
||||
# build the actual deployment container
|
||||
- docker build --pull -t app .
|
||||
|
||||
# Clean up any old images; save the new one.
|
||||
- I="image-$(date +%j).gz"; mkdir -p ~/docker; rm ~/docker/*; docker save app | pigz --fast -c > ~/docker/$I; ls -l ~/docker
|
||||
|
||||
# appropriately tag and push the container to dockerhub
|
||||
deployment:
|
||||
hub_latest:
|
||||
branch: "master"
|
||||
commands:
|
||||
- "[ ! -z $DOCKERHUB_REPO ]"
|
||||
- "docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS"
|
||||
- "docker images"
|
||||
- "docker tag app ${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"
|
||||
- "echo ${DOCKERHUB_REPO}:${CIRCLE_TAG}"
|
||||
- "docker tag app ${DOCKERHUB_REPO}:${CIRCLE_TAG}"
|
||||
- "docker images"
|
||||
- "docker push ${DOCKERHUB_REPO}:${CIRCLE_TAG}"
|
Загрузка…
Ссылка в новой задаче