File tree 1 file changed +71
-0
lines changed
1 file changed +71
-0
lines changed Original file line number Diff line number Diff line change
1
+ version : 2.1
2
+ executors :
3
+ docker-publisher :
4
+ environment :
5
+ IMAGE_NAME : openintegrationhub/contacts-transformer-template
6
+ docker :
7
+ - image : circleci/node:8-stretch
8
+ jobs :
9
+ build :
10
+ executor : docker-publisher
11
+ working_directory : ~/repo
12
+ steps :
13
+ - checkout
14
+ # Download and cache dependencies
15
+ - restore_cache :
16
+ keys :
17
+ - v1-dependencies-{{ checksum "package.json" }}
18
+ # Fallback to using the latest cache if no exact match is found
19
+ - v1-dependencies-
20
+
21
+ - run : yarn install
22
+ - save_cache :
23
+ paths :
24
+ - node_modules
25
+ key : v1-dependencies-{{ checksum "package.json" }}
26
+
27
+ # Run tests
28
+ - run : yarn test
29
+ - setup_remote_docker
30
+
31
+ # Build docker image
32
+ - run :
33
+ command : docker build -t $IMAGE_NAME .
34
+ # Make docker image persistent for other jobs
35
+ - run :
36
+ name : Archive Docker image
37
+ command : docker save -o image.tar $IMAGE_NAME
38
+ - persist_to_workspace :
39
+ root : .
40
+ paths :
41
+ - ./image.tar
42
+ - run :
43
+ command : docker images
44
+ # Publish the image on Dockerhub
45
+ publish-latest :
46
+ executor : docker-publisher
47
+ steps :
48
+ - attach_workspace :
49
+ at : /tmp/workspace
50
+ - setup_remote_docker
51
+ - run :
52
+ name : Load archived Docker image
53
+ command : docker load -i /tmp/workspace/image.tar
54
+ - run :
55
+ command : |
56
+ echo "$DOCKERHUB_PASS" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin
57
+ docker push openintegrationhub/contacts-transformer-template:latest
58
+ workflows :
59
+ version : 2
60
+ build-master :
61
+ jobs :
62
+ - build :
63
+ filters :
64
+ branches :
65
+ only : master
66
+ - publish-latest :
67
+ requires :
68
+ - build
69
+ filters :
70
+ branches :
71
+ only : master
You can’t perform that action at this time.
0 commit comments