From 70e3c16c55c5938fe2260f4e2598b36ac0e9fdc9 Mon Sep 17 00:00:00 2001
From: Dmytro <dbogatov@wpi.edu>
Date: Mon, 13 Feb 2017 19:34:30 -0500
Subject: [PATCH] Add CI and Docker.

---
 .deploy.sh     |  24 -------------------
 .dockerignore  |  11 +++++++++
 .editorconfig  |  14 ++++++++++++
 .gitignore     |   1 +
 .gitlab-ci.yml |  61 +++++++++++++++++++++++++++++++++++++++++++++----
 Dockerfile     |  16 +++++++++++++
 build.sh       |  11 +++++++++
 favicon.ico    | Bin 1150 -> 0 bytes
 nginx.conf     |  14 ++++++++++++
 package.json   |   7 ++++++
 10 files changed, 130 insertions(+), 29 deletions(-)
 delete mode 100755 .deploy.sh
 create mode 100644 .dockerignore
 create mode 100644 .editorconfig
 create mode 100644 Dockerfile
 create mode 100755 build.sh
 delete mode 100644 favicon.ico
 create mode 100644 nginx.conf
 create mode 100644 package.json

diff --git a/.deploy.sh b/.deploy.sh
deleted file mode 100755
index 793decb..0000000
--- a/.deploy.sh
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/bash
-
-set -e
-
-printf "\n\n\n\n-------\n\n"
-
-echo $(date --rfc-3339=seconds)
-
-SOURCE="${BASH_SOURCE[0]}"
-while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
-  DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
-  SOURCE="$(readlink "$SOURCE")"
-  [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
-done
-DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
-
-cd $DIR
-
-git fetch origin
-git reset --hard origin/master
-
-bower install
-
-curl --request POST 'https://push.dbogatov.org/api/push/deploy' --data "project=Inara-CV"
diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 0000000..fc7284b
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,11 @@
+Dockerfile
+.gitlab-ci.yml
+.editorconfig
+README.md
+.git
+bower.json
+.bowerrc
+.gitignore
+build.sh
+package.json
+node_modules/
diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000..1a59ed3
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,14 @@
+# http://editorconfig.org
+root = true
+
+[*]
+indent_style = tab
+indent_size = 4
+end_of_line = lf
+charset = utf-8
+trim_trailing_whitespace = false
+insert_final_newline = true
+
+[*.yml]
+indent_style = space
+indent_size = 2
diff --git a/.gitignore b/.gitignore
index 6dbf631..f803d44 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
 bower/
+node_modules/
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 776915c..e26d521 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,6 +1,57 @@
-production:
-  type: deploy
+stages:
+- build
+- test
+- release
+
+build:
+  image: mhart/alpine-node
+  stage: build
+  script: 
+  - ./build.sh
+  artifacts:
+    expire_in: 30 min
+    paths:
+    - index.html
+    - js/
+    - css/
+    - img/
+    - bower/
+  tags:
+  - Docker
+
+tidy:
+  image: dbogatov/docker-containers:jekyll-latest
+  stage: test
+  dependencies:
+  - build
+  before_script:
+  - http-server -p 8080 > /dev/null &
+  - sleep 5
   script:
-  - curl --request POST 'https://deploy.dbogatov.org/deploy' --data "token=$TOKEN" --data "project=Inara-CV"
-  only:
-  - master
\ No newline at end of file
+  - curl -Ls http://localhost:8080/index.html | tidy -e
+  tags:
+  - Docker
+  
+blc:
+  image: dbogatov/docker-containers:jekyll-latest
+  stage: test
+  dependencies:
+  - build
+  before_script:
+  - http-server -p 8080 > /dev/null &
+  - sleep 5
+  script:
+  - blc --filter-level 3 --input http://localhost:8080/index.html -rog --exclude "*linkedin.*"
+  tags:
+  - Docker
+
+dockerify:
+  stage: release
+  dependencies:
+  - build
+  script:
+  - docker build -t registry.dbogatov.org/dbogatov/inara-cv .
+  - docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN registry.dbogatov.org
+  - docker push registry.dbogatov.org/dbogatov/inara-cv
+  tags:
+  - Shell
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..90a4ce5
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,16 @@
+FROM dbogatov/docker-containers:nginx-latest
+
+MAINTAINER Dmytro Bogatov dmytro@dbogatov.org
+
+WORKDIR /srv
+
+# Copy the source
+COPY . .
+
+# Copy the NGINX config
+COPY nginx.conf /etc/nginx/conf.d/default.conf
+
+# Remove NGINX config from source
+RUN rm nginx.conf
+
+CMD ["nginx", "-g", "daemon off;"]
diff --git a/build.sh b/build.sh
new file mode 100755
index 0000000..307f5af
--- /dev/null
+++ b/build.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+set -e
+
+echo "Installing node modules... Requires NPM"
+npm install --loglevel=error > /dev/null
+
+echo "Installing Bower libraries... Requires Bower (installed by NPM)"
+$(npm bin)/bower install > /dev/null
+
+echo "Build completed!"
diff --git a/favicon.ico b/favicon.ico
deleted file mode 100644
index ef65eb31cc85223d5999fc3bbad7fb1af5c00dbd..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001

literal 1150
zcmZQzU}Ruq5D);-3Je)63=Con3=A3!3=9Gc3=9ek5OD?&U}0bo;)Y-l7lfOdn*R6q
z_x}$K4gIgGstRUzc69#l?(Y6SdGh4{U0q%O+uGXxhlPdx=i=h}FDfburae47!16Ht
zAt53E+1c6uyScgjpE+~Z|Cuvp{+~H>=Ktx_rvGniYyWR#Wb~h#oBO|*nAm?oLBaoO
zYHI(Bi;Mp^H#h(9?d|=ao}T`nhll4sA0OX;Gc(iw6DLgkzi9E||FdV${y%N%G_Za)
zHa4(+kUEe#$;rw88yg${_w@Aq4+seO50VGDfq{YHKS*xgym|jSJ3IeRnKI>nNlD3n
zSy@@I9U%RRii-bZVq*S-+z;}frl#h9kUp6H*tl4*`=?Bv@_*K>S^t+VUHU&FBH}+I
zBO}-!N=i!qJ32c4x3;$aFE20uFC-)c_CLrBkX&DH-~ZXO=79B1ojUD*eM19SKgezY
z0Rga{MT-{wZ)s@(yG=wy1nhooZSDW@@$q0kFJ8Rl|B@w3{)1>xSXNb4{paWB|L^4F
z^ndZ<#o(|7`5z<>@*5{7C)f=xE-wEkOqlRLH#Zj?J_{Ev`afyXr2pOBJ^#hU#s9~~
z#{Qo(XU_jAQ>Ol}si^_`!N9=aKS)2w{h+X@tE>B;k)H8CKR+L=uArdczn`Dqe|2?r
zaD0N|1Y{=2Zjc}1;^M$*LsC-mzl4Ou|Kj2ja2kq^js~ZnoSYnRoP*-MzkkC22@@v%
z2hkN3760q&>;Hqy2ZamB4IuqqUS9t}{>aM8`d?jL{XaW9`#&gLLAblC3!G*^X|$}Y
z?0;=-?f<m2wEr9&9N_o`r85u)g{8m0|9?+U&;JSv3gGzF(9i&<2~ga%x3`1C9u$8d
z4DvT94T0PNN{68I4&sB@pm+m?4JZsidO?0}Zf^NsSXc;7#~^or+-YiR3bqH7PC#i1
zWCn;0O7rIC=3w<8y$uZwV1I+c7i0zqmzI|P2Ze{LtLuMxdHMgmyu4tuWMpK(`2!SA
zAY5Bp_rJEL794k=aLvoh1IH6642z12z~Z2I0m*^VEGQj-;<K`{@;^u%hCz0L$^c3*
E046yGf&c&j

diff --git a/nginx.conf b/nginx.conf
new file mode 100644
index 0000000..15169d9
--- /dev/null
+++ b/nginx.conf
@@ -0,0 +1,14 @@
+server {
+	listen	80;
+    server_name _;
+
+    root /srv/;
+
+    location = / {
+        index index.html;
+    }
+
+    location / {
+        try_files $uri.html $uri =404;
+    }
+}
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..83cafd9
--- /dev/null
+++ b/package.json
@@ -0,0 +1,7 @@
+{
+  "name": "Inara-CV",
+  "version": "1.0.0",
+  "devDependencies": {
+    "bower": "^1.8.0"
+  }
+}
-- 
GitLab