mirror of
https://github.com/Icinga/docker-icingaweb2.git
synced 2025-10-24 05:21:00 +02:00
Don't install locales-all, generate only necessary locales
to reduce image size 654MB -> 462MB.
This commit is contained in:
parent
b8ee7008d1
commit
8ead644260
16
Dockerfile
16
Dockerfile
@ -8,9 +8,20 @@ WORKDIR /entrypoint
|
||||
RUN ["go", "build", "."]
|
||||
|
||||
|
||||
FROM debian:bullseye-slim as etc-locale-gen
|
||||
|
||||
RUN ["bash", "-exo", "pipefail", "-c", "export DEBIAN_FRONTEND=noninteractive; apt-get update; apt-get install --no-install-{recommends,suggests} -y locales; apt-get clean; rm -vrf /var/lib/apt/lists/*"]
|
||||
|
||||
COPY icingaweb2 /usr/share/icingaweb2
|
||||
COPY icinga-L10n /usr/share/icinga-L10n
|
||||
COPY uncomment-locales.pl /
|
||||
|
||||
RUN ["/uncomment-locales.pl", "/etc/locale.gen"]
|
||||
|
||||
|
||||
FROM debian:bullseye-slim
|
||||
|
||||
RUN ["bash", "-exo", "pipefail", "-c", "export DEBIAN_FRONTEND=noninteractive; apt-get update; apt-get install --no-install-{recommends,suggests} -y apache2 ca-certificates libapache2-mod-php7.4 libldap-common locales-all php-{imagick,redis} php7.4-{bcmath,bz2,common,curl,dba,enchant,gd,gmp,imap,interbase,intl,json,ldap,mbstring,mysql,odbc,opcache,pgsql,pspell,readline,snmp,soap,sqlite3,sybase,tidy,xml,xmlrpc,xsl,zip}; apt-get clean; rm -vrf /var/lib/apt/lists/*"]
|
||||
RUN ["bash", "-exo", "pipefail", "-c", "export DEBIAN_FRONTEND=noninteractive; apt-get update; apt-get install --no-install-{recommends,suggests} -y apache2 ca-certificates libapache2-mod-php7.4 libldap-common locales php-{imagick,redis} php7.4-{bcmath,bz2,common,curl,dba,enchant,gd,gmp,imap,interbase,intl,json,ldap,mbstring,mysql,odbc,opcache,pgsql,pspell,readline,snmp,soap,sqlite3,sybase,tidy,xml,xmlrpc,xsl,zip}; apt-get clean; rm -vrf /var/lib/apt/lists/*"]
|
||||
|
||||
COPY --from=entrypoint /entrypoint/entrypoint /entrypoint
|
||||
COPY entrypoint/db-init /entrypoint-db-init
|
||||
@ -38,6 +49,9 @@ COPY icinga-php /usr/share/icinga-php
|
||||
COPY icinga-L10n /usr/share/icinga-L10n
|
||||
COPY php.ini /etc/php/7.4/cli/conf.d/99-docker.ini
|
||||
|
||||
COPY --from=etc-locale-gen /etc/locale.gen /etc/
|
||||
RUN ["locale-gen", "-j", "4"]
|
||||
|
||||
RUN ["ln", "-vs", "/usr/share/icingaweb2/packages/files/apache/icingaweb2.conf", "/etc/apache2/conf-enabled/"]
|
||||
RUN ["ln", "-vs", "/usr/share/icingaweb2/bin/icingacli", "/usr/local/bin/"]
|
||||
|
||||
|
||||
@ -33,6 +33,6 @@ cd /iw2cp
|
||||
/bldctx/composer.bash
|
||||
patch -d icingaweb2 -p0 < /bldctx/icingaweb2.patch
|
||||
|
||||
cp -r /entrypoint /bldctx/php.ini .
|
||||
cp -r /entrypoint /bldctx/{php.ini,uncomment-locales.pl} .
|
||||
docker build -f /bldctx/Dockerfile -t icinga/icingaweb2 .
|
||||
EOF
|
||||
|
||||
26
uncomment-locales.pl
Executable file
26
uncomment-locales.pl
Executable file
@ -0,0 +1,26 @@
|
||||
#!/usr/bin/perl -i
|
||||
|
||||
my %uniqLocs = ();
|
||||
|
||||
for my $subDir ('icinga-L10n', 'icingaweb2/modules/*/application') {
|
||||
for my $lcDir (glob "/usr/share/$subDir/locale/*_*") {
|
||||
if ($lcDir =~ /(\w+)$/) {
|
||||
$uniqLocs{$1} = 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
my @locs = keys %uniqLocs;
|
||||
|
||||
while (<>) {
|
||||
if (/\bUTF-8\b/) {
|
||||
for my $loc (@locs) {
|
||||
if (/\b$loc\b/) {
|
||||
s/^# *//;
|
||||
last
|
||||
}
|
||||
}
|
||||
}
|
||||
} continue {
|
||||
print or die $!
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user