Move to dockerized dokku deployment

This commit is contained in:
Ariejan de Vroom 2023-03-08 21:34:24 +01:00
parent 4ab55e9fa4
commit bb3e163957
Signed by: ariejan
GPG Key ID: AD739154F713697B
2 changed files with 42 additions and 20 deletions

View File

@ -1,23 +1,15 @@
image: registry.gitlab.com/pages/hugo/hugo_extended:latest
stages:
- deploy
variables:
GIT_SUBMODULE_STRATEGY: recursive
pages:
before_script:
- apk add --no-cache imagemagick
script:
- hugo
- ls -lah
- find ./public -name '*.jpg' -exec mogrify -auto-orient -monitor -sampling-factor 4:2:0 -strip -interlace JPEG -colorspace sRGB -resize 2048 -compress JPEG -quality 80 {} \;
artifacts:
paths:
- public
deploy:
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
image: ilyasemenov/gitlab-ci-git-push
stage: deploy
environment:
name: production
url: https://www.devroom.io
only:
- master
test:
- master
script:
- hugo
except:
- master
- git-push ssh://dokku@9up.nl:22/devroom.io

30
Dockerfile Normal file
View File

@ -0,0 +1,30 @@
## `source` is used to generate the static HTML with Hugo
FROM debian:11 as source
# Install dependencies
RUN apt-get update && \
apt-get install -y imagemagick ca-certificates git wget
# Install Hugo
ENV HUGO_VERSION 0.111.2
RUN wget https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_Linux-64bit.tar.gz && \
tar -xvf hugo_extended_${HUGO_VERSION}_Linux-64bit.tar.gz && \
mv hugo /usr/local/bin/hugo && \
chmod +x /usr/local/bin/hugo
# Copy site source
WORKDIR /src
COPY . .
# Initialize submodules, like themes
RUN git submodule update --init --recursive
# Generate the site into /src/public
RUN /usr/local/bin/hugo
# Mogrify all images to be more efficient for the web
RUN find ./public -name '*.jpg' -exec mogrify -auto-orient -monitor -sampling-factor 4:2:0 -strip -interlace JPEG -colorspace sRGB -resize 2048 -compress JPEG -quality 80 {} \;
## Create the final image with Nginx serving the static site
FROM nginx:1-alpine
COPY --from=source /src/public /usr/share/nginx/html