forked from knownasilya/testing-express-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
34 lines (29 loc) · 893 Bytes
/
.travis.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
sudo: required
language: bash
services:
- docker
env:
global:
- DOCKER_IMAGE=pfragoso/testing-express-api
stages:
- name: build
if: branch = master
- name: deploy
if: branch = master
jobs:
include:
- stage: build
script:
- docker login --username "$DOCKER_USERNAME" --password "$DOCKER_PASSWORD"
- docker build --rm --tag "$DOCKER_IMAGE":"$TRAVIS_COMMIT" .
- docker build --rm --tag "$DOCKER_IMAGE":latest .
- docker images
- docker run --rm "$DOCKER_IMAGE":"$TRAVIS_COMMIT" yarn run test
- docker run --rm --detach --publish 127.0.0.1:3000:3000 "$DOCKER_IMAGE":"$TRAVIS_COMMIT"
- docker ps
- sleep 5
- curl -I http://127.0.0.1:3000/api/users
- docker push "$DOCKER_IMAGE":"$TRAVIS_COMMIT"
- docker push "$DOCKER_IMAGE":latest
- stage: deploy
script: ./scripts/deploy.sh