diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..e3fbd98 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +build +node_modules diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 87662af..0000000 --- a/.travis.yml +++ /dev/null @@ -1,17 +0,0 @@ -language: node_js -node_js: -- '8' -before_install: -- openssl aes-256-cbc -K $encrypted_7f1476ad54d9_key -iv $encrypted_7f1476ad54d9_iv - -in .travis/deploy.key.enc -out .travis/deploy.key -d -- eval "$(ssh-agent -s)" -- chmod 600 .travis/deploy.key -- ssh-add .travis/deploy.key -- ssh-keyscan marcusnoble.co.uk >> ~/.ssh/known_hosts -- git remote add dokku dokku@marcusnoble.co.uk:blog -- git config --global push.default simple -script: -- git push dokku master -branches: - only: - - master diff --git a/.travis/deploy.key.enc b/.travis/deploy.key.enc deleted file mode 100644 index 0b1aa46..0000000 Binary files a/.travis/deploy.key.enc and /dev/null differ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..56d76a8 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,9 @@ +FROM node:12-alpine + +ADD . . + +RUN npm install + +EXPOSE 8000 + +CMD ["npm", "start"] diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..34af35b --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,32 @@ +pipeline { + agent { label "dind" } + + stages { + + stage('Create Docker image') { + steps { + container('docker') { + sh """ + docker build -t docker.cloud.cluster.fun/averagemarcus/blog:${env.GIT_COMMIT} . + """ + } + } + } + + stage('Publish Docker image') { + when { branch 'master' } + environment { + DOCKER_CREDS = credentials('Harbor') + } + steps { + container('docker') { + sh """ + docker login docker.cloud.cluster.fun -u $DOCKER_CREDS_USR -p $DOCKER_CREDS_PSW + docker push docker.cloud.cluster.fun/averagemarcus/blog:${env.GIT_COMMIT} + """ + } + } + } + + } +} diff --git a/package.json b/package.json index 4c3fcae..f34d1ff 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "metalsmith-markdownit": "^0.3.0", "metalsmith-pagination": "^1.4.0", "metalsmith-permalinks": "^0.5.0", - "metalsmith-sass": "^1.3.0", + "metalsmith-sass": "^1.7.0", "moment": "^2.13.0", "striptags": "^2.1.1" },