-
Notifications
You must be signed in to change notification settings - Fork 2
/
bitbucket-pipelines.yml
32 lines (31 loc) · 1.59 KB
/
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
29
30
31
32
# This is a sample build configuration for JavaScript.
# Check our guides at https://confluence.atlassian.com/x/14UWN for more examples.
# Only use spaces to indent your .yml configuration.
# -----
# You can specify a custom docker image from Docker Hub as your build environment.
image: node:6.9.4
pipelines:
default:
- step:
caches:
- node
script: # Modify the commands below to build your repository.
- npm install
- npm test
- docker login -u $DOCKER_USER -p $DOCKER_PASSWORD
branches:
master:
- step:
script:
- wget -P /var/tmp https://github.com/rancher/rancher-compose/releases/download/v0.12.3/rancher-compose-linux-amd64-v0.12.3.tar.gz
- tar xvzf /var/tmp/rancher-compose-linux-amd64-v0.12.3.tar.gz && mv rancher-compose-v0.12.3/rancher-compose /usr/bin/rancher-compose && chmod +x /usr/bin/rancher-compose
- npm install
- npm test
- docker pull $DOCKER_USER/$CONTAINER_RELEASE_IMAGE:${CI_BUILD_REF_NAME} || true
- docker build --cache-from $DOCKER_USER/$CONTAINER_RELEASE_IMAGE:${CI_BUILD_REF_NAME} -t $DOCKER_USER/$CONTAINER_RELEASE_IMAGE:commit-${BITBUCKET_COMMIT} .
- docker tag $DOCKER_USER/$CONTAINER_RELEASE_IMAGE:commit-${BITBUCKET_COMMIT} $DOCKER_USER/$CONTAINER_RELEASE_IMAGE:${CI_BUILD_REF_NAME}
- docker login -u $DOCKER_USER -p $DOCKER_PASSWORD
- docker push $DOCKER_USER/$CONTAINER_RELEASE_IMAGE:${CI_BUILD_REF_NAME}
- docker push $DOCKER_USER/$CONTAINER_RELEASE_IMAGE:commit-${BITBUCKET_COMMIT}
options:
docker: true