-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.yml
96 lines (80 loc) · 2.57 KB
/
config.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
version: 2
jobs:
build:
docker:
- image: circleci/openjdk:8-jdk
# Specify service dependencies here if necessary
# CircleCI maintains a library of pre-built images
# documented at https://circleci.com/docs/2.0/circleci-images/
# - image: circleci/postgres:9.4
working_directory: ~/repo
environment:
# Customize the JVM maximum heap limit
JVM_OPTS: -Xmx3200m
TERM: dumb
steps:
- checkout
- setup_remote_docker
- restore_cache:
keys:
- v1-docker-{{ .Branch }}
paths:
- ~/caches/app.tar
- run:
name: Load Docker image layer cache
command: |
set +o pipefail
docker load -i ~/caches/app.tar | true
- run:
name: Authenticate DockerHub
command: |
docker login -u ${DOCKERHUB_USERNAME} -p "${DOCKERHUB_PASSWORD}"
# Download and cache dependencies
- restore_cache:
keys:
- v1-m2dependencies-{{ checksum "build.sbt" }}
# fallback to using the latest cache if no exact match is found
- v1-m2dependencies-
- run: cat /dev/null | sbt test:compile
- save_cache:
paths:
- ~/.m2
key: v1-m2dependencies--{{ checksum "build.sbt" }}
# run tests!
- run: cat /dev/null | sbt test:test
- run:
name: Build Docker app
command: |
sbt playUpdateSecret dist
pushd ./target/universal
rm -rf ./tmp ./dist
unzip ./spike-rules-engine-*.zip -d ./tmp
mv ./tmp/spike-rules-engine-* ./dist
rm -rf ./tmp
popd
docker build --cache-from=app -t app .
- run:
name: Save Docker image layer cache
command: |
mkdir -p ~/caches
docker save -o ~/caches/app.tar app
- save_cache:
key: v1-docker-{{ .Branch }}-{{ epoch }}
paths:
- ~/caches/app.tar
- deploy:
name: Push application Docker image
command: |
if [ "${CIRCLE_BRANCH}" == "master" ]; then
export DOCKER_IMAGE=faizhasim/spike-rules-engine
docker tag app "${DOCKER_IMAGE}:${CIRCLE_SHA1}"
docker tag app "${DOCKER_IMAGE}:latest"
docker push "${DOCKER_IMAGE}:${CIRCLE_SHA1}"
docker push "${DOCKER_IMAGE}:latest"
fi
- run:
name: Run E2E Test
command: |
pushd e2etest
./hack/runtest.sh
popd