Skip to content
This repository was archived by the owner on Feb 22, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 100 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
version: 2.1
orbs:
k8s: circleci/kubernetes@0.7.0
commands:
git_checkout_from_cache:
description: "Git checkout and save cache"
steps:
- restore_cache:
name: Git restore cache
keys:
- source-v1-{{ .Branch }}-{{ .Revision }}
- source-v1-{{ .Branch }}-
- source-v1-
- run:
name: Fetch git tags
command: |
mkdir -p ~/.ssh
echo 'github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== ' >> ~/.ssh/known_hosts
# Fetch tags if git cache is present
if [ -e /home/circleci/project/.git ]
then
git fetch origin --tags
fi
- checkout
- run:
name: Compress git objects
command: git gc
- save_cache:
name: Git save cache
key: source-v1-{{ .Branch }}-{{ .Revision }}
paths:
- ".git"

npm_install:
description: "Install npm modules"
steps:
- restore_cache:
name: Restore npm cache
keys:
- npm-v1-{{ checksum "package.json" }}
- npm-v1-
- run:
name: Install npm modules
command: npm install
- save_cache:
name: Save NPM cache
key: npm-v1-{{ checksum "package.json" }}
paths:
- "node_modules"

build:
description: "Build"
steps:
- run:
name: "Grunt deploy"
command: npm run deploy-ci

docker:
description: "Build and Push image to docker hub"
steps:
- setup_remote_docker
- run:
name: Building docker image
command: |
docker build -t ${DOCKHUB_ORGANISATION}/binary-static-webtrader:${CIRCLE_SHA1} .
- run:
name: Pushing Image to docker hub
command: |
echo $DOCKERHUB_PASSWORD | docker login -u $DOCKERHUB_USERNAME --password-stdin
docker push ${DOCKHUB_ORGANISATION}/binary-static-webtrader:${CIRCLE_SHA1}

k8s_deploy:
description: "Deploy to k8s cluster"
steps:
- k8s/install-kubectl
- run:
name: Deploying to k8s cluster for service binary-webtrader
command: |
echo $CA_CRT | base64 --decode > ca.crt
kubectl --server=${KUBE_SERVER} --certificate-authority=ca.crt --token=$SERVICEACCOUNT_TOKEN set image deployment/webtrader-binary-com webtrader-binary-com=${DOCKHUB_ORGANISATION}/binary-static-webtrader:${CIRCLE_SHA1}

jobs:
release:
docker:
- image: circleci/node:12.13.0-stretch
steps:
- git_checkout_from_cache
- npm_install
- build
- docker
- k8s_deploy

workflows:
release:
jobs:
- release:
filters:
branches:
only: /^master$/

2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.git
Dockerfile
21 changes: 0 additions & 21 deletions .travis.yml

This file was deleted.

3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM nginx:alpine
COPY ./dist/compressed /usr/share/nginx/html
COPY ./default.conf /etc/nginx/conf.d/default.conf
1 change: 1 addition & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ module.exports = function (grunt) {
}
}

grunt.file.setBase('./');
grunt.initConfig({
pkg,
githash: {
Expand Down
22 changes: 22 additions & 0 deletions default.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
server {
listen 80;
server_name localhost;

add_header Cache-Control "public, max-age=7200, s-maxage=600, must-revalidate";
charset UTF-8;

error_page 404 /404.html;

location @custom_error_503 {
return 503;
}

location ~ /\.git {
return 404;
}

location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"node-sass": "^4.12.0"
},
"scripts": {
"deploy-ci": "grunt",
"deploy-branch": "grunt deploy-branch",
"deploy-gh-pages": "grunt deploy",
"start": "grunt && concurrently -k \"grunt watch\" \"grunt connect\"",
Expand Down