File tree Expand file tree Collapse file tree 3 files changed +148
-12
lines changed
Expand file tree Collapse file tree 3 files changed +148
-12
lines changed Original file line number Diff line number Diff line change 1+ # Use the latest 2.1 version of CircleCI pipeline process engine. See: https://circleci.com/docs/2.0/configuration-reference
2+ version : 2.1
3+
4+ orbs :
5+ aws-s3 : circleci/aws-s3@2.0.0
6+
7+ workflows :
8+ version : 2
9+ build-deploy :
10+ jobs :
11+ - build-image
12+ - build :
13+ requires :
14+ - build-image
15+ - test :
16+ requires :
17+ - build-image
18+ - sync-firebase :
19+ requires :
20+ - build
21+ - test
22+ filters :
23+ branches :
24+ only : master
25+ - deploy :
26+ requires :
27+ - build
28+ - test
29+ filters :
30+ branches :
31+ only : master
32+ - push-image :
33+ requires :
34+ - build
35+ - test
36+ filters :
37+ branches :
38+ only : master
39+
40+ jobs :
41+ build-image :
42+ machine : true
43+ steps :
44+ - checkout
45+ - run :
46+ name : Build Docker image
47+ command : build/install.sh
48+ - run :
49+ name : Save image to workspace
50+ command : |
51+ mkdir -pv images
52+ docker save -o images/popcode.tar popcode
53+ - persist_to_workspace :
54+ root : .
55+ paths :
56+ - ' images'
57+ - ' build'
58+
59+ test :
60+ machine : true
61+ steps :
62+ - attach_workspace :
63+ at : .
64+ - run :
65+ name : Load image from workspace
66+ command : docker load -i images/popcode.tar
67+ - run :
68+ name : Run tests
69+ command : build/test.sh
70+
71+ build :
72+ machine : true
73+ steps :
74+ - attach_workspace :
75+ at : .
76+ - run :
77+ name : Load image from workspace
78+ command : docker load -i images/popcode.tar
79+ - run :
80+ name : Build application
81+ command : build/build.sh
82+ - persist_to_workspace :
83+ root : .
84+ paths :
85+ - ' dist'
86+
87+ sync-firebase :
88+ machine : true
89+ steps :
90+ - attach_workspace :
91+ at : .
92+ - run :
93+ name : Load image from workspace
94+ command : docker load -i images/popcode.tar
95+ - run :
96+ name : Sync configuration to Firebase
97+ command : |
98+ docker run
99+ --env FIREBASE_APP
100+ --env FIREBASE_SECRET
101+ popcode
102+ yarn run gulp syncFirebase
103+
104+ deploy :
105+ docker :
106+ - image : cimg/base:stable
107+ steps :
108+ - attach_workspace :
109+ at : .
110+ - aws-s3/sync :
111+ from : dist
112+ to : ' s3://popcode.org/'
113+ arguments : |
114+ --acl public-read
115+ - aws-s3/sync :
116+ from : dist
117+ to : ' s3://popcode.school/'
118+ arguments : |
119+ --acl public-read
120+
121+ push-image :
122+ machine : true
123+ steps :
124+ - run :
125+ name : Push image to Docker Hub
126+ command : |
127+ echo "$DOCKER_PASS" | docker login --username "$DOCKER_USER" --password-stdin
128+ docker tag popcode popcodeorg/popcode
129+ docker push popcodeorg/popcode
Original file line number Diff line number Diff line change 1- FROM node:12.18.4
2-
3- RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && \
4- sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' && \
5- apt-get update && \
6- apt-get install -y google-chrome-stable
1+ FROM node:12.18.4-alpine
72
83ENV YARN_VERSION 1.22.0
94
10- RUN curl -fsSLO --compressed "https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz" \
5+ RUN apk add shadow bash \
6+ && usermod --shell /bin/bash root \
7+ && apk del shadow
8+
9+ RUN apk add curl \
10+ && curl -fsSLO --compressed "https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz" \
1111 && tar -xzf yarn-v$YARN_VERSION.tar.gz -C /opt/ \
1212 && ln -snf /opt/yarn-v$YARN_VERSION/bin/yarn /usr/local/bin/yarn \
1313 && ln -snf /opt/yarn-v$YARN_VERSION/bin/yarnpkg /usr/local/bin/yarnpkg \
14- && rm yarn-v$YARN_VERSION.tar.gz
14+ && rm yarn-v$YARN_VERSION.tar.gz \
15+ && apk del curl
1516
1617RUN echo '{"allow_root": true}' > /root/.bowerrc
1718
1819WORKDIR /app
1920
2021COPY package.json yarn.lock bower.json /app/
21- RUN yarn install --frozen-lockfile
22+ RUN apk add git \
23+ && yarn install --frozen-lockfile \
24+ && yarn cache clean \
25+ && apk del git
2226
2327COPY . /app/
Original file line number Diff line number Diff line change 33set -ex
44
55docker run \
6- --rm \
6+ --name popcode-build \
77 --env NODE_ENV=production \
88 --env FIREBASE_APP \
99 --env FIREBASE_APP_ID \
1010 --env FIREBASE_API_KEY \
1111 --env FIREBASE_CLIENT_ID \
1212 --env FIREBASE_MEASUREMENT_ID \
1313 --env FIREBASE_PROJECT_ID \
14- --env GIT_REVISION=" $TRAVIS_COMMIT " \
14+ --env GIT_REVISION=" $CIRCLE_SHA1 " \
1515 --env MIXPANEL_TOKEN \
16- --volume=" $TRAVIS_BUILD_DIR /dist:/app/dist" \
1716 popcode \
1817 yarn run gulp build
18+
19+ docker cp popcode-build:/app/dist ./
20+
21+ docker rm popcode-build
You can’t perform that action at this time.
0 commit comments