forked from unee-t/frontend
-
Notifications
You must be signed in to change notification settings - Fork 1
/
.travis.yml
97 lines (83 loc) · 2.97 KB
/
.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# Variables needed for this script are:
# Case 1: Stored on Travis Settings
# For all environments:
# - DOCKER_CI_REPO_NAME
# - DOCKER_USERNAME
# - DOCKER_PASSWORD
#For dev environment:
# - AWS_ACCOUNT_USER_ID_DEV
# - AWS_ACCOUNT_SECRET_DEV
# - AWS_PROFILE_DEV <-- is this needed?
#For Prod environment:
# - AWS_ACCOUNT_USER_ID_PROD
# - AWS_ACCOUNT_SECRET_PROD
# - AWS_PROFILE_PROD <-- is this needed?
#For Demo environment:
# - AWS_ACCOUNT_USER_ID_DEMO
# - AWS_ACCOUNT_SECRET_DEMO
# - AWS_PROFILE_DEMO <-- is this needed?
# Case 2: Created when Travis CI runs
# - IMAGE_TAG
# language: node_js
# node_js:
# - lts/*
language: generic
services:
- docker
env:
global:
- COMMIT=${TRAVIS_COMMIT::7}
#Add IMAGE_TAG variable to build docker image
- IMAGE_TAG=${TRAVIS_COMMIT::7}
before_install:
# Removed command as pyenv is no longer found during deploy
#- pyenv global 2.7.14 # For removing SNIMissingWarning warnings
- curl https://install.meteor.com | /bin/sh
- export PATH="$HOME/.meteor:$PATH"
- pip install --user awscli
- export PATH=$PATH:$HOME/.local/bin
- curl -o $HOME/.local/bin/ecs-cli
https://s3.amazonaws.com/amazon-ecs-cli/ecs-cli-linux-amd64-latest &&
chmod +x $HOME/.local/bin/ecs-cli
# cache:
# directories:
# - node_modules
install:
# build the docker image that will deploy the code
- docker build -t $DOCKER_CI_REPO_NAME .
# script:
# - npm t
# Adding script deploy docker image to docker repository
# after_success:
# Update the docker image in the Dockerhub repository
# - docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD";
# - docker build -t $DOCKER_CI_REPO_NAME:latest .
# - docker tag $DOCKER_CI_REPO_NAME:latest $DOCKER_CI_REPO_NAME:$IMAGE_TAG
# - docker push $DOCKER_CI_REPO_NAME:latest
# - docker push $DOCKER_CI_REPO_NAME:$IMAGE_TAG
matrix:
include:
# add deploy stage for dev
- env: DEPLOY=dev
if: branch = master
deploy:
provider: script
# We need to set variables that are comming from travis ci setting
# Variables:
# - DOCKER_CI_REPO_NAME
# - AWS_PROFILE_DEV
# - AWS_ACCOUNT_USER_ID_DEV
# - AWS_ACCOUNT_SECRET_DEV
# - AWS_DEFAULT_REGION
script: TRAVIS_DOCKER_REPO_NAME=$DOCKER_CI_REPO_NAME TRAVIS_PROFILE=$AWS_PROFILE_DEV TRAVIS_AWS_ACCESS_KEY_ID=$AWS_ACCOUNT_USER_ID_DEV TRAVIS_AWS_SECRET_ACCESS_KEY=$AWS_ACCOUNT_SECRET_DEV TRAVIS_AWS_DEFAULT_REGION=$AWS_DEFAULT_REGION ./deploy.sh -d
on:
branch: master
# Add deploy stage for PROD
- env: DEPLOY=prod
if: tag IS present
deploy:
provider: script
script: TRAVIS_DOCKER_REPO_NAME=$DOCKER_CI_REPO_NAME TRAVIS_PROFILE=$AWS_PROFILE_PROD TRAVIS_AWS_ACCESS_KEY_ID=$AWS_ACCOUNT_USER_ID_PROD TRAVIS_AWS_SECRET_ACCESS_KEY=$AWS_ACCOUNT_SECRET_PROD TRAVIS_AWS_DEFAULT_REGION=$AWS_DEFAULT_REGION ./deploy.sh -p
on:
branch: master
tags: true