-
Notifications
You must be signed in to change notification settings - Fork 3
/
bitbucket-pipelines.yml
28 lines (27 loc) · 1018 Bytes
/
bitbucket-pipelines.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
pipelines:
default:
- step:
name: build
max-time: 10
services:
- docker
script:
- export IMAGE_NAME=$DOCKER_REPO/hqhero:$BITBUCKET_BRANCH
# authenticate with the our docker registry
- docker login $DOCKER_REPO --username $DOCKER_REPO_USERNAME --password $DOCKER_REPO_PASSWORD
# Use the old image on the server to help with build
- docker pull $IMAGE_NAME || true
- docker build --cache-from $IMAGE_NAME -t $IMAGE_NAME .
#- docker build -t $IMAGE_NAME .
# push the new Docker image to the Docker registry
- docker push $IMAGE_NAME
- step:
name: Deploy
deployment: production # can be test, staging or production
script:
# Log into the server and redeploy the stack
- ssh $DEPLOYMENT_USER@$HQHERO_SERVER docker stack deploy --with-registry-auth -c $STACK_FILE --prune $STACK
definitions:
services:
docker:
memory: 2048