Skip to content

Commit 2137fbf

Browse files
committed
circleci integration
1 parent b14cd21 commit 2137fbf

File tree

4 files changed

+95
-0
lines changed

4 files changed

+95
-0
lines changed

.circleci/config.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
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.3 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+
19+
build_steps: &build_steps
20+
- checkout
21+
- setup_remote_docker
22+
- run: *install_dependency
23+
- run: *install_deploysuite
24+
- run: ./build.sh
25+
- deploy:
26+
name: Running MasterScript.
27+
command: |
28+
./awsconfiguration.sh ${DEPLOY_ENV}
29+
source awsenvconf
30+
#./buildenv.sh -e ${DEPLOY_ENV} -b ${LOGICAL_ENV}-${APP_NAME}-deployvar
31+
#source buildenvvar
32+
#./master_deploy.sh -d ECS -e ${DEPLOY_ENV} -t latest -s dev-global-appvar,${LOGICAL_ENV}-${APP_NAME}-appvar -i terms-service
33+
34+
jobs:
35+
# Build & Deploy against development backend
36+
"build-dev":
37+
<<: *defaults
38+
environment:
39+
DEPLOY_ENV: "DEV"
40+
LOGICAL_ENV: "DEV"
41+
APP_NAME: "terms-service"
42+
steps: *build_steps
43+
# Build & Deploy against production backend
44+
"build-prod":
45+
<<: *defaults
46+
environment:
47+
DEPLOY_ENV: "PROD"
48+
LOGICAL_ENV: "PROD"
49+
APP_NAME: "terms-service"
50+
steps: *build_steps
51+
workflows:
52+
version: 2
53+
build:
54+
jobs:
55+
# Development builds are executed on "develop" branch only.
56+
- "build-dev":
57+
context : org-global
58+
filters:
59+
branches:
60+
only:
61+
- dev
62+
- "build-prod":
63+
context : org-global
64+
filters:
65+
branches:
66+
only:
67+
- master

build.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
set -eo pipefail
3+
echo "" > docker/api.env
4+
docker-compose -f docker/docker-compose.yml build terms-service
5+
#docker images

docker/Dockerfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
# Use the base image with Node.js 12.0.0
3+
FROM node:12.0.0
4+
5+
# Copy the current directory into the Docker image
6+
RUN apt-get install -y curl
7+
COPY . /terms-service
8+
# Set working directory for future use
9+
WORKDIR /terms-service
10+
11+
# Install the dependencies from package.json
12+
RUN npm install
13+
CMD npm start

docker/docker-compose.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
version: '3'
2+
services:
3+
terms-service:
4+
image: terms-service:latest
5+
build:
6+
context: ../
7+
dockerfile: docker/Dockerfile
8+
env_file:
9+
- api.env
10+
network_mode: "host"

0 commit comments

Comments
 (0)