From 92340024938b70c6330d9e93fd4d3dd900b3a2ff Mon Sep 17 00:00:00 2001 From: Pim Kunis Date: Sat, 20 May 2023 00:19:33 +0200 Subject: [PATCH] add concourse pipeline --- .gitignore | 7 +----- Dockerfile | 4 ++++ jekyll/.gitignore | 6 +++++ jekyll/LICENSE | 21 ---------------- nginx.conf | 18 ++++++++++++++ pipeline.yml | 61 +++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 90 insertions(+), 27 deletions(-) create mode 100644 Dockerfile create mode 100644 jekyll/.gitignore delete mode 100644 jekyll/LICENSE create mode 100644 nginx.conf create mode 100644 pipeline.yml diff --git a/.gitignore b/.gitignore index 4173749..769c244 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1 @@ -_site/ -.sass-cache/ -.jekyll-cache/ -.jekyll-metadata -_drafts -klise-*.gem +secrets.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..0617d4f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,4 @@ +FROM nginx:1.24-bullseye + +COPY ./site-html /var/www/blog +COPY ./this-repo/nginx.conf /etc/nginx/conf.d/default.conf diff --git a/jekyll/.gitignore b/jekyll/.gitignore new file mode 100644 index 0000000..4173749 --- /dev/null +++ b/jekyll/.gitignore @@ -0,0 +1,6 @@ +_site/ +.sass-cache/ +.jekyll-cache/ +.jekyll-metadata +_drafts +klise-*.gem diff --git a/jekyll/LICENSE b/jekyll/LICENSE deleted file mode 100644 index 88aa011..0000000 --- a/jekyll/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2019 Mahendrata Harpi - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..fa6900f --- /dev/null +++ b/nginx.conf @@ -0,0 +1,18 @@ +server { + listen 80; + server_name pim.kunis.nl; + index index.html index.htm; + root /var/www/blog; + + location / { + try_files $uri $uri/ /index.html; + } + + location ~* \.(?:ico|css|js|gif|jpe?g|png)$ { + expires 30d; + add_header Pragma public; + add_header Cache-Control "public"; + } + + error_page 404 /404.html; +} diff --git a/pipeline.yml b/pipeline.yml new file mode 100644 index 0000000..1d62f47 --- /dev/null +++ b/pipeline.yml @@ -0,0 +1,61 @@ +resources: +- name: site-repo + type: git + source: + uri: https://git.pim.kunis.nl/pim/static.git +- name: site-registry-image + type: registry-image + source: + repository: git.pim.kunis.nl/pim/static + tag: latest + username: pim + password: ((registry_token)) + +jobs: +- name: build-static-website + plan: + - get: site-repo + trigger: true + - task: build-site + config: + platform: linux + image_resource: + type: registry-image + source: + repository: jekyll/builder + inputs: + - name: site-repo + outputs: + - name: site-html + params: + JEKYLL_ENV: production + run: + path: sh + args: + - -exc + - | + ls -lash + chown jekyll:jekyll site-html + cd site-repo/jekyll + bundle install + bundle exec jekyll build --disable-disk-cache --destination ../../site-html + - task: build-image + privileged: true + config: + platform: linux + image_resource: + type: registry-image + source: + repository: concourse/oci-build-task + inputs: + - name: site-repo + - name: site-html + outputs: + - name: image + params: + DOCKERFILE: site-repo/Dockerfile + run: + path: build + - put: site-registry-image + params: + image: image/image.tar