Skip to content

Commit

Permalink
Run Composer for WMF extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
lens0021 committed May 21, 2024
1 parent 08193bd commit f862ed4
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docker-femiwiki-extensions.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: 'Docker: femiwiki-extensions'

env:
TAG: '1.2.0'
TAG: '1.2.1'

on:
push:
Expand Down
25 changes: 17 additions & 8 deletions dockers/femiwiki-extensions/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,30 @@
ARG MEDIAWIKI_VERSION=1.41.0

#
# 미디어위키 확장 설치 스테이지. 루비 스크립트를 이용해 수많은 미디어위키
# 확장들을 병렬로 빠르게 미리 다운받아 놓는다.
# 루비 스크립트를 이용해 많은 미디어위키
# 확장들을 병렬로 빠르게 다운받아 놓는다.
#
FROM --platform=$TARGETPLATFORM ruby:3.3.0-alpine

# ARG instructions without a value inside of a build stage to use the default
# value of an ARG declared before the first FROM use
ARG MEDIAWIKI_VERSION
ARG MEDIAWIKI_VERSION=1.41.0
ARG COMPOSER_VERSION=2.6.6

# aria2
#
# References:
# https://aria2.github.io/
RUN apk update && apk add \
aria2
aria2 \
# Required for composer
php81-cli \
php81-mbstring \
php81-phar \
php81-openssl \
# Required for aws-sdk-php
php81-simplexml \
;

# Install Composer
RUN wget 'https://getcomposer.org/installer' -O 'composer-setup.php' &&\
php81 composer-setup.php --version "${COMPOSER_VERSION}" --install-dir=/usr/local/bin --filename=composer --quiet

# Install aria2.conf
COPY extension-installer/aria2.conf /root/.config/aria2/aria2.conf
Expand Down
4 changes: 4 additions & 0 deletions dockers/femiwiki-extensions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

This docker image contains MediaWiki extensions Femiwiki uses.

## v1.2.1

- Run Composer for WMF extensions

## v1.2.0

- Install RealMe
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
end
MEDIAWIKI_BRANCH = ARGV[0]

# Temporary directory path for Composer
COMPOSER_HOME_PATH = '/tmp/composer'
# Temporary directory path for downloading
TEMP_DIRECTORY_PATH = '/tmp'
# Target directory path for extensions and skins
Expand Down Expand Up @@ -100,4 +102,12 @@ def name_to_aria2_input_line(name, type)
`tar -xzf '#{TEMP_DIRECTORY_PATH}/#{skin}.tar.gz' --strip-components=1 --directory '#{DESTINATION_PATH}/skins/#{skin}'`
end

# Install composer dependencies via 'composer update'
Parallel.each(extensions_all) do |extension|
next unless File.exist? "#{DESTINATION_PATH}/extensions/#{extension}/composer.json"

# '/var/www/.composer' is not writable for www-data. Overriding $COMPOSER_HOME
`COMPOSER_HOME=#{COMPOSER_HOME_PATH} composer update --no-dev --working-dir '#{DESTINATION_PATH}/extensions/#{extension}'`
end

puts 'Finished extension intalling'

0 comments on commit f862ed4

Please sign in to comment.