-
Notifications
You must be signed in to change notification settings - Fork 0
/
helpers.sh
executable file
·57 lines (49 loc) · 2 KB
/
helpers.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash
declare -A peclVersions=(
[APCu]="5.1.24"
)
function mediawiki_version() {
git ls-remote --sort=version:refname --tags https://github.com/wikimedia/mediawiki.git \
| cut -d/ -f3 \
| tr -d '^{}' \
| grep -E "^$1" \
| tail -1
}
function generate_tags () {
local imageRepository=$1
local mediawikiFullVersion=$2
local mediawikiVersion=$3
local phpVersion=$4
local phpDefault=$5
local variant=$6
if [[ ${phpVersion} == ${phpDefault} ]]; then
TAGS="${imageRepository}:${mediawikiVersion}-${variant},"
TAGS+="${imageRepository}:${mediawikiFullVersion}-${variant},"
# main tags, eg. gesinn/docker-mediawiki-base:1.40
# are only generated for apache variant of image
if [[ ${variant} == "apache" ]];then
TAGS+="${imageRepository}:${mediawikiVersion},"
TAGS+="${imageRepository}:${mediawikiFullVersion},"
fi
fi
TAGS+="${imageRepository}:${mediawikiFullVersion}-php${phpVersion},"
TAGS+="${imageRepository}:${mediawikiFullVersion}-php${phpVersion}-${variant},"
TAGS+="${imageRepository}:${mediawikiVersion}-php${phpVersion},"
TAGS+="${imageRepository}:${mediawikiVersion}-php${phpVersion}-${variant}"
echo $TAGS
}
declare -A variantExtras=(
[apache]='\n# Enable Short URLs\nRUN set -eux; \\\n\ta2enmod rewrite; \\\n\t{ \\\n\t\techo \"<Directory /var/www/html>\"; \\\n\t\techo \" RewriteEngine On\"; \\\n\t\techo \" RewriteCond %{REQUEST_FILENAME} !-f\"; \\\n\t\techo \" RewriteCond %{REQUEST_FILENAME} !-d\"; \\\n\t\techo \" RewriteRule ^ %{DOCUMENT_ROOT}/index.php [L]\"; \\\n\t\techo \"</Directory>\"; \\\n\t} > \"$APACHE_CONFDIR/conf-available/short-url.conf\"; \\\n\ta2enconf short-url\n\n# Enable AllowEncodedSlashes for VisualEditor\nRUN sed -i \"s/<\\/VirtualHost>/\\tAllowEncodedSlashes NoDecode\\n<\\/VirtualHost>/\" \"$APACHE_CONFDIR/sites-available/000-default.conf\"'
[fpm]=''
[fpm-alpine]=''
)
declare -A variantCmds=(
[apache]='apache2-foreground'
[fpm]='php-fpm'
[fpm-alpine]='php-fpm'
)
declare -A variantBases=(
[apache]='debian'
[fpm]='debian'
[fpm-alpine]='alpine'
)