fix(docker): Only build docker image on master or tag (#4644) r=vladikoff
This commit is contained in:
Родитель
6bf3da922e
Коммит
ffddf10dfb
45
circle.yml
45
circle.yml
|
@ -29,3 +29,48 @@ test:
|
||||||
# retry the build if the attempt failed
|
# retry the build if the attempt failed
|
||||||
- retry -n 1 -- npm run test-circle firefoxBinary=/home/ubuntu/fxa-content-server/firefox/firefox:
|
- retry -n 1 -- npm run test-circle firefoxBinary=/home/ubuntu/fxa-content-server/firefox/firefox:
|
||||||
parallel: true
|
parallel: true
|
||||||
|
|
||||||
|
# appropriately tag and push the container to dockerhub
|
||||||
|
deployment:
|
||||||
|
hub_latest:
|
||||||
|
branch: "master"
|
||||||
|
commands:
|
||||||
|
- "[ ! -z $DOCKERHUB_REPO ]"
|
||||||
|
- git clean -d --force -x
|
||||||
|
- docker info
|
||||||
|
- mkdir -p config
|
||||||
|
- >
|
||||||
|
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-content-server:build .
|
||||||
|
- docker login -e "$DOCKER_EMAIL" -u "$DOCKER_USER" -p "$DOCKER_PASS"
|
||||||
|
- "docker tag fxa-content-server:build ${DOCKERHUB_REPO}:latest"
|
||||||
|
- "docker push ${DOCKERHUB_REPO}:latest"
|
||||||
|
|
||||||
|
hub_releases:
|
||||||
|
# push all tags
|
||||||
|
tag: /.*/
|
||||||
|
commands:
|
||||||
|
- "[ ! -z $DOCKERHUB_REPO ]"
|
||||||
|
- git clean -d --force -x
|
||||||
|
- docker info
|
||||||
|
- mkdir -p config
|
||||||
|
- >
|
||||||
|
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-content-server:build .
|
||||||
|
- docker login -e "$DOCKER_EMAIL" -u "$DOCKER_USER" -p "$DOCKER_PASS"
|
||||||
|
- "echo ${DOCKERHUB_REPO}:${CIRCLE_TAG}"
|
||||||
|
- "docker tag fxa-content-server:build ${DOCKERHUB_REPO}:${CIRCLE_TAG}"
|
||||||
|
- "docker images"
|
||||||
|
- "docker push ${DOCKERHUB_REPO}:${CIRCLE_TAG}"
|
||||||
|
|
Загрузка…
Ссылка в новой задаче