Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit c443ca2

Browse files
committed
deployment integration
1 parent f6c1321 commit c443ca2

File tree

4 files changed

+122
-0
lines changed

4 files changed

+122
-0
lines changed

.circleci/config.yml

+78
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
version: 2
2+
defaults: &defaults
3+
docker:
4+
- image: circleci/python:2.7-stretch-browsers
5+
install_dependency: &install_dependency
6+
name: Installation of build and deployment dependencies.
7+
command: |
8+
sudo apt install jq
9+
sudo pip install awscli --upgrade
10+
sudo pip install docker-compose
11+
install_deploysuite: &install_deploysuite
12+
name: Installation of install_deploysuite.
13+
command: |
14+
git clone --branch v1.4.1 https://github.com/topcoder-platform/tc-deploy-scripts ../buildscript
15+
cp ./../buildscript/master_deploy.sh .
16+
cp ./../buildscript/buildenv.sh .
17+
cp ./../buildscript/awsconfiguration.sh .
18+
restore_cache_settings_for_build: &restore_cache_settings_for_build
19+
key: docker-node-modules-{{ checksum "package-lock.json" }}
20+
21+
save_cache_settings: &save_cache_settings
22+
key: docker-node-modules-{{ checksum "package-lock.json" }}
23+
paths:
24+
- node_modules
25+
26+
builddeploy_steps: &builddeploy_steps
27+
- checkout
28+
- setup_remote_docker
29+
- run: *install_dependency
30+
- run: *install_deploysuite
31+
- restore_cache: *restore_cache_settings_for_build
32+
- run: ./build.sh
33+
- save_cache: *save_cache_settings
34+
- deploy:
35+
name: Running MasterScript.
36+
command: |
37+
./awsconfiguration.sh $DEPLOY_ENV
38+
source awsenvconf
39+
./buildenv.sh -e $DEPLOY_ENV -b ${DEPLOY_ENV}-${APPNAME}-deployvar
40+
source buildenvvar
41+
./master_deploy.sh -d ECS -e $DEPLOY_ENV -t latest -s ${DEPLOY_ENV}-global-appvar,${DEPLOY_ENV}-${APPNAME}-appvar -i ${APPNAME}
42+
43+
44+
jobs:
45+
# Build & Deploy against development backend
46+
"build-dev":
47+
<<: *defaults
48+
environment:
49+
DEPLOY_ENV: "dev"
50+
APPNAME: "topcoder-x-ui"
51+
steps: *builddeploy_steps
52+
53+
"build-prod":
54+
<<: *defaults
55+
environment:
56+
DEPLOY_ENV: "prod"
57+
APPNAME: "topcoder-x-ui"
58+
steps: *builddeploy_steps
59+
60+
workflows:
61+
version: 2
62+
build:
63+
jobs:
64+
# Development builds are executed on "develop" branch only.
65+
- "build-dev":
66+
context : org-global
67+
filters:
68+
branches:
69+
only:
70+
- develop
71+
72+
# Production builds are exectuted only on tagged commits to the
73+
# master branch.
74+
- "build-prod":
75+
context : org-global
76+
filters:
77+
branches:
78+
only: master

build.sh

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash
2+
set -eo pipefail
3+
APP_NAME="topcoder-x-ui"
4+
UPDATE_CACHE=""
5+
docker-compose -f docker/docker-compose.yml build $APP_NAME
6+
docker create --name app $APP_NAME:latest
7+
8+
if [ -d node_modules ]
9+
then
10+
mv package-lock.json old-package-lock.json
11+
docker cp app:/$APP_NAME/package-lock.json package-lock.json
12+
set +eo pipefail
13+
UPDATE_CACHE=$(cmp package-lock.json old-package-lock.json)
14+
set -eo pipefail
15+
else
16+
UPDATE_CACHE=1
17+
fi
18+
19+
if [ "$UPDATE_CACHE" == 1 ]
20+
then
21+
docker cp app:/$APP_NAME/node_modules .
22+
fi

docker/Dockerfile

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Use the base image with Node.js
2+
FROM node:8.12
3+
4+
# Copy the current directory into the Docker image
5+
COPY . /topcoder-x-ui
6+
7+
# Set working directory for future use
8+
WORKDIR /topcoder-x-ui
9+
10+
# Install the dependencies from package.json
11+
RUN npm install
12+
RUN npm run build
13+
#RUN npm test
14+
15+
CMD npm start

docker/docker-compose.yml

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
version: '3'
2+
services:
3+
topcoder-x-ui:
4+
image: topcoder-x-ui:latest
5+
build:
6+
context: ../
7+
dockerfile: docker/Dockerfile

0 commit comments

Comments
 (0)