59 строки
1.8 KiB
YAML
59 строки
1.8 KiB
YAML
# 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
|
|
- mysql
|
|
|
|
dependencies:
|
|
override:
|
|
- docker info
|
|
|
|
- >
|
|
printf '{"version":{"hash":"%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"
|
|
| tee config/version.json version.json
|
|
|
|
- docker build -f Dockerfile-build -t fxa-auth-db-mysql:build .
|
|
- docker build -f Dockerfile-test -t fxa-auth-db-mysql:test .
|
|
|
|
test:
|
|
override:
|
|
- docker run --net="host" fxa-auth-db-mysql:test npm test
|
|
|
|
# appropriately tag and push the container to dockerhub
|
|
deployment:
|
|
hub_latest:
|
|
# push certain branches, they are used by fxa-dev for deployment
|
|
branch: /^(master|feature.*|dockerpush.*)$/
|
|
commands:
|
|
- "[ ! -z $DOCKERHUB_REPO ]"
|
|
- docker login -e "$DOCKER_EMAIL" -u "$DOCKER_USER" -p "$DOCKER_PASS"
|
|
- |
|
|
if [ $CIRCLE_BRANCH = "master" ]; then
|
|
CIRCLE_BRANCH=latest
|
|
fi
|
|
echo ${DOCKERHUB_REPO}:${CIRCLE_BRANCH}
|
|
docker tag fxa-auth-db-mysql:build ${DOCKERHUB_REPO}:${CIRCLE_BRANCH}
|
|
docker push ${DOCKERHUB_REPO}:${CIRCLE_BRANCH}
|
|
|
|
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 fxa-auth-db-mysql:build ${DOCKERHUB_REPO}:${CIRCLE_TAG}"
|
|
- "docker images"
|
|
- "docker push ${DOCKERHUB_REPO}:${CIRCLE_TAG}"
|