From: Ruben Beltran del Rio Date: Thu, 14 Oct 2021 21:47:52 +0000 (+0200) Subject: Autodeploy the page via CI X-Git-Url: https://git.r.bdr.sh/rbdr/r.bdr.sh/commitdiff_plain/300639b4e4f9b87c2183e4e095a74e243f60bfac?hp=f08f8474dbef372300d343d0e840ad6c5ee2a890 Autodeploy the page via CI --- diff --git a/.gitignore b/.gitignore index a8d48c6..566151d 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ log/* _site .jekyll-cache +.env diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..9f2d010 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,15 @@ +stages: + - upload + +upload: + stage: upload + except: main + script: + - make upload + +upload_production: + stage: upload + only: main + environment: production + script: + - make upload diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..ee57d2e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,22 @@ +FROM ruby:3-alpine + +RUN apk add --no-cache \ + build-base \ + python3 \ + py3-pip + +RUN pip3 install awscli +RUN rm -rf /var/cache/apk/* + +RUN bundle config --global frozen 1 + +WORKDIR /app + +COPY Gemfile.lock . +COPY Gemfile . +RUN bundle install + +COPY scripts/mime.types /etc/mime.types +COPY . . + +ENTRYPOINT ["jekyll"] diff --git a/Gemfile b/Gemfile index b5bb5c1..d344193 100644 --- a/Gemfile +++ b/Gemfile @@ -1,5 +1,6 @@ -source :rubygems +source "https://rubygems.org" #Blog stuff gem 'jekyll' gem 'rdiscount' +gem 'webrick' diff --git a/Gemfile.lock b/Gemfile.lock index c625f66..dacdb0d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,69 +1,72 @@ GEM - remote: http://rubygems.org/ + remote: https://rubygems.org/ specs: - addressable (2.7.0) + addressable (2.8.0) public_suffix (>= 2.0.2, < 5.0) colorator (1.1.0) - concurrent-ruby (1.1.7) + concurrent-ruby (1.1.9) em-websocket (0.5.2) eventmachine (>= 0.12.9) http_parser.rb (~> 0.6.0) eventmachine (1.2.7) - ffi (1.13.1) + ffi (1.15.4) forwardable-extended (2.6.0) http_parser.rb (0.6.0) - i18n (1.8.5) + i18n (1.8.10) concurrent-ruby (~> 1.0) - jekyll (4.1.1) + jekyll (4.2.1) addressable (~> 2.4) colorator (~> 1.0) em-websocket (~> 0.5) i18n (~> 1.0) jekyll-sass-converter (~> 2.0) jekyll-watch (~> 2.0) - kramdown (~> 2.1) + kramdown (~> 2.3) kramdown-parser-gfm (~> 1.0) liquid (~> 4.0) mercenary (~> 0.4.0) pathutil (~> 0.9) rouge (~> 3.0) safe_yaml (~> 1.0) - terminal-table (~> 1.8) + terminal-table (~> 2.0) jekyll-sass-converter (2.1.0) sassc (> 2.0.1, < 3.0) jekyll-watch (2.2.1) listen (~> 3.0) - kramdown (2.3.0) + kramdown (2.3.1) rexml kramdown-parser-gfm (1.1.0) kramdown (~> 2.0) liquid (4.0.3) - listen (3.2.1) + listen (3.7.0) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) mercenary (0.4.0) pathutil (0.16.2) forwardable-extended (~> 2.6) public_suffix (4.0.6) - rb-fsevent (0.10.4) + rb-fsevent (0.11.0) rb-inotify (0.10.1) ffi (~> 1.0) rdiscount (2.2.0.2) - rexml (3.2.4) - rouge (3.24.0) + rexml (3.2.5) + rouge (3.26.1) safe_yaml (1.0.5) sassc (2.4.0) ffi (~> 1.9) - terminal-table (1.8.0) + terminal-table (2.0.0) unicode-display_width (~> 1.1, >= 1.1.1) - unicode-display_width (1.7.0) + unicode-display_width (1.8.0) + webrick (1.7.0) PLATFORMS - ruby + x86_64-darwin-21 + x86_64-linux-musl DEPENDENCIES jekyll rdiscount + webrick BUNDLED WITH - 2.1.2 + 2.2.22 diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..ce038f4 --- /dev/null +++ b/Makefile @@ -0,0 +1,21 @@ +repo_full_name = $(shell git remote -v | grep origin | grep push | grep -o '[^:/]\+\/[^/]\+\s\+' | grep -o '[^:]\+\/[^. ]\+'| tr '[:upper:]' '[:lower:]') +git_sha = $(shell git rev-parse --short HEAD) + +environment = development + +default: preview + +serve: docker-build + docker-compose run unlimited.pizza serve --host 0.0.0.0 --config _config.yml,_config.$(environment).yml + +build: docker-build + docker-compose run unlimited.pizza build --config _config.yml,_config.$(environment).yml + +update-dependencies: + docker-compose run --entrypoint=bundle unlimited.pizza config --global frozen 0; bundle update + +docker-build: + docker-compose build + +upload: build + docker-compose run --entrypoint=/bin/sh unlimited.pizza ./scripts/upload.sh diff --git a/_config.development.yml b/_config.development.yml new file mode 100644 index 0000000..5d6fa5d --- /dev/null +++ b/_config.development.yml @@ -0,0 +1,2 @@ +domain: limited.pizza + diff --git a/_config.production.yml b/_config.production.yml new file mode 100644 index 0000000..647b24a --- /dev/null +++ b/_config.production.yml @@ -0,0 +1 @@ +domain: unlimited.pizza diff --git a/_config.yml b/_config.yml index 4678729..1b3ca2a 100644 --- a/_config.yml +++ b/_config.yml @@ -1,6 +1,3 @@ markdown: rdiscount -permalink: /:year/:month/:day/:title exclude: ["Gemfile", "Gemfile.lock"] source: jekyll -baseurl: "http://unlimited.pizza" -baseurl: / diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..b4ae4c9 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,11 @@ +version: '3.8' + +services: + unlimited.pizza: + build: . + env_file: .env + command: serve --host 0.0.0.0 --config _config.yml,_config.development.yml + volumes: + - .:/app + ports: + - '4000:4000' diff --git a/env.dist b/env.dist new file mode 100644 index 0000000..a5bab00 --- /dev/null +++ b/env.dist @@ -0,0 +1,3 @@ +S3_BUCKET=limited.pizza +AWS_ACCESS_KEY_ID= +AWS_SECRET_ACCESS_KEY= diff --git a/jekyll/_layouts/default.html b/jekyll/_layouts/default.html index 52baf35..7fb45e0 100644 --- a/jekyll/_layouts/default.html +++ b/jekyll/_layouts/default.html @@ -9,10 +9,10 @@ Unlimited 🍕 {{ page.title }} - - + + - +