diff --git a/.deployment b/.deployment deleted file mode 100644 index 1e42f16..0000000 --- a/.deployment +++ /dev/null @@ -1,2 +0,0 @@ -[config] -command = bash deploy.sh \ No newline at end of file diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..c8061d7 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +node_modules +public +db.json \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..2ff9ece --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +FROM node:8 as build +WORKDIR /build +COPY package.json package-lock.json . +RUN npm install +COPY . . +RUN npm run build + +FROM nginx:mainline as runtime +COPY --from=build /build /usr/share/nginx/html +COPY nginx.conf /etc/nginx/nginx.conf +COPY default.conf /etc/nginx/conf.d/default.conf \ No newline at end of file diff --git a/default.conf b/default.conf new file mode 100644 index 0000000..c868a18 --- /dev/null +++ b/default.conf @@ -0,0 +1,19 @@ +server { + listen 80; + server_name _; + + location / { + root /usr/share/nginx/html; + index index.html index.htm; + rewrite ^(/tags/)(.*) https://$host/tag/$2/ permanent; + rewrite ^(/rss) /rss.xml break; + absolute_redirect off; + real_ip_header X-Forwarded-For; + real_ip_recursive on; + + } + + error_page 500 502 503 504 /500/; + error_page 404 /404/; + +} diff --git a/deploy.sh b/deploy.sh deleted file mode 100644 index 4b9ef8b..0000000 --- a/deploy.sh +++ /dev/null @@ -1,125 +0,0 @@ -#!/bin/bash - -# ---------------------- -# KUDU Deployment Script -# Version: 1.0.17 -# ---------------------- - -# Helpers -# ------- - -exitWithMessageOnError () { - if [ ! $? -eq 0 ]; then - echo "An error has occurred during web site deployment." - echo $1 - exit 1 - fi -} - -# Prerequisites -# ------------- - -# Verify node.js installed -hash node 2>/dev/null -exitWithMessageOnError "Missing node.js executable, please install node.js, if already installed make sure it can be reached from current environment." - -# Setup -# ----- - -SCRIPT_DIR="${BASH_SOURCE[0]%\\*}" -SCRIPT_DIR="${SCRIPT_DIR%/*}" -ARTIFACTS=$SCRIPT_DIR/../artifacts -KUDU_SYNC_CMD=${KUDU_SYNC_CMD//\"} - -if [[ ! -n "$DEPLOYMENT_SOURCE" ]]; then - DEPLOYMENT_SOURCE=$SCRIPT_DIR -fi - -if [[ ! -n "$NEXT_MANIFEST_PATH" ]]; then - NEXT_MANIFEST_PATH=$ARTIFACTS/manifest - - if [[ ! -n "$PREVIOUS_MANIFEST_PATH" ]]; then - PREVIOUS_MANIFEST_PATH=$NEXT_MANIFEST_PATH - fi -fi - -if [[ ! -n "$DEPLOYMENT_TARGET" ]]; then - DEPLOYMENT_TARGET=$ARTIFACTS/wwwroot -else - KUDU_SERVICE=true -fi - -if [[ ! -n "$KUDU_SYNC_CMD" ]]; then - # Install kudu sync - echo Installing Kudu Sync - npm install kudusync -g --silent - exitWithMessageOnError "npm failed" - - if [[ ! -n "$KUDU_SERVICE" ]]; then - # In case we are running locally this is the correct location of kuduSync - KUDU_SYNC_CMD=kuduSync - else - # In case we are running on kudu service this is the correct location of kuduSync - KUDU_SYNC_CMD=$APPDATA/npm/node_modules/kuduSync/bin/kuduSync - fi -fi - -# Node Helpers -# ------------ - -selectNodeVersion () { - if [[ -n "$KUDU_SELECT_NODE_VERSION_CMD" ]]; then - SELECT_NODE_VERSION="$KUDU_SELECT_NODE_VERSION_CMD \"$DEPLOYMENT_SOURCE\" \"$DEPLOYMENT_TARGET\" \"$DEPLOYMENT_TEMP\"" - eval $SELECT_NODE_VERSION - exitWithMessageOnError "select node version failed" - - if [[ -e "$DEPLOYMENT_TEMP/__nodeVersion.tmp" ]]; then - NODE_EXE=`cat "$DEPLOYMENT_TEMP/__nodeVersion.tmp"` - exitWithMessageOnError "getting node version failed" - fi - - if [[ -e "$DEPLOYMENT_TEMP/__npmVersion.tmp" ]]; then - NPM_JS_PATH=`cat "$DEPLOYMENT_TEMP/__npmVersion.tmp"` - exitWithMessageOnError "getting npm version failed" - fi - - if [[ ! -n "$NODE_EXE" ]]; then - NODE_EXE=node - fi - - NPM_CMD="\"$NODE_EXE\" \"$NPM_JS_PATH\"" - else - NPM_CMD=npm - NODE_EXE=node - fi -} - -################################################################################################################################## -# Deployment -# ---------- - -echo Handling node.js deployment. - -# 1. KuduSync -if [[ "$IN_PLACE_DEPLOYMENT" -ne "1" ]]; then - "$KUDU_SYNC_CMD" -v 50 -f "$DEPLOYMENT_SOURCE" -t "$DEPLOYMENT_TARGET" -n "$NEXT_MANIFEST_PATH" -p "$PREVIOUS_MANIFEST_PATH" -i ".git;.hg;.deployment;deploy.sh" - exitWithMessageOnError "Kudu Sync failed" -fi - -# 2. Select node version -selectNodeVersion - -# 3. Install npm packages -if [ -e "$DEPLOYMENT_TARGET/package.json" ]; then - cd "$DEPLOYMENT_TARGET" - echo "Running $NPM_CMD install --production" - eval $NPM_CMD install --production - exitWithMessageOnError "npm failed" - cd - > /dev/null -fi - -# 4. Generate site -npm run build - -################################################################################################################################## -echo "Finished successfully." diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..110417e --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,6 @@ +version: '3' +services: + resume: + build: ./ + ports: + - "8080:80" \ No newline at end of file diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..d29ddcb --- /dev/null +++ b/nginx.conf @@ -0,0 +1,32 @@ +user nginx; +worker_processes 1; + +error_log /var/log/nginx/error.log warn; +pid /var/run/nginx.pid; + + +events { + worker_connections 1024; +} + + +http { + include /etc/nginx/mime.types; + default_type application/octet-stream; + + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + + access_log /var/log/nginx/access.log main; + + sendfile on; + #tcp_nopush on; + + keepalive_timeout 65; + + gzip on; + gzip_types text/plain application/javascript application/x-javascript text/javascript text/xml text/css; + + include /etc/nginx/conf.d/*.conf; +} diff --git a/package-lock.json b/package-lock.json index 741ad9d..4539d70 100644 --- a/package-lock.json +++ b/package-lock.json @@ -901,6 +901,14 @@ "tarball-extract": "0.0.3" } }, + "jsonresume-theme-paper": { + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/jsonresume-theme-paper/-/jsonresume-theme-paper-0.3.5.tgz", + "integrity": "sha1-BYNySfev72b4qszloaiRfQd6sBM=", + "requires": { + "handlebars": "2.0.0" + } + }, "jsonresume-themeutils": { "version": "1.4.3", "resolved": "https://registry.npmjs.org/jsonresume-themeutils/-/jsonresume-themeutils-1.4.3.tgz", diff --git a/package.json b/package.json index 36ae61f..bf76a44 100644 --- a/package.json +++ b/package.json @@ -9,10 +9,13 @@ }, "scripts": { "test": "node ./node_modules/resume-cli/index.js export index -f html", - "build": "resume export index -f html --theme elegant" + "build": "resume export index -f html --theme flat" }, "dependencies": { "jsonresume-theme-elegant": "^1.11.2", + "jsonresume-theme-flat": "^0.3.7", + "jsonresume-theme-modern": "0.0.18", + "jsonresume-theme-paper": "^0.3.5", "resume-cli": "^0.4.19" } } diff --git a/web.config b/web.config deleted file mode 100644 index cdc11a1..0000000 --- a/web.config +++ /dev/null @@ -1,58 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -