-
Notifications
You must be signed in to change notification settings - Fork 85
/
Copy pathcircle.yml
49 lines (46 loc) · 1.71 KB
/
circle.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
machine:
services:
- docker
environment:
IMAGE_NAME: mysql
DOCKER_PROJECT: bitnami
GCLOUD_PROJECT: bitnami-containers
dependencies:
override:
- docker info
- gcloud version
- docker pull $DOCKER_PROJECT/$IMAGE_NAME:_ || true
test:
override:
- docker build --rm=false -t $DOCKER_PROJECT/$IMAGE_NAME:$CIRCLE_BUILD_NUM .
deployment:
cache:
branch: master
commands:
- >
if [ -n "$DOCKER_PASS" ]; then
docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS
docker build --rm=false -t $DOCKER_PROJECT/$IMAGE_NAME:_ .
docker push $DOCKER_PROJECT/$IMAGE_NAME:_
fi
release:
tag: /^[0-9].*-r[0-9]+$/
commands:
- >
if [ -n "$DOCKER_PASS" ]; then
docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS
docker build --rm=false -t $DOCKER_PROJECT/$IMAGE_NAME:$CIRCLE_TAG .
docker tag $DOCKER_PROJECT/$IMAGE_NAME:$CIRCLE_TAG $DOCKER_PROJECT/$IMAGE_NAME:latest
docker push $DOCKER_PROJECT/$IMAGE_NAME:$CIRCLE_TAG
docker push $DOCKER_PROJECT/$IMAGE_NAME:latest
fi
- >
if [ -n "$GCLOUD_SERVICE_KEY" ]; then
echo $GCLOUD_SERVICE_KEY | base64 --decode > ${HOME}/gcloud-service-key.json
gcloud auth activate-service-account --key-file ${HOME}/gcloud-service-key.json
echo 'ENV BITNAMI_CONTAINER_ORIGIN=GCR' >> Dockerfile
docker build --rm=false -t gcr.io/$GCLOUD_PROJECT/$IMAGE_NAME:$CIRCLE_TAG .
docker tag gcr.io/$GCLOUD_PROJECT/$IMAGE_NAME:$CIRCLE_TAG gcr.io/$GCLOUD_PROJECT/$IMAGE_NAME:latest
gcloud docker -- push gcr.io/$GCLOUD_PROJECT/$IMAGE_NAME:$CIRCLE_TAG
gcloud docker -- push gcr.io/$GCLOUD_PROJECT/$IMAGE_NAME:latest
fi