-
Notifications
You must be signed in to change notification settings - Fork 455
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor Dockerfile to support multiple variants and drop supervisord (…
…#200) * Refactor Dockerfile to support multiple variants and drop supervisord * Rename run.sh to docker-entrypoint.sh * Update tests for apache conatiner * Fix tests in conatiner * Fix database startup * Update Makefile to build all variants * Update phpMyAdmin to 4.8.4 * Rebase on top of v4.8.5
- Loading branch information
Showing
57 changed files
with
2,845 additions
and
100 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,71 @@ | ||
FROM php:7.2-%%VARIANT%% | ||
|
||
# docker-entrypoint.sh dependencies | ||
RUN apk add --no-cache \ | ||
bash | ||
|
||
# Install dependencies | ||
RUN set -ex; \ | ||
\ | ||
apk add --no-cache --virtual .build-deps \ | ||
bzip2-dev \ | ||
freetype-dev \ | ||
libjpeg-turbo-dev \ | ||
libpng-dev \ | ||
libwebp-dev \ | ||
libxpm-dev \ | ||
; \ | ||
\ | ||
docker-php-ext-configure gd --with-freetype-dir=/usr --with-jpeg-dir=/usr --with-webp-dir=/usr --with-png-dir=/usr --with-xpm-dir=/usr; \ | ||
docker-php-ext-install bz2 gd mysqli opcache zip; \ | ||
\ | ||
runDeps="$( \ | ||
scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/lib/php/extensions \ | ||
| tr ',' '\n' \ | ||
| sort -u \ | ||
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ | ||
)"; \ | ||
apk add --virtual .phpmyadmin-phpexts-rundeps $runDeps; \ | ||
apk del .build-deps | ||
|
||
# Calculate download URL | ||
ENV VERSION 4.8.5 | ||
ENV URL https://files.phpmyadmin.net/phpMyAdmin/${VERSION}/phpMyAdmin-${VERSION}-all-languages.tar.xz | ||
LABEL version=$VERSION | ||
|
||
# Download tarball, verify it using gpg and extract | ||
RUN set -ex; \ | ||
apk add --no-cache --virtual .fetch-deps \ | ||
gnupg \ | ||
; \ | ||
\ | ||
export GNUPGHOME="$(mktemp -d)"; \ | ||
export GPGKEY="3D06A59ECE730EB71B511C17CE752F178259BD92"; \ | ||
curl --output phpMyAdmin.tar.xz --location $URL; \ | ||
curl --output phpMyAdmin.tar.xz.asc --location $URL.asc; \ | ||
gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPGKEY" \ | ||
|| gpg --batch --keyserver ipv4.pool.sks-keyservers.net --recv-keys "$GPGKEY" \ | ||
|| gpg --batch --keyserver keys.gnupg.net --recv-keys "$GPGKEY" \ | ||
|| gpg --batch --keyserver pgp.mit.edu --recv-keys "$GPGKEY" \ | ||
|| gpg --batch --keyserver keyserver.pgp.com --recv-keys "$GPGKEY"; \ | ||
gpg --batch --verify phpMyAdmin.tar.xz.asc phpMyAdmin.tar.xz; \ | ||
tar -xf phpMyAdmin.tar.xz -C /usr/src; \ | ||
gpgconf --kill all; \ | ||
rm -r "$GNUPGHOME" phpMyAdmin.tar.xz phpMyAdmin.tar.xz.asc; \ | ||
mv /usr/src/phpMyAdmin-$VERSION-all-languages /usr/src/phpmyadmin; \ | ||
rm -rf /usr/src/phpmyadmin/setup/ /usr/src/phpmyadmin/examples/ /usr/src/phpmyadmin/test/ /usr/src/phpmyadmin/po/ /usr/src/phpmyadmin/composer.json /usr/src/phpmyadmin/RELEASE-DATE-$VERSION; \ | ||
sed -i "s@define('CONFIG_DIR'.*@define('CONFIG_DIR', '/etc/phpmyadmin/');@" /usr/src/phpmyadmin/libraries/vendor_config.php; \ | ||
# Add directory for sessions to allow session persistence | ||
mkdir /sessions; \ | ||
mkdir -p /var/nginx/client_body_temp; \ | ||
apk del .fetch-deps | ||
|
||
# Copy configuration | ||
COPY config.inc.php /etc/phpmyadmin/config.inc.php | ||
COPY php.ini /usr/local/etc/php/conf.d/php-phpmyadmin.ini | ||
|
||
# Copy main script | ||
COPY docker-entrypoint.sh /docker-entrypoint.sh | ||
|
||
ENTRYPOINT [ "/docker-entrypoint.sh" ] | ||
CMD ["%%CMD%%"] |
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,79 @@ | ||
FROM php:7.2-%%VARIANT%% | ||
|
||
# Install dependencies | ||
RUN set -ex; \ | ||
\ | ||
savedAptMark="$(apt-mark showmanual)"; \ | ||
\ | ||
apt-get update; \ | ||
apt-get install -y --no-install-recommends \ | ||
libbz2-dev \ | ||
libfreetype6-dev \ | ||
libjpeg-dev \ | ||
libpng-dev \ | ||
libwebp-dev \ | ||
libxpm-dev \ | ||
; \ | ||
\ | ||
docker-php-ext-configure gd --with-freetype-dir=/usr --with-jpeg-dir=/usr --with-webp-dir=/usr --with-png-dir=/usr --with-xpm-dir=/usr; \ | ||
docker-php-ext-install bz2 gd mysqli opcache zip; \ | ||
\ | ||
apt-mark auto '.*' > /dev/null; \ | ||
apt-mark manual $savedAptMark; \ | ||
ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \ | ||
| awk '/=>/ { print $3 }' \ | ||
| sort -u \ | ||
| xargs -r dpkg-query -S \ | ||
| cut -d: -f1 \ | ||
| sort -u \ | ||
| xargs -rt apt-mark manual; \ | ||
\ | ||
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# Calculate download URL | ||
ENV VERSION 4.8.5 | ||
ENV URL https://files.phpmyadmin.net/phpMyAdmin/${VERSION}/phpMyAdmin-${VERSION}-all-languages.tar.xz | ||
LABEL version=$VERSION | ||
|
||
# Download tarball, verify it using gpg and extract | ||
RUN set -ex; \ | ||
fetchDeps=" \ | ||
gnupg \ | ||
dirmngr \ | ||
"; \ | ||
apt-get update; \ | ||
apt-get install -y --no-install-recommends $fetchDeps; \ | ||
\ | ||
export GNUPGHOME="$(mktemp -d)"; \ | ||
export GPGKEY="3D06A59ECE730EB71B511C17CE752F178259BD92"; \ | ||
curl --output phpMyAdmin.tar.xz --location $URL; \ | ||
curl --output phpMyAdmin.tar.xz.asc --location $URL.asc; \ | ||
gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPGKEY" \ | ||
|| gpg --batch --keyserver ipv4.pool.sks-keyservers.net --recv-keys "$GPGKEY" \ | ||
|| gpg --batch --keyserver keys.gnupg.net --recv-keys "$GPGKEY" \ | ||
|| gpg --batch --keyserver pgp.mit.edu --recv-keys "$GPGKEY" \ | ||
|| gpg --batch --keyserver keyserver.pgp.com --recv-keys "$GPGKEY"; \ | ||
gpg --batch --verify phpMyAdmin.tar.xz.asc phpMyAdmin.tar.xz; \ | ||
tar -xf phpMyAdmin.tar.xz -C /usr/src; \ | ||
gpgconf --kill all; \ | ||
rm -r "$GNUPGHOME" phpMyAdmin.tar.xz phpMyAdmin.tar.xz.asc; \ | ||
mv /usr/src/phpMyAdmin-$VERSION-all-languages /usr/src/phpmyadmin; \ | ||
rm -rf /usr/src/phpmyadmin/setup/ /usr/src/phpmyadmin/examples/ /usr/src/phpmyadmin/test/ /usr/src/phpmyadmin/po/ /usr/src/phpmyadmin/composer.json /usr/src/phpmyadmin/RELEASE-DATE-$VERSION; \ | ||
sed -i "s@define('CONFIG_DIR'.*@define('CONFIG_DIR', '/etc/phpmyadmin/');@" /usr/src/phpmyadmin/libraries/vendor_config.php; \ | ||
# Add directory for sessions to allow session persistence | ||
mkdir /sessions; \ | ||
mkdir -p /var/nginx/client_body_temp; \ | ||
\ | ||
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $fetchDeps; \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# Copy configuration | ||
COPY config.inc.php /etc/phpmyadmin/config.inc.php | ||
COPY php.ini /usr/local/etc/php/conf.d/php-phpmyadmin.ini | ||
|
||
# Copy main script | ||
COPY docker-entrypoint.sh /docker-entrypoint.sh | ||
|
||
ENTRYPOINT [ "/docker-entrypoint.sh" ] | ||
CMD ["%%CMD%%"] |
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,79 @@ | ||
FROM php:7.2-apache | ||
|
||
# Install dependencies | ||
RUN set -ex; \ | ||
\ | ||
savedAptMark="$(apt-mark showmanual)"; \ | ||
\ | ||
apt-get update; \ | ||
apt-get install -y --no-install-recommends \ | ||
libbz2-dev \ | ||
libfreetype6-dev \ | ||
libjpeg-dev \ | ||
libpng-dev \ | ||
libwebp-dev \ | ||
libxpm-dev \ | ||
; \ | ||
\ | ||
docker-php-ext-configure gd --with-freetype-dir=/usr --with-jpeg-dir=/usr --with-webp-dir=/usr --with-png-dir=/usr --with-xpm-dir=/usr; \ | ||
docker-php-ext-install bz2 gd mysqli opcache zip; \ | ||
\ | ||
apt-mark auto '.*' > /dev/null; \ | ||
apt-mark manual $savedAptMark; \ | ||
ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \ | ||
| awk '/=>/ { print $3 }' \ | ||
| sort -u \ | ||
| xargs -r dpkg-query -S \ | ||
| cut -d: -f1 \ | ||
| sort -u \ | ||
| xargs -rt apt-mark manual; \ | ||
\ | ||
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# Calculate download URL | ||
ENV VERSION 4.8.5 | ||
ENV URL https://files.phpmyadmin.net/phpMyAdmin/${VERSION}/phpMyAdmin-${VERSION}-all-languages.tar.xz | ||
LABEL version=$VERSION | ||
|
||
# Download tarball, verify it using gpg and extract | ||
RUN set -ex; \ | ||
fetchDeps=" \ | ||
gnupg \ | ||
dirmngr \ | ||
"; \ | ||
apt-get update; \ | ||
apt-get install -y --no-install-recommends $fetchDeps; \ | ||
\ | ||
export GNUPGHOME="$(mktemp -d)"; \ | ||
export GPGKEY="3D06A59ECE730EB71B511C17CE752F178259BD92"; \ | ||
curl --output phpMyAdmin.tar.xz --location $URL; \ | ||
curl --output phpMyAdmin.tar.xz.asc --location $URL.asc; \ | ||
gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPGKEY" \ | ||
|| gpg --batch --keyserver ipv4.pool.sks-keyservers.net --recv-keys "$GPGKEY" \ | ||
|| gpg --batch --keyserver keys.gnupg.net --recv-keys "$GPGKEY" \ | ||
|| gpg --batch --keyserver pgp.mit.edu --recv-keys "$GPGKEY" \ | ||
|| gpg --batch --keyserver keyserver.pgp.com --recv-keys "$GPGKEY"; \ | ||
gpg --batch --verify phpMyAdmin.tar.xz.asc phpMyAdmin.tar.xz; \ | ||
tar -xf phpMyAdmin.tar.xz -C /usr/src; \ | ||
gpgconf --kill all; \ | ||
rm -r "$GNUPGHOME" phpMyAdmin.tar.xz phpMyAdmin.tar.xz.asc; \ | ||
mv /usr/src/phpMyAdmin-$VERSION-all-languages /usr/src/phpmyadmin; \ | ||
rm -rf /usr/src/phpmyadmin/setup/ /usr/src/phpmyadmin/examples/ /usr/src/phpmyadmin/test/ /usr/src/phpmyadmin/po/ /usr/src/phpmyadmin/composer.json /usr/src/phpmyadmin/RELEASE-DATE-$VERSION; \ | ||
sed -i "s@define('CONFIG_DIR'.*@define('CONFIG_DIR', '/etc/phpmyadmin/');@" /usr/src/phpmyadmin/libraries/vendor_config.php; \ | ||
# Add directory for sessions to allow session persistence | ||
mkdir /sessions; \ | ||
mkdir -p /var/nginx/client_body_temp; \ | ||
\ | ||
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $fetchDeps; \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# Copy configuration | ||
COPY config.inc.php /etc/phpmyadmin/config.inc.php | ||
COPY php.ini /usr/local/etc/php/conf.d/php-phpmyadmin.ini | ||
|
||
# Copy main script | ||
COPY docker-entrypoint.sh /docker-entrypoint.sh | ||
|
||
ENTRYPOINT [ "/docker-entrypoint.sh" ] | ||
CMD ["apache2-foreground"] |
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,50 @@ | ||
#!/bin/bash | ||
if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then | ||
if [ "$(id -u)" = '0' ]; then | ||
case "$1" in | ||
apache2*) | ||
user="${APACHE_RUN_USER:-www-data}" | ||
group="${APACHE_RUN_GROUP:-www-data}" | ||
;; | ||
*) # php-fpm | ||
user='www-data' | ||
group='www-data' | ||
;; | ||
esac | ||
else | ||
user="$(id -u)" | ||
group="$(id -g)" | ||
fi | ||
|
||
chown www-data:www-data /sessions /var/nginx/client_body_temp | ||
|
||
if ! [ -e index.php -a -e db_designer.php ]; then | ||
echo >&2 "phpMyAdmin not found in $PWD - copying now..." | ||
if [ "$(ls -A)" ]; then | ||
echo >&2 "WARNING: $PWD is not empty - press Ctrl+C now if this is an error!" | ||
( set -x; ls -A; sleep 10 ) | ||
fi | ||
tar --create \ | ||
--file - \ | ||
--one-file-system \ | ||
--directory /usr/src/phpmyadmin \ | ||
--owner "$user" --group "$group" \ | ||
. | tar --extract --file - | ||
echo >&2 "Complete! phpMyAdmin has been successfully copied to $PWD" | ||
mkdir -p tmp; \ | ||
chmod -R 777 tmp; \ | ||
fi | ||
|
||
if [ ! -f /etc/phpmyadmin/config.secret.inc.php ]; then | ||
cat > /etc/phpmyadmin/config.secret.inc.php <<EOT | ||
<?php | ||
\$cfg['blowfish_secret'] = '$(tr -dc 'a-zA-Z0-9~!@#$%^&*_()+}{?></";.,[]=-' < /dev/urandom | fold -w 32 | head -n 1)'; | ||
EOT | ||
fi | ||
|
||
if [ ! -f /etc/phpmyadmin/config.user.inc.php ]; then | ||
touch /etc/phpmyadmin/config.user.inc.php | ||
fi | ||
fi | ||
|
||
exec "$@" |
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,15 @@ | ||
[global] | ||
error_log = /var/log/php-fpm.log | ||
log_level = warning | ||
|
||
[www] | ||
listen = /var/run/php/php-fpm.sock | ||
listen.mode = 0660 | ||
chdir = /var/www/html | ||
pm = dynamic | ||
pm.max_children = 5 | ||
pm.start_servers = 2 | ||
pm.min_spare_servers = 1 | ||
pm.max_spare_servers = 3 | ||
catch_workers_output = Yes | ||
clear_env = No |
Oops, something went wrong.