Skip to content

Commit

Permalink
chore!: Do not run Composer and exclude extensions (#843)
Browse files Browse the repository at this point in the history
  • Loading branch information
lens0021 authored May 21, 2024
1 parent d839008 commit ffd5c4e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 51 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docker-mediawiki.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: 'Docker: mediawiki'

env:
TAG: '1.1.1'
TAG: '2.0.0'

on:
push:
Expand Down
54 changes: 4 additions & 50 deletions dockers/mediawiki/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,64 +1,17 @@
FROM --platform=$TARGETPLATFORM ghcr.io/femiwiki/php-fpm:1.1.0
ARG MEDIAWIKI_VERSION=1.41.0

# Composer 이미지는 PHP 버전을 따로 설정할 수 없어 스테이지를 생성해 /usr/bin/composer만 복사해
# 사용하여야 합니다.
# See 'PHP version & extensions' section on https://hub.docker.com/_/composer for more details.
FROM --platform=$TARGETPLATFORM composer:2.6.6 AS composer

FROM --platform=$TARGETPLATFORM ghcr.io/femiwiki/femiwiki-extensions:1.1.1 AS extensions

FROM --platform=$TARGETPLATFORM php:8.1.22-cli AS base-mediawiki
ARG MEDIAWIKI_VERSION

# Install dependencies and utilities
RUN apt-get update && apt-get install -y \
libicu-dev \
# https://getcomposer.org/doc/00-intro.md#system-requirements
git \
unzip

# Install the PHP extensions we need
RUN IPE_DEBUG=1 docker-php-ext-install -j8 \
intl \
calendar

COPY --from=composer /usr/bin/composer /usr/bin/composer

# Create a cache directory for composer
RUN mkdir -p /composer

COPY --from=extensions /mediawiki /mediawiki

# Download MediaWiki
RUN mkdir /mediawiki/
RUN MEDIAWIKI_MAJOR_VERSION="$(echo $MEDIAWIKI_VERSION | cut -d. -f-2)" &&\
curl -fSL "https://releases.wikimedia.org/mediawiki/${MEDIAWIKI_MAJOR_VERSION}/mediawiki-core-${MEDIAWIKI_VERSION}.tar.gz" -o mediawiki.tar.gz &&\
tar -xzf mediawiki.tar.gz --strip-components=1 --directory /mediawiki/ &&\
rm mediawiki.tar.gz

COPY composer.local.json /mediawiki/

RUN COMPOSER_HOME=/composer /usr/bin/composer update --no-dev --working-dir '/mediawiki'


#
# PHP-FPM Stage
#

FROM --platform=$TARGETPLATFORM ghcr.io/femiwiki/php-fpm:1.0.0

# Install Mediawiki and extensions
COPY --from=base-mediawiki --chown=www-data /mediawiki /mediawiki

# Create cache directories for mediawiki
# $wgCacheDirectory should not be accessible from the web and writable by the web server
# See https://www.mediawiki.org/wiki/Manual:$wgCacheDirectory for details
RUN sudo -u www-data mkdir -p /tmp/file-cache /tmp/cache

# Web server should be able to write 'extensions/Widgets/compiled_templates'
# directory Required by 'Widgets' extension
# Reference: https://www.mediawiki.org/wiki/Extension:Widgets
RUN chmod o+w /mediawiki/extensions/Widgets/compiled_templates

# Web server should be able to execute lua binary
# Reference: https://www.mediawiki.org/wiki/Extension:Scribunto#Additional_binaries
RUN chmod o+x /usr/bin/lua
Expand All @@ -72,7 +25,8 @@ COPY cron/generate-sitemap \
/usr/local/bin/

# Install scripts
RUN sudo -u www-data mkdir -p /mediawiki/sitemap
RUN mkdir -p /mediawiki/sitemap &&\
chown www-data:www-data /mediawiki/sitemap

# Ship femiwiki-specific mediawiki configurations
COPY --chown=www-data LocalSettings.php /a/
Expand Down
6 changes: 6 additions & 0 deletions dockers/mediawiki/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# docker-mediawiki

## 2.0.0

- Remove extensions
- Do not run Composer
- Bump femiwiki/php-fpm to v1.1.0

## 1.1.1

- Bump femiwiki-extensions to v1.1.1
Expand Down

0 comments on commit ffd5c4e

Please sign in to comment.