-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docker: Split caddy and mediawiki image
- Loading branch information
Showing
22 changed files
with
205 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: 'Docker: mediawiki' | ||
|
||
env: | ||
TAG: '1.0.0' | ||
|
||
on: | ||
push: | ||
paths: | ||
- 'dockers/mediawiki/**' | ||
- .github/workflows/docker-mediawiki.yml | ||
pull_request: | ||
paths: | ||
- 'dockers/mediawiki/**' | ||
- .github/workflows/docker-mediawiki.yml | ||
workflow_dispatch: | ||
|
||
jobs: | ||
docker-image: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: docker/setup-qemu-action@v3 | ||
|
||
- uses: docker/setup-buildx-action@v3 | ||
|
||
- uses: docker/login-action@v3 | ||
if: github.repository_owner == 'femiwiki' && github.ref == 'refs/heads/main' | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- uses: docker/build-push-action@v5 | ||
with: | ||
context: '{{ defaultContext }}:dockers/mediawiki' | ||
platforms: linux/amd64,linux/arm64 | ||
cache-from: ghcr.io/femiwiki/mediawiki:latest | ||
load: false | ||
push: ${{ github.repository_owner == 'femiwiki' && github.ref == 'refs/heads/main' }} | ||
tags: | | ||
ghcr.io/femiwiki/mediawiki:latest | ||
ghcr.io/femiwiki/mediawiki:${{ env.TAG }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: 'Docker: php-fpm' | ||
|
||
env: | ||
TAG: '1.0.0' | ||
|
||
on: | ||
push: | ||
paths: | ||
- 'dockers/php-fpm/**' | ||
- .github/workflows/docker-php-fpm.yml | ||
pull_request: | ||
paths: | ||
- 'dockers/php-fpm/**' | ||
- .github/workflows/docker-php-fpm.yml | ||
workflow_dispatch: | ||
|
||
jobs: | ||
docker-image: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: docker/setup-qemu-action@v3 | ||
|
||
- uses: docker/setup-buildx-action@v3 | ||
|
||
- uses: docker/login-action@v3 | ||
if: github.repository_owner == 'femiwiki' && github.ref == 'refs/heads/main' | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- uses: docker/build-push-action@v5 | ||
with: | ||
context: '{{ defaultContext }}:dockers/php-fpm' | ||
platforms: linux/amd64,linux/arm64 | ||
cache-from: ghcr.io/femiwiki/php-fpm:latest | ||
load: false | ||
push: ${{ github.repository_owner == 'femiwiki' && github.ref == 'refs/heads/main' }} | ||
tags: | | ||
ghcr.io/femiwiki/php-fpm:latest | ||
ghcr.io/femiwiki/php-fpm:${{ env.TAG }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
FROM --platform=$TARGETPLATFORM caddy:2-builder AS caddy | ||
ARG CADDY_MWCACHE_COMMIT=9e9ac234170400406c6a328bbaaaa4c95e05bd73 | ||
|
||
RUN XCADDY_DEBUG=1 xcaddy build v2.7.5 \ | ||
--with github.com/caddy-dns/route53 \ | ||
--with "github.com/femiwiki/caddy-mwcache@${CADDY_MWCACHE_COMMIT}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# caddy | ||
|
||
Route53와 caddy-mwcache 패키지를 설치한 Caddy를 빌드한다. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
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.0.0 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 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 | ||
|
||
# Install and register cron | ||
COPY cron/crontab /tmp/crontab | ||
RUN crontab /tmp/crontab && rm /tmp/crontab | ||
COPY cron/generate-sitemap \ | ||
cron/update-special-pages \ | ||
cron/run-jobs \ | ||
/usr/local/bin/ | ||
|
||
# Install scripts | ||
RUN sudo -u www-data mkdir -p /mediawiki/sitemap | ||
|
||
# Ship femiwiki-specific mediawiki configurations | ||
COPY --chown=www-data LocalSettings.php /a/ | ||
|
||
# secret.php should be mounted to '/a/secret.php' | ||
VOLUME /a |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# php-fpm | ||
|
||
미디어위키 실행에 필요한 각종 PHP 디펜던시들을 설치한다. |