Skip to content

Commit 941c49a

Browse files
committed
Split locales generation out from php extensions installation
When trying to modify the php installed extensions in the images it's a pain to have to wait for all the locales to be generated. So, the changes here just split that responsibility to another, separated layer that will be cached before playing with extensions.
1 parent e59c42d commit 941c49a

File tree

3 files changed

+29
-7
lines changed

3 files changed

+29
-7
lines changed

Dockerfile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,12 @@ RUN apt-get update && apt-get install -y \
2424
# For an example of php80-rc5 near complete, using pickle instead of pear/pecl, look to:
2525
# https://github.com/stronk7/moodle-php-apache/tree/8.0-buster-pickle-version
2626

27-
# Setup the required extensions.
27+
# Generate all the UTF-8 locales.
2828
ARG DEBIAN_FRONTEND=noninteractive
29+
ADD root/tmp/setup/locales-gen.sh /tmp/setup/locales-gen.sh
30+
RUN /tmp/setup/locales-gen.sh
31+
32+
# Setup the required extensions.
2933
ADD root/tmp/setup/php-extensions.sh /tmp/setup/php-extensions.sh
3034
RUN /tmp/setup/php-extensions.sh
3135

root/tmp/setup/locales-gen.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
5+
echo "Installing apt dependencies"
6+
7+
# Packages for installing locales.
8+
RUNTIME_LOCALES="locales"
9+
10+
apt-get update
11+
apt-get install -y --no-install-recommends apt-transport-https \
12+
$RUNTIME_LOCALES
13+
14+
echo "Installing UTF-8 locales"
15+
16+
# Generate the locales configuration for all possible UTF-8 locales.
17+
grep UTF-8 /usr/share/i18n/SUPPORTED > /etc/locale.gen
18+
locale-gen
19+
20+
# Keep our image size down..
21+
apt-get autoremove -y
22+
apt-get clean
23+
rm -rf /var/lib/apt/lists/*

root/tmp/setup/php-extensions.sh

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ PACKAGES_MYMARIA="libmariadb3"
1717

1818
# Packages for other Moodle runtime dependenices.
1919
PACKAGES_RUNTIME="ghostscript libaio1 libcurl4 libgss3 libicu63 libmcrypt-dev libxml2 libxslt1.1 \
20-
libzip-dev locales sassc unzip zip"
20+
libzip-dev sassc unzip zip"
2121

2222
# Packages for Memcached.
2323
PACKAGES_MEMCACHED="libmemcached11 libmemcachedutil2"
@@ -34,11 +34,6 @@ apt-get install -y --no-install-recommends apt-transport-https \
3434
$PACKAGES_MEMCACHED \
3535
$PACKAGES_LDAP
3636

37-
# Generate the locales configuration for all possible UTF-8 locales.
38-
echo 'Generating locales..'
39-
grep UTF-8 /usr/share/i18n/SUPPORTED > /etc/locale.gen
40-
locale-gen
41-
4237
echo "Installing php extensions"
4338

4439
# ZIP

0 commit comments

Comments
 (0)