Skip to content

Commit 8937c1c

Browse files
committed
Example of complete rewrite
1 parent 29c8425 commit 8937c1c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+4511
-26
lines changed

7.0/stretch/mssql/base/Dockerfile

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
#
2+
# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh"
3+
#
4+
# PLEASE DO NOT EDIT IT DIRECTLY.
5+
#
6+
7+
FROM php:7.0-apache-stretch
8+
9+
ARG DEBIAN_FRONTEND=noninteractive
10+
11+
# Install NVM and the current (as of 26/02/2019) LTS version of Node.
12+
ENV NVM_DIR /usr/local/nvm
13+
ENV NODE_VERSION lts/carbon
14+
RUN mkdir -p $NVM_DIR && \
15+
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash && \
16+
. $NVM_DIR/nvm.sh && nvm install $NODE_VERSION && nvm use --delete-prefix $NODE_VERSION
17+
18+
##<autogenerated-phpversion>##
19+
##</autogenerated-phpversion>##
20+
21+
# Build packages will be added during the build, but will be removed at the end.
22+
ENV BUILD_PACKAGES \
23+
gettext gnupg libcurl4-openssl-dev libfreetype6-dev libicu-dev libjpeg62-turbo-dev \
24+
libldap2-dev libmariadbclient-dev libmemcached-dev libpng-dev libpq-dev libxml2-dev libxslt-dev \
25+
zlib1g-dev
26+
27+
# Packages for Postgres.
28+
ENV PACKAGES_POSTGRES libpq5
29+
30+
# Packages for MariaDB and MySQL.
31+
ENV PACKAGES_MYMARIA libmariadbclient18
32+
33+
# Packages for other Moodle runtime dependenices.
34+
ENV PACKAGES_RUNTIME ghostscript libaio1 libcurl3 libgss3 libicu57 libmcrypt-dev libxml2 libxslt1.1 \
35+
locales sassc unzip unixodbc sassc
36+
37+
# Packages for Memcached.
38+
ENV PACKAGES_MEMCACHED libmemcached11 libmemcachedutil2
39+
40+
# Packages for LDAP.
41+
ENV PACKAGES_LDAP libldap-2.4-2
42+
43+
ENV PHP_EXTENSIONS intl \
44+
mysqli \
45+
opcache \
46+
pgsql \
47+
soap \
48+
xsl \
49+
xmlrpc \
50+
zip
51+
52+
# Install the standard PHP extensions.
53+
RUN apt-get update; apt-get install -y --no-install-recommends apt-transport-https \
54+
$BUILD_PACKAGES \
55+
$PACKAGES_POSTGRES \
56+
$PACKAGES_MYMARIA \
57+
$PACKAGES_RUNTIME \
58+
$PACKAGES_MEMCACHED \
59+
$PACKAGES_LDAP \
60+
echo 'Generating locales..'; \
61+
echo 'en_US.UTF-8 UTF-8' > /etc/locale.gen; \
62+
echo 'en_AU.UTF-8 UTF-8' >> /etc/locale.gen; \
63+
locale-gen; \
64+
\
65+
echo "Installing php extensions"; \
66+
docker-php-ext-install -j$(nproc) $PHP_EXTENSIONS; \
67+
\
68+
# GD.
69+
docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/; \
70+
docker-php-ext-install -j$(nproc) gd; \
71+
\
72+
# LDAP.
73+
docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu/; \
74+
docker-php-ext-install -j$(nproc) ldap; \
75+
\
76+
# SOLR, Memcached, Redis, APCu, igbinary.
77+
pecl install solr memcached redis apcu igbinary; \
78+
docker-php-ext-enable solr memcached redis apcu igbinary; \
79+
\
80+
echo 'apc.enable_cli = On' >> /usr/local/etc/php/conf.d/docker-php-ext-apcu.ini; \
81+
\
82+
# Keep our image size down..
83+
pecl clear-cache; \
84+
apt-get remove --purge -y $BUILD_PACKAGES; \
85+
apt-get autoremove -y; \
86+
apt-get clean; \
87+
rm -rf /var/lib/apt/lists/*
88+
89+
##<autogenerated-db>##
90+
# Install the MSSQL Extension.
91+
ENV BUILD_PACKAGES gnupg unixodbc-dev
92+
93+
RUN apt-get update; apt-get install -y --no-install-recommends apt-transport-https $BUILD_PACKAGES; \
94+
\
95+
# Install Microsoft dependcies for sqlsrv.
96+
curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -; \
97+
curl https://packages.microsoft.com/config/debian/9/prod.list -o /etc/apt/sources.list.d/mssql-release.list; \
98+
apt-get update; \
99+
ACCEPT_EULA=Y apt-get install -y msodbcsql17; \
100+
\
101+
pecl install sqlsrv; \
102+
docker-php-ext-enable sqlsrv; \
103+
\
104+
# Keep our image size down.
105+
pecl clear-cache; \
106+
apt-get remove --purge -y $BUILD_PACKAGES; \
107+
apt-get autoremove -y; \
108+
apt-get clean; \
109+
rm -rf /var/lib/apt/lists/*
110+
##</autogenerated-db>##
111+
112+
##<autogenerated-variant>##
113+
##</autogenerated-variant>##
114+
115+
# Set the custom entrypoint.
116+
ADD moodle-php-entrypoint /usr/local/bin/
117+
ENTRYPOINT ["moodle-php-entrypoint"]
118+
CMD ["apache2-foreground"]
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/usr/bin/env bash
2+
set -Eeo pipefail
3+
4+
ARGS="$@"
5+
6+
# Create directories for general usage.
7+
mkdir /var/www/moodledata && chown www-data:www-data /var/www/moodledata
8+
mkdir /var/www/phpunitdata && chown www-data:www-data /var/www/phpunitdata
9+
mkdir /var/www/behatdata && chown www-data:www-data /var/www/behatdata
10+
mkdir /var/www/behatfaildumps && chown www-data:www-data /var/www/behatfaildumps
11+
12+
# Ensure that all users get NVM as standard.
13+
echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"' >> /etc/bash.bashrc
14+
echo 'export NODE_REPL_HISTORY=' >> /etc/bash.bashrc
15+
mkdir /var/www/.config && chown www-data:www-data /var/www/.config
16+
17+
# Ensure that the requested version of node is installed.
18+
source $NVM_DIR/nvm.sh && nvm install $NODE_VERSION && nvm use --delete-prefix $NODE_VERSION
19+
echo 'nvm use "$NODE_VERSION"' >> /etc/bash.bashrc
20+
21+
# Load any additional entrypoint init files.
22+
for f in /docker-entrypoint-initdb.d/*; do
23+
case "$f" in
24+
*.sh)
25+
# https://github.com/docker-library/postgres/issues/450#issuecomment-393167936
26+
# https://github.com/docker-library/postgres/pull/452
27+
if [ -x "$f" ]; then
28+
echo "$0: running $f"
29+
"$f"
30+
else
31+
echo "$0: sourcing $f"
32+
. "$f"
33+
fi
34+
;;
35+
*) echo "$0: ignoring $f" ;;
36+
esac
37+
echo
38+
done
39+
40+
# Execute the original entrypoint with the original args.
41+
exec docker-php-entrypoint $ARGS

7.0/stretch/mssql/base/nvm-wrapper

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env bash
2+
set -Eeo pipefail
3+
4+
# This is a wrapper around NVM to load the nvm functions, and then run nvm.
5+
6+
if [ -z "$(LC_ALL=C type -t nvm)" ] || [ "$(LC_ALL=C type -t nvm)" != function ]
7+
then
8+
# The `nvm` variable does not exist, or is not a function.
9+
# Source nvm.sh to load it.
10+
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
11+
fi
12+
13+
nvm $@

7.0/stretch/mssql/ci/Dockerfile

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
#
2+
# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh"
3+
#
4+
# PLEASE DO NOT EDIT IT DIRECTLY.
5+
#
6+
7+
FROM php:7.0-apache-stretch
8+
9+
ARG DEBIAN_FRONTEND=noninteractive
10+
11+
# Install NVM and the current (as of 26/02/2019) LTS version of Node.
12+
ENV NVM_DIR /usr/local/nvm
13+
ENV NODE_VERSION lts/carbon
14+
RUN mkdir -p $NVM_DIR && \
15+
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash && \
16+
. $NVM_DIR/nvm.sh && nvm install $NODE_VERSION && nvm use --delete-prefix $NODE_VERSION
17+
18+
##<autogenerated-phpversion>##
19+
##</autogenerated-phpversion>##
20+
21+
# Build packages will be added during the build, but will be removed at the end.
22+
ENV BUILD_PACKAGES \
23+
gettext gnupg libcurl4-openssl-dev libfreetype6-dev libicu-dev libjpeg62-turbo-dev \
24+
libldap2-dev libmariadbclient-dev libmemcached-dev libpng-dev libpq-dev libxml2-dev libxslt-dev \
25+
zlib1g-dev
26+
27+
# Packages for Postgres.
28+
ENV PACKAGES_POSTGRES libpq5
29+
30+
# Packages for MariaDB and MySQL.
31+
ENV PACKAGES_MYMARIA libmariadbclient18
32+
33+
# Packages for other Moodle runtime dependenices.
34+
ENV PACKAGES_RUNTIME ghostscript libaio1 libcurl3 libgss3 libicu57 libmcrypt-dev libxml2 libxslt1.1 \
35+
locales sassc unzip unixodbc sassc
36+
37+
# Packages for Memcached.
38+
ENV PACKAGES_MEMCACHED libmemcached11 libmemcachedutil2
39+
40+
# Packages for LDAP.
41+
ENV PACKAGES_LDAP libldap-2.4-2
42+
43+
ENV PHP_EXTENSIONS intl \
44+
mysqli \
45+
opcache \
46+
pgsql \
47+
soap \
48+
xsl \
49+
xmlrpc \
50+
zip
51+
52+
# Install the standard PHP extensions.
53+
RUN apt-get update; apt-get install -y --no-install-recommends apt-transport-https \
54+
$BUILD_PACKAGES \
55+
$PACKAGES_POSTGRES \
56+
$PACKAGES_MYMARIA \
57+
$PACKAGES_RUNTIME \
58+
$PACKAGES_MEMCACHED \
59+
$PACKAGES_LDAP \
60+
echo 'Generating locales..'; \
61+
echo 'en_US.UTF-8 UTF-8' > /etc/locale.gen; \
62+
echo 'en_AU.UTF-8 UTF-8' >> /etc/locale.gen; \
63+
locale-gen; \
64+
\
65+
echo "Installing php extensions"; \
66+
docker-php-ext-install -j$(nproc) $PHP_EXTENSIONS; \
67+
\
68+
# GD.
69+
docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/; \
70+
docker-php-ext-install -j$(nproc) gd; \
71+
\
72+
# LDAP.
73+
docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu/; \
74+
docker-php-ext-install -j$(nproc) ldap; \
75+
\
76+
# SOLR, Memcached, Redis, APCu, igbinary.
77+
pecl install solr memcached redis apcu igbinary; \
78+
docker-php-ext-enable solr memcached redis apcu igbinary; \
79+
\
80+
echo 'apc.enable_cli = On' >> /usr/local/etc/php/conf.d/docker-php-ext-apcu.ini; \
81+
\
82+
# Keep our image size down..
83+
pecl clear-cache; \
84+
apt-get remove --purge -y $BUILD_PACKAGES; \
85+
apt-get autoremove -y; \
86+
apt-get clean; \
87+
rm -rf /var/lib/apt/lists/*
88+
89+
##<autogenerated-db>##
90+
# Install the MSSQL Extension.
91+
ENV BUILD_PACKAGES gnupg unixodbc-dev
92+
93+
RUN apt-get update; apt-get install -y --no-install-recommends apt-transport-https $BUILD_PACKAGES; \
94+
\
95+
# Install Microsoft dependcies for sqlsrv.
96+
curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -; \
97+
curl https://packages.microsoft.com/config/debian/9/prod.list -o /etc/apt/sources.list.d/mssql-release.list; \
98+
apt-get update; \
99+
ACCEPT_EULA=Y apt-get install -y msodbcsql17; \
100+
\
101+
pecl install sqlsrv; \
102+
docker-php-ext-enable sqlsrv; \
103+
\
104+
# Keep our image size down.
105+
pecl clear-cache; \
106+
apt-get remove --purge -y $BUILD_PACKAGES; \
107+
apt-get autoremove -y; \
108+
apt-get clean; \
109+
rm -rf /var/lib/apt/lists/*
110+
##</autogenerated-db>##
111+
112+
##<autogenerated-variant>##
113+
# Packages required for moodle-local_ci.
114+
ENV PACKAGES_CI git
115+
116+
# Install the standard PHP extensions.
117+
RUN apt-get update; apt-get install -y --no-install-recommends apt-transport-https \
118+
$PACKAGES_CI; \
119+
\
120+
# Keep our image size down..
121+
pecl clear-cache; \
122+
apt-get autoremove -y; \
123+
apt-get clean; \
124+
rm -rf /var/lib/apt/lists/*
125+
##</autogenerated-variant>##
126+
127+
# Set the custom entrypoint.
128+
ADD moodle-php-entrypoint /usr/local/bin/
129+
ENTRYPOINT ["moodle-php-entrypoint"]
130+
CMD ["apache2-foreground"]
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/usr/bin/env bash
2+
set -Eeo pipefail
3+
4+
ARGS="$@"
5+
6+
# Create directories for general usage.
7+
mkdir /var/www/moodledata && chown www-data:www-data /var/www/moodledata
8+
mkdir /var/www/phpunitdata && chown www-data:www-data /var/www/phpunitdata
9+
mkdir /var/www/behatdata && chown www-data:www-data /var/www/behatdata
10+
mkdir /var/www/behatfaildumps && chown www-data:www-data /var/www/behatfaildumps
11+
12+
# Ensure that all users get NVM as standard.
13+
echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"' >> /etc/bash.bashrc
14+
echo 'export NODE_REPL_HISTORY=' >> /etc/bash.bashrc
15+
mkdir /var/www/.config && chown www-data:www-data /var/www/.config
16+
17+
# Ensure that the requested version of node is installed.
18+
source $NVM_DIR/nvm.sh && nvm install $NODE_VERSION && nvm use --delete-prefix $NODE_VERSION
19+
echo 'nvm use "$NODE_VERSION"' >> /etc/bash.bashrc
20+
21+
# Load any additional entrypoint init files.
22+
for f in /docker-entrypoint-initdb.d/*; do
23+
case "$f" in
24+
*.sh)
25+
# https://github.com/docker-library/postgres/issues/450#issuecomment-393167936
26+
# https://github.com/docker-library/postgres/pull/452
27+
if [ -x "$f" ]; then
28+
echo "$0: running $f"
29+
"$f"
30+
else
31+
echo "$0: sourcing $f"
32+
. "$f"
33+
fi
34+
;;
35+
*) echo "$0: ignoring $f" ;;
36+
esac
37+
echo
38+
done
39+
40+
# Execute the original entrypoint with the original args.
41+
exec docker-php-entrypoint $ARGS

7.0/stretch/mssql/ci/nvm-wrapper

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env bash
2+
set -Eeo pipefail
3+
4+
# This is a wrapper around NVM to load the nvm functions, and then run nvm.
5+
6+
if [ -z "$(LC_ALL=C type -t nvm)" ] || [ "$(LC_ALL=C type -t nvm)" != function ]
7+
then
8+
# The `nvm` variable does not exist, or is not a function.
9+
# Source nvm.sh to load it.
10+
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
11+
fi
12+
13+
nvm $@

0 commit comments

Comments
 (0)