Skip to content

Commit

Permalink
Merge pull request #8 from inblockio/add-auto-build
Browse files Browse the repository at this point in the history
Add auto build
  • Loading branch information
FantasticoFox authored May 23, 2024
2 parents 62d53d7 + 53ecd24 commit 7af9e9c
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 28 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/build_and_push_docker_image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: "Build and Push Docker-Image"

on:
push:

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}


jobs:
build:
name: Build and Push
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- name: checkout
uses: actions/checkout@v4
- name: Log into GH container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
with:
context: .
push: true
tags: ${{ github.event.release.tag_name || steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
file: Dockerfile
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
extensions/
master.tar.gz
*.zip
/.idea/
16 changes: 9 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ ENV MW_ROOT /var/www/html
# TODO remove the /etc/apt/preferences.d/no-debian-php and apt-get -q install -y --no-install-recommends zip unzip php-zip once we upgrade to 1.36 because they are not necessary anymore.
RUN set -ex && \
apt-get -q update && apt-get upgrade -y && \
apt-get -q install -y --no-install-recommends nano vim ripgrep tig fd-find && \
apt-get -q install -y --no-install-recommends wget nano vim ripgrep tig fd-find && \
rm /etc/apt/preferences.d/no-debian-php && \
apt-get -q install -y --no-install-recommends zip unzip php-zip && \
apt-get -q install -y --no-install-recommends mariadb-client && \
Expand All @@ -164,22 +164,24 @@ RUN set -ex && \
# Define working directory for the following commands
WORKDIR ${MW_ROOT}

# Copy Tweeki skin to skins/
COPY ./skins/Tweeki skins/Tweeki

# Copy extensions
COPY ./extensions extensions

# Copy the php.ini with desired upload_max_filesize into the php directory.
COPY ./resources/php.ini /usr/local/etc/php/php.ini
# Copy more assets and composer file.
COPY ./resources/aqua.png resources/assets/aqua.png
COPY ./composer.local.json composer.local.json

COPY ./build.sh .
RUN chmod +x ./build.sh
RUN ./build.sh
RUN rm ./build.sh

# TODO hack to address https://github.com/inblockio/DataAccounting/issues/244.
# Remove this once MediaWiki has made a patch release.
RUN sed -i 's/$this->package->setProvides( \[ $link \] );/$this->package->setProvides( \[ self::MEDIAWIKI_PACKAGE_NAME => $link \] );/' ./includes/composer/ComposerPackageModifier.php

# If this environment is not set, Composer does not work as intended.
ENV COMPOSER_ALLOW_SUPERUSER=1

# Install the latest version of PHP package manager "Composer" and install
# MW-OAuth2Client from Git master.
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin/ --filename=composer && \
Expand Down
24 changes: 3 additions & 21 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,40 +4,22 @@ set -euo pipefail

tweeki_version=2.0.3
pdfembed_version=2.0.2
embedvideo_version=2.9.0

mkdir -p skins
if [ ! -d skins/Tweeki ]; then
echo "Downloading Tweeki skin"
wget https://github.com/thaider/Tweeki/archive/refs/tags/v${tweeki_version}.tar.gz
tar xf v${tweeki_version}.tar.gz
mv Tweeki-* skins/Tweeki
rm v${tweeki_version}.tar.gz
fi

mkdir -p extensions

# TODO move to composer.local.json
# https://www.mediawiki.org/wiki/Extension:PDFEmbed
if [ ! -d extensions/PDFEmbed ]; then
echo "Downloading PDFEmbed"
wget https://gitlab.com/hydrawiki/extensions/PDFEmbed/-/archive/${pdfembed_version}/PDFEmbed-${pdfembed_version}.zip
unzip PDFEmbed-${pdfembed_version}.zip
mv PDFEmbed-${pdfembed_version}/ extensions/PDFEmbed
rm PDFEmbed-${pdfembed_version}.zip
fi

# https://github.com/wikimedia/mediawiki-extensions-intersection
# We have a problem getting a permanent download url for this extension.
#if [ ! -d extensions/intersection ]; then
# echo "Downloading intersection"
# wget
#fi

# Is commented out because the extension is deprecated in it's current version in MW 1.37.X
# https://www.mediawiki.org/wiki/Extension:EmbedVideo
# Disabled per stakeholder request in DataAccounting/issues/189
# if [ ! -d extensions/EmbedVideo ]; then
# echo "Downloading EmbedVideo"
# wget https://gitlab.com/hydrawiki/extensions/EmbedVideo/-/archive/v${embedvideo_version}/EmbedVideo-v${embedvideo_version}.zip
# unzip EmbedVideo-v${embedvideo_version}.zip
# mv EmbedVideo-v${embedvideo_version} extensions/EmbedVideo
# fip
docker build -t inblockio/micro-pkc-mediawiki .

0 comments on commit 7af9e9c

Please sign in to comment.