Skip to content

Commit

Permalink
Initial Version for Jekyll/Ruby build
Browse files Browse the repository at this point in the history
  • Loading branch information
dfuchss committed Oct 5, 2024
0 parents commit 56b39a2
Show file tree
Hide file tree
Showing 4 changed files with 104 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @dfuchss
53 changes: 53 additions & 0 deletions .github/workflows/build-gitlab-runner-ruby.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Docker Push Gitlab Runner 4 Jekyll

on:
schedule:
- cron: "0 0 1 * *"
workflow_dispatch:
push:
# Publish `v1.2.3` tags as releases.
tags:
- v*

env:
IMAGE_NAME: gitlab-runner-jekyll

jobs:
push:
runs-on: ubuntu-latest

permissions:
contents: read
packages: write

steps:
- uses: actions/checkout@v2

- name: Build image
run: mkdir build-dir && docker build build-dir --file gitlab-runner-jekyll/Dockerfile --tag $IMAGE_NAME

- name: Log into registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.repository_owner }} --password-stdin

- name: Push image
run: |
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME
# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
# Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# Strip "v" prefix from tag name
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
# Use Docker `latest` tag convention
[ "$VERSION" == "main" ] && VERSION=latest
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# GitLab Runner for Ruby/Jekyll

GitLab Runner for Shell usage + Ruby/Jekyll Support

Instead of using `gitlab/gitlab-runner` simply use `ghcr.io/kit-sdq/gitlab-runner-jekyll`

* Register as Runner in Shell Mode
* ```docker run -d --name gitlab-runner-shell --restart always -v /srv/gitlab-runner/config:/etc/gitlab-runner ghcr.io/kit-sdq/gitlab-runner-jekyll```


40 changes: 40 additions & 0 deletions gitlab-runner-jekyll/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
ARG RUBY_INSTALLER_VERSION=0.9.3
ARG RUBY_VERSION=3.2.2

FROM gitlab/gitlab-runner:latest

RUN echo "Installing needed dependencies" \
&& apt-get update && apt-get install -y --no-install-recommends \
locales \
imagemagick \
build-essential \
zlib1g-dev \
jupyter-nbconvert \
npm \
python3-pip && \
apt-get clean && rm -rf /var/lib/apt/lists/* /var/cache/apt/archives/*

RUN echo "Fixing locales" \
&& sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen \
&& locale-gen

ENV LC_ALL=en_US.UTF-8
ENV LANG=en_US.UTF-8
ENV LANGUAGE=en_US.UTF-8
ENV JEKYLL_ENV=production

ARG RUBY_INSTALLER_VERSION
ARG RUBY_VERSION
# https://github.com/postmodern/ruby-install/releases/download/v$RUBY_INSTALLER_VERSION/ruby-install-$RUBY_INSTALLER_VERSION.tar.gz
RUN wget -O ruby-install.tar.gz "https://github.com/postmodern/ruby-install/releases/download/v${RUBY_INSTALLER_VERSION}/ruby-install-${RUBY_INSTALLER_VERSION}.tar.gz" && \
tar -xzf ruby-install.tar.gz && \
cd "ruby-install-${RUBY_INSTALLER_VERSION}/" && \
apt-get update && \
make install && \
ruby-install --system ruby "${RUBY_VERSION}" && \
cd .. && \
rm -rf ruby-install* && \
apt-get clean && rm -rf /var/lib/apt/lists/* /var/cache/apt/archives/*

RUN pip3 install --upgrade jupyter
RUN npm install -g purgecss

0 comments on commit 56b39a2

Please sign in to comment.