Compare commits

...
28 Commits
Author SHA1 Message Date
Isaac Bennetch 8803357e6a Configure to use snapshot builds for 4.9 series
Signed-off-by: Isaac Bennetch <bennetch@gmail.com>
2019-06-08 13:56:12 -04:00
Isaac Bennetch 21be77a8e8 Remove GPG verification of downloads, since we don't sign snapshot
builds.

See also: #131

Fixes: #228

Signed-off-by: Isaac Bennetch <bennetch@gmail.com>
2019-06-08 13:54:17 -04:00
Isaac Bennetch db5c629d4a Set up edge-4.9
Signed-off-by: Isaac Bennetch <bennetch@gmail.com>
2019-06-05 22:24:05 -04:00
Isaac Bennetch 41ef7ee430 Upgrade to phpMyAdmin version 4.9.0.1
Signed-off-by: Isaac Bennetch <bennetch@gmail.com>
2019-06-04 12:36:40 -04:00
William Desportes 33fc40f4a3 Merge pull-request #222 (remove .dockerignore)
Signed-off-by: William Desportes <williamdes@wdes.fr>
2019-05-22 18:37:52 +02:00
William Desportes 219e173c5e Merge pull-request #225 (clean unused files)
Signed-off-by: William Desportes <williamdes@wdes.fr>
2019-05-22 18:21:48 +02:00
J0WI f30ef539da Cleanup obsolete files 2019-05-22 16:57:57 +02:00
J0WI 036fd21c08 Remove .dockerignore 2019-04-24 19:50:44 +02:00
J0WIandIsaac Bennetch 78e3cb7aba 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
2019-03-29 03:48:30 -04:00
Isaac Bennetch a114733200 Update to version 4.8.5
Signed-off-by: Isaac Bennetch <bennetch@gmail.com>
2019-01-25 22:52:24 -05:00
Isaac BennetchandGitHub 967db65940 Merge pull request #201 from J0WI/travis-nosudo
[Travis CI] Drop sudo and use default distro
2018-12-30 08:48:14 -05:00
Isaac Bennetch 921f2867f7 Updated version information to remove old, unsupported releases.
Signed-off-by: Isaac Bennetch <bennetch@gmail.com>
2018-12-30 06:46:42 -07:00
Isaac BennetchandGitHub df7df179f2 Merge pull request #202 from glensc/patch-1
Add 4.8 tag to README
2018-12-30 08:37:10 -05:00
Elan RuusamäeandGitHub 0e87cd4731 readme: 4.8 tag is also present
for ones that prefer not to have unexpected version update (but patches are ok), prefer `X.Y` docker tag over `latest`.

improve wording as technically there is no 4.8 branch yet
2018-12-19 11:55:56 +02:00
Isaac Bennetch d3d7a78dae Update to version 4.8.4
Signed-off-by: Isaac Bennetch <bennetch@gmail.com>
2018-12-10 21:21:00 -05:00
J0WI c775ef93dc Drop sudo and use default distro 2018-11-25 17:21:33 +01:00
Isaac BennetchandGitHub d2f01baf40 Merge pull request #198 from J0WI/user-and-root
Drop custom user/group and document root, change permissions on runtime, and coding style improvements.
2018-11-22 10:09:01 -05:00
Isaac BennetchandGitHub 56806ecbc7 Merge pull request #197 from J0WI/gpg-batch
Update "gpg" invocations to use "--batch"
2018-11-22 00:17:55 -05:00
J0WI 662b82d27e Drop custom user/group and document root, change permissions on runtime 2018-11-20 01:55:47 +01:00
J0WI fa5fb6c985 Update "gpg" invocations to use "--batch" 2018-11-20 00:44:44 +01:00
Michal ČihařandGitHub b1e2062fb4 Merge pull request #184 from deeky666/allow-env-var-list-spaces
Trims whitespaces in PMA_HOSTS, PMA_PORTS and PMA_VERBOSES
2018-09-01 13:21:22 +02:00
Michal ČihařandGitHub f01eddea45 Merge pull request #191 from baotongshi/patch-1
modify the /etc/phpmyadmin/* file's access right
2018-09-01 13:20:50 +02:00
Michal ČihařandGitHub 7899e91e35 Merge pull request #186 from s0m30n3/master
Specify MySQL socket file via PMA_SOCKET and PMA_SOCKETS environment …
2018-09-01 13:20:21 +02:00
Évan GoujonandGOUJON Évan 7af014ffdf Simplify $sockets testing logic
Signed-off-by: Évan Goujon <evan.goujon@gmail.com>
2018-08-31 21:51:56 +02:00
Baotong ShiandGitHub 0512d0c6b3 Update run.sh
when I start the phpMyAdmin Container, I got the below error
phpMyAdmin - Error
Failed to load phpMyAdmin configuration (./../etc/phpmyadmin/config.inc.php:3): require(): Failed opening required '/etc/phpmyadmin/config.secret.inc.php' (include_path='.:/usr/local/lib/php')

I found the access right of the config.secret.inc.php is not correct, I added the below cmd in run.sh, then build the image, It can work

chmod 644 /etc/phpmyadmin/*
2018-08-30 09:46:04 +08:00
Isaac Bennetch 17003ccf85 Update to version 4.8.3
Signed-off-by: Isaac Bennetch <bennetch@gmail.com>
2018-08-22 10:23:38 -04:00
Évan GoujonandGOUJON Alexandre d5a587d00d Specify MySQL socket file via PMA_SOCKET and PMA_SOCKETS environment variables
Signed-off-by: Évan Goujon <evan.goujon@gmail.com>
2018-08-19 22:21:47 +02:00
Steve Müller b2409f5930 trim whitespaces in PMA_HOSTS, PMA_PORTS and PMA_VERBOSES 2018-08-03 12:30:33 +02:00
33 changed files with 1068 additions and 379 deletions
-7
View File
@@ -1,7 +0,0 @@
.travis.yml
docker-compose.yml
docker-compose.testing.yml
README.md
LICENSE
Makefile
testing
+5 -8
View File
@@ -1,7 +1,3 @@
dist: trusty
sudo: required
services:
- docker
@@ -12,7 +8,7 @@ python:
env:
matrix:
- DB=mysql:latest
- DB=mariadb:10.2
- DB=mariadb:latest
before_install:
- export TESTSUITE_PASSWORD=`openssl rand -base64 30`
@@ -23,7 +19,7 @@ install:
script:
# Build image
- docker build -t phpmyadmin/phpmyadmin .
- docker build -t phpmyadmin/phpmyadmin apache
# Test for single database
- docker run --name testadmin -d --link db_server:db -p 9090:80 phpmyadmin/phpmyadmin
- ./testing/test-docker.sh testadmin 9090
@@ -41,5 +37,6 @@ script:
- ./testing/test-docker.sh phpmyadmin 8080 db_server
- docker-compose stop
# Run tests in testing container
- docker-compose -f docker-compose.testing.yml up -d phpmyadmin
- ./testing/wait-for-testing.sh
- docker-compose -f docker-compose.testing.yml up -d db_server
- docker-compose -f docker-compose.testing.yml up -d
- docker-compose exec phpmyadmin /test-docker.sh phpmyadmin_testing 80 phpmyadmin_testing_db
-78
View File
@@ -1,78 +0,0 @@
FROM php:7.2-fpm-alpine
RUN apk add --no-cache \
nginx \
supervisor
# 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.2
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 --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPGKEY" \
|| gpg --keyserver ipv4.pool.sks-keyservers.net --recv-keys "$GPGKEY" \
|| gpg --keyserver keys.gnupg.net --recv-keys "$GPGKEY" \
|| gpg --keyserver pgp.mit.edu --recv-keys "$GPGKEY" \
|| gpg --keyserver keyserver.pgp.com --recv-keys "$GPGKEY"; \
gpg --batch --verify phpMyAdmin.tar.xz.asc phpMyAdmin.tar.xz; \
tar -xf phpMyAdmin.tar.xz; \
gpgconf --kill all; \
rm -r "$GNUPGHOME" phpMyAdmin.tar.xz phpMyAdmin.tar.xz.asc; \
mv phpMyAdmin-$VERSION-all-languages /www; \
rm -rf /www/setup/ /www/examples/ /www/test/ /www/po/ /www/composer.json /www/RELEASE-DATE-$VERSION; \
sed -i "s@define('CONFIG_DIR'.*@define('CONFIG_DIR', '/etc/phpmyadmin/');@" /www/libraries/vendor_config.php; \
chown -R nobody:nogroup /www; \
find /www -type d -exec chmod 750 {} \; ; \
find /www -type f -exec chmod 640 {} \; ; \
# Add directory for sessions to allow session persistence
mkdir /sessions; \
mkdir -p /www/tmp; \
chmod -R 777 /www/tmp; \
apk del .fetch-deps
# Copy configuration
COPY etc /etc/
COPY php.ini /usr/local/etc/php/conf.d/php-phpmyadmin.ini
# Copy main script
COPY run.sh /run.sh
# We expose phpMyAdmin on port 80
EXPOSE 80
ENTRYPOINT [ "/run.sh" ]
CMD ["supervisord", "-n"]
+56
View File
@@ -0,0 +1,56 @@
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.9+snapshot
ENV URL https://files.phpmyadmin.net/snapshots/phpMyAdmin-${VERSION}-all-languages.tar.xz
LABEL version=$VERSION
# Download tarball and extract
RUN set -ex; \
curl --output phpMyAdmin.tar.xz --location $URL; \
tar -xf phpMyAdmin.tar.xz -C /usr/src; \
rm -r phpMyAdmin.tar.xz; \
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
# 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%%"]
+59
View File
@@ -0,0 +1,59 @@
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.9+snapshot
ENV URL https://files.phpmyadmin.net/snapshots/phpMyAdmin-${VERSION}-all-languages.tar.xz
LABEL version=$VERSION
# Download tarball and extract
RUN set -ex; \
curl --output phpMyAdmin.tar.xz --location $URL; \
tar -xf phpMyAdmin.tar.xz -C /usr/src; \
rm -r phpMyAdmin.tar.xz; \
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
# 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%%"]
+9 -4
View File
@@ -4,11 +4,16 @@ DOCKER_REPO = phpmyadmin/phpmyadmin
all: build run logs
build:
docker build -t ${DOCKER_REPO}:testing .
build: build-apache build-fpm build-fpm-alpine
build_nc:
docker build --no-cache=true -t ${DOCKER_REPO}:testing .
build-apache:
docker build ${DOCKER_FLAGS} -t ${DOCKER_REPO}:testing apache
build-fpm:
docker build ${DOCKER_FLAGS} -t ${DOCKER_REPO}:testing-fpm fpm
build-fpm-alpine:
docker build ${DOCKER_FLAGS} -t ${DOCKER_REPO}:testing-fpm-alpine fpm-alpine
run:
docker-compose -f docker-compose.testing.yml up -d
+1 -3
View File
@@ -27,10 +27,8 @@ The official MySQL and MariaDB use following environment variables to define the
You can use following tags on Docker hub:
* `latest` - latest stable release
* `4.6` - latest stable release from the 4.6 branch
* `4.7` - latest stable release from the 4.7 branch
* `4.8` - latest stable release for the 4.8 version
* `edge` - bleeding edge docker image (contains stable phpMyAdmin, but the Docker image changes might not yet be fully tested)
* `edge-4.7` - bleeding edge docker image + latest snapshots from 4.7 branch
* `edge-4.8` - bleeding edge docker image + latest snapshots from 4.8 branch (currently master)
## Usage with linked server
+59
View File
@@ -0,0 +1,59 @@
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.9+snapshot
ENV URL https://files.phpmyadmin.net/snapshots/phpMyAdmin-${VERSION}-all-languages.tar.xz
LABEL version=$VERSION
# Download tarball and extract
RUN set -ex; \
curl --output phpMyAdmin.tar.xz --location $URL; \
tar -xf phpMyAdmin.tar.xz -C /usr/src; \
rm -r phpMyAdmin.tar.xz; \
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
# 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"]
@@ -11,6 +11,8 @@ $vars = array(
'PMA_VERBOSES',
'PMA_PORT',
'PMA_PORTS',
'PMA_SOCKET',
'PMA_SOCKETS',
'PMA_USER',
'PMA_PASSWORD',
'PMA_ABSOLUTE_URI',
@@ -52,9 +54,14 @@ if (!empty($_ENV['PMA_HOST'])) {
$verbose = array($_ENV['PMA_VERBOSE']);
$ports = array($_ENV['PMA_PORT']);
} elseif (!empty($_ENV['PMA_HOSTS'])) {
$hosts = explode(',', $_ENV['PMA_HOSTS']);
$verbose = explode(',', $_ENV['PMA_VERBOSES']);
$ports = explode(',', $_ENV['PMA_PORTS']);
$hosts = array_map('trim', explode(',', $_ENV['PMA_HOSTS']));
$verbose = array_map('trim', explode(',', $_ENV['PMA_VERBOSES']));
$ports = array_map('trim', explode(',', $_ENV['PMA_PORTS']));
}
if (!empty($_ENV['PMA_SOCKET'])) {
$sockets = array($_ENV['PMA_SOCKET']);
} elseif (!empty($_ENV['PMA_SOCKETS'])) {
$sockets = explode(',', $_ENV['PMA_SOCKETS']);
}
/* Server settings */
@@ -110,6 +117,10 @@ for ($i = 1; isset($hosts[$i - 1]); $i++) {
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['AllowNoPassword'] = true;
}
for ($i = 1; isset($sockets[$i - 1]); $i++) {
$cfg['Servers'][$i]['socket'] = $sockets[$i - 1];
$cfg['Servers'][$i]['host'] = 'localhost';
}
/*
* Revert back to last configured server to make
* it easier in config.user.inc.php
+50
View File
@@ -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 "$@"
+20
View File
@@ -0,0 +1,20 @@
[PHP]
allow_url_fopen = Off
max_execution_time = 600
memory_limit = 512M
open_basedir = /var/www/html:/tmp/:/etc/phpmyadmin/
post_max_size = 512M
upload_max_filesize = 512M
[Session]
session.cookie_httponly = 1
session.hash_function = 1
session.save_path = "/sessions"
session.use_strict_mode = 1
[opcache]
opcache.fast_shutdown = 1
opcache.restrict_api = /disabled/
opcache.save_comments = 0
opcache.use_cwd = 0
opcache.validate_timestamps = 0
+137
View File
@@ -0,0 +1,137 @@
<?php
require('/etc/phpmyadmin/config.secret.inc.php');
/* Ensure we got the environment */
$vars = array(
'PMA_ARBITRARY',
'PMA_HOST',
'PMA_HOSTS',
'PMA_VERBOSE',
'PMA_VERBOSES',
'PMA_PORT',
'PMA_PORTS',
'PMA_SOCKET',
'PMA_SOCKETS',
'PMA_USER',
'PMA_PASSWORD',
'PMA_ABSOLUTE_URI',
'PMA_CONTROLHOST',
'PMA_CONTROLPORT',
'PMA_PMADB',
'PMA_CONTROLUSER',
'PMA_CONTROLPASS',
'PMA_QUERYHISTORYDB'
);
foreach ($vars as $var) {
$env = getenv($var);
if (!isset($_ENV[$var]) && $env !== false) {
$_ENV[$var] = $env;
}
}
if (isset($_ENV['PMA_QUERYHISTORYDB'])) {
$cfg['QueryHistoryDB'] = boolval($_ENV['PMA_QUERYHISTORYDB']);
}
/* Arbitrary server connection */
if (isset($_ENV['PMA_ARBITRARY']) && $_ENV['PMA_ARBITRARY'] === '1') {
$cfg['AllowArbitraryServer'] = true;
}
/* Play nice behind reverse proxys */
if (isset($_ENV['PMA_ABSOLUTE_URI'])) {
$cfg['PmaAbsoluteUri'] = trim($_ENV['PMA_ABSOLUTE_URI']);
}
/* Figure out hosts */
/* Fallback to default linked */
$hosts = array('db');
/* Set by environment */
if (!empty($_ENV['PMA_HOST'])) {
$hosts = array($_ENV['PMA_HOST']);
$verbose = array($_ENV['PMA_VERBOSE']);
$ports = array($_ENV['PMA_PORT']);
} elseif (!empty($_ENV['PMA_HOSTS'])) {
$hosts = array_map('trim', explode(',', $_ENV['PMA_HOSTS']));
$verbose = array_map('trim', explode(',', $_ENV['PMA_VERBOSES']));
$ports = array_map('trim', explode(',', $_ENV['PMA_PORTS']));
}
if (!empty($_ENV['PMA_SOCKET'])) {
$sockets = array($_ENV['PMA_SOCKET']);
} elseif (!empty($_ENV['PMA_SOCKETS'])) {
$sockets = explode(',', $_ENV['PMA_SOCKETS']);
}
/* Server settings */
for ($i = 1; isset($hosts[$i - 1]); $i++) {
$cfg['Servers'][$i]['host'] = $hosts[$i - 1];
if (isset($verbose[$i - 1])) {
$cfg['Servers'][$i]['verbose'] = $verbose[$i - 1];
}
if (isset($ports[$i - 1])) {
$cfg['Servers'][$i]['port'] = $ports[$i - 1];
}
if (isset($_ENV['PMA_USER'])) {
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = $_ENV['PMA_USER'];
$cfg['Servers'][$i]['password'] = isset($_ENV['PMA_PASSWORD']) ? $_ENV['PMA_PASSWORD'] : '';
} else {
$cfg['Servers'][$i]['auth_type'] = 'cookie';
}
if (isset($_ENV['PMA_PMADB'])) {
$cfg['Servers'][$i]['pmadb'] = $_ENV['PMA_PMADB'];
$cfg['Servers'][$i]['relation'] = 'pma__relation';
$cfg['Servers'][$i]['table_info'] = 'pma__table_info';
$cfg['Servers'][$i]['table_coords'] = 'pma__table_coords';
$cfg['Servers'][$i]['pdf_pages'] = 'pma__pdf_pages';
$cfg['Servers'][$i]['column_info'] = 'pma__column_info';
$cfg['Servers'][$i]['bookmarktable'] = 'pma__bookmark';
$cfg['Servers'][$i]['history'] = 'pma__history';
$cfg['Servers'][$i]['recent'] = 'pma__recent';
$cfg['Servers'][$i]['favorite'] = 'pma__favorite';
$cfg['Servers'][$i]['table_uiprefs'] = 'pma__table_uiprefs';
$cfg['Servers'][$i]['tracking'] = 'pma__tracking';
$cfg['Servers'][$i]['userconfig'] = 'pma__userconfig';
$cfg['Servers'][$i]['users'] = 'pma__users';
$cfg['Servers'][$i]['usergroups'] = 'pma__usergroups';
$cfg['Servers'][$i]['navigationhiding'] = 'pma__navigationhiding';
$cfg['Servers'][$i]['savedsearches'] = 'pma__savedsearches';
$cfg['Servers'][$i]['central_columns'] = 'pma__central_columns';
$cfg['Servers'][$i]['designer_settings'] = 'pma__designer_settings';
$cfg['Servers'][$i]['export_templates'] = 'pma__export_templates';
}
if (isset($_ENV['PMA_CONTROLHOST'])) {
$cfg['Servers'][$i]['controlhost'] = $_ENV['PMA_CONTROLHOST'];
}
if (isset($_ENV['PMA_CONTROLPORT'])) {
$cfg['Servers'][$i]['controlport'] = $_ENV['PMA_CONTROLPORT'];
}
if (isset($_ENV['PMA_CONTROLUSER'])) {
$cfg['Servers'][$i]['controluser'] = $_ENV['PMA_CONTROLUSER'];
}
if (isset($_ENV['PMA_CONTROLPASS'])) {
$cfg['Servers'][$i]['controlpass'] = $_ENV['PMA_CONTROLPASS'];
}
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['AllowNoPassword'] = true;
}
for ($i = 1; isset($sockets[$i - 1]); $i++) {
$cfg['Servers'][$i]['socket'] = $sockets[$i - 1];
$cfg['Servers'][$i]['host'] = 'localhost';
}
/*
* Revert back to last configured server to make
* it easier in config.user.inc.php
*/
$i--;
/* Uploads setup */
$cfg['UploadDir'] = '';
$cfg['SaveDir'] = '';
/* Include User Defined Settings Hook */
if (file_exists('/etc/phpmyadmin/config.user.inc.php')) {
include('/etc/phpmyadmin/config.user.inc.php');
}
+5 -3
View File
@@ -3,15 +3,17 @@ version: '2'
services:
db_server:
image: ${DB}
container_name: phpmyadmin_testing_mariadb
container_name: phpmyadmin_testing_db
environment:
- MYSQL_ROOT_PASSWORD=test123
- MYSQL_ROOT_PASSWORD=${TESTSUITE_PASSWORD}
volumes:
- ./testing/testing.cnf:/etc/mysql/conf.d/testing.cnf:ro
phpmyadmin:
build:
context: testing/
links:
- db_server:db_server
container_name: phpmyadmin_testing
volumes:
- /sessions
@@ -19,6 +21,6 @@ services:
- 8090:80
environment:
- PMA_ARBITRARY=1
- TESTSUITE_PASSWORD=test123
- TESTSUITE_PASSWORD=${TESTSUITE_PASSWORD}
depends_on:
- db_server
+50
View File
@@ -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 "$@"
-132
View File
@@ -1,132 +0,0 @@
user nobody nogroup;
worker_processes 4;
daemon off;
pid /nginx.pid;
error_log /var/log/nginx-error.log;
events {
worker_connections 1024;
}
http {
types {
text/html html htm shtml;
text/css css;
text/xml xml;
image/gif gif;
image/jpeg jpeg jpg;
application/javascript js;
application/atom+xml atom;
application/rss+xml rss;
}
default_type application/octet-stream;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
client_body_timeout 12;
client_header_timeout 12;
keepalive_timeout 15;
send_timeout 10;
server_tokens off;
client_body_buffer_size 512K;
client_body_temp_path /var/nginx/client_body_temp;
client_header_buffer_size 16k;
client_max_body_size 512M;
large_client_header_buffers 4 8k;
gzip on;
gzip_comp_level 2;
gzip_min_length 1000;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain application/x-javascript text/xml text/css application/xml;
access_log off;
server {
listen 80 default_server;
server_name _;
root /www;
index index.php index.html index.htm;
charset utf-8;
if ($request_method !~ ^(GET|HEAD|POST)$ ) {
return 405;
}
location / {
try_files $uri $uri/ =404;
}
location ~* .(jpg|jpeg|png|gif|ico|css|js)$ {
expires 365d;
}
location ~ \.php$ {
fastcgi_intercept_errors on;
fastcgi_pass unix:/var/run/php/php-fpm.sock;
# regex to split $uri to $fastcgi_script_name and $fastcgi_path
fastcgi_split_path_info ^(.+\.php)(/.+)$;
# Check that the PHP script exists before passing it
try_files $fastcgi_script_name =404;
# Bypass the fact that try_files resets $fastcgi_path_info
# see: https://trac.nginx.org/nginx/ticket/321
set $path_info $fastcgi_path_info;
fastcgi_param PATH_INFO $path_info;
fastcgi_read_timeout 1200;
fastcgi_buffering off;
fastcgi_buffers 16 16k;
fastcgi_buffer_size 32k;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param REQUEST_SCHEME $scheme;
fastcgi_param HTTPS $https if_not_empty;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param REDIRECT_STATUS 200;
}
location ~ /\. {
deny all;
}
location ~ /(libraries|templates) {
deny all;
}
}
}
-17
View File
@@ -1,17 +0,0 @@
[global]
error_log = /var/log/php-fpm.log
log_level = warning
[www]
user = nobody
group = nogroup
listen = /var/run/php/php-fpm.sock
listen.mode = 0660
chdir = /www
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
-12
View File
@@ -1,12 +0,0 @@
[program:nginx]
command=nginx -c /etc/nginx.conf
autostart=true
autorestart=true
priority=2
startretries=3
stopwaitsecs=10
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
-13
View File
@@ -1,13 +0,0 @@
[program:php-fpm]
command=php-fpm --nodaemonize --fpm-config /etc/php-fpm.conf
user=nobody
autostart=true
autorestart=true
priority=1
startretries=3
stopwaitsecs=10
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
+56
View File
@@ -0,0 +1,56 @@
FROM php:7.2-fpm-alpine
# 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.9+snapshot
ENV URL https://files.phpmyadmin.net/snapshots/phpMyAdmin-${VERSION}-all-languages.tar.xz
LABEL version=$VERSION
# Download tarball and extract
RUN set -ex; \
curl --output phpMyAdmin.tar.xz --location $URL; \
tar -xf phpMyAdmin.tar.xz -C /usr/src; \
rm -r phpMyAdmin.tar.xz; \
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
# 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 ["php-fpm"]
+137
View File
@@ -0,0 +1,137 @@
<?php
require('/etc/phpmyadmin/config.secret.inc.php');
/* Ensure we got the environment */
$vars = array(
'PMA_ARBITRARY',
'PMA_HOST',
'PMA_HOSTS',
'PMA_VERBOSE',
'PMA_VERBOSES',
'PMA_PORT',
'PMA_PORTS',
'PMA_SOCKET',
'PMA_SOCKETS',
'PMA_USER',
'PMA_PASSWORD',
'PMA_ABSOLUTE_URI',
'PMA_CONTROLHOST',
'PMA_CONTROLPORT',
'PMA_PMADB',
'PMA_CONTROLUSER',
'PMA_CONTROLPASS',
'PMA_QUERYHISTORYDB'
);
foreach ($vars as $var) {
$env = getenv($var);
if (!isset($_ENV[$var]) && $env !== false) {
$_ENV[$var] = $env;
}
}
if (isset($_ENV['PMA_QUERYHISTORYDB'])) {
$cfg['QueryHistoryDB'] = boolval($_ENV['PMA_QUERYHISTORYDB']);
}
/* Arbitrary server connection */
if (isset($_ENV['PMA_ARBITRARY']) && $_ENV['PMA_ARBITRARY'] === '1') {
$cfg['AllowArbitraryServer'] = true;
}
/* Play nice behind reverse proxys */
if (isset($_ENV['PMA_ABSOLUTE_URI'])) {
$cfg['PmaAbsoluteUri'] = trim($_ENV['PMA_ABSOLUTE_URI']);
}
/* Figure out hosts */
/* Fallback to default linked */
$hosts = array('db');
/* Set by environment */
if (!empty($_ENV['PMA_HOST'])) {
$hosts = array($_ENV['PMA_HOST']);
$verbose = array($_ENV['PMA_VERBOSE']);
$ports = array($_ENV['PMA_PORT']);
} elseif (!empty($_ENV['PMA_HOSTS'])) {
$hosts = array_map('trim', explode(',', $_ENV['PMA_HOSTS']));
$verbose = array_map('trim', explode(',', $_ENV['PMA_VERBOSES']));
$ports = array_map('trim', explode(',', $_ENV['PMA_PORTS']));
}
if (!empty($_ENV['PMA_SOCKET'])) {
$sockets = array($_ENV['PMA_SOCKET']);
} elseif (!empty($_ENV['PMA_SOCKETS'])) {
$sockets = explode(',', $_ENV['PMA_SOCKETS']);
}
/* Server settings */
for ($i = 1; isset($hosts[$i - 1]); $i++) {
$cfg['Servers'][$i]['host'] = $hosts[$i - 1];
if (isset($verbose[$i - 1])) {
$cfg['Servers'][$i]['verbose'] = $verbose[$i - 1];
}
if (isset($ports[$i - 1])) {
$cfg['Servers'][$i]['port'] = $ports[$i - 1];
}
if (isset($_ENV['PMA_USER'])) {
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = $_ENV['PMA_USER'];
$cfg['Servers'][$i]['password'] = isset($_ENV['PMA_PASSWORD']) ? $_ENV['PMA_PASSWORD'] : '';
} else {
$cfg['Servers'][$i]['auth_type'] = 'cookie';
}
if (isset($_ENV['PMA_PMADB'])) {
$cfg['Servers'][$i]['pmadb'] = $_ENV['PMA_PMADB'];
$cfg['Servers'][$i]['relation'] = 'pma__relation';
$cfg['Servers'][$i]['table_info'] = 'pma__table_info';
$cfg['Servers'][$i]['table_coords'] = 'pma__table_coords';
$cfg['Servers'][$i]['pdf_pages'] = 'pma__pdf_pages';
$cfg['Servers'][$i]['column_info'] = 'pma__column_info';
$cfg['Servers'][$i]['bookmarktable'] = 'pma__bookmark';
$cfg['Servers'][$i]['history'] = 'pma__history';
$cfg['Servers'][$i]['recent'] = 'pma__recent';
$cfg['Servers'][$i]['favorite'] = 'pma__favorite';
$cfg['Servers'][$i]['table_uiprefs'] = 'pma__table_uiprefs';
$cfg['Servers'][$i]['tracking'] = 'pma__tracking';
$cfg['Servers'][$i]['userconfig'] = 'pma__userconfig';
$cfg['Servers'][$i]['users'] = 'pma__users';
$cfg['Servers'][$i]['usergroups'] = 'pma__usergroups';
$cfg['Servers'][$i]['navigationhiding'] = 'pma__navigationhiding';
$cfg['Servers'][$i]['savedsearches'] = 'pma__savedsearches';
$cfg['Servers'][$i]['central_columns'] = 'pma__central_columns';
$cfg['Servers'][$i]['designer_settings'] = 'pma__designer_settings';
$cfg['Servers'][$i]['export_templates'] = 'pma__export_templates';
}
if (isset($_ENV['PMA_CONTROLHOST'])) {
$cfg['Servers'][$i]['controlhost'] = $_ENV['PMA_CONTROLHOST'];
}
if (isset($_ENV['PMA_CONTROLPORT'])) {
$cfg['Servers'][$i]['controlport'] = $_ENV['PMA_CONTROLPORT'];
}
if (isset($_ENV['PMA_CONTROLUSER'])) {
$cfg['Servers'][$i]['controluser'] = $_ENV['PMA_CONTROLUSER'];
}
if (isset($_ENV['PMA_CONTROLPASS'])) {
$cfg['Servers'][$i]['controlpass'] = $_ENV['PMA_CONTROLPASS'];
}
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['AllowNoPassword'] = true;
}
for ($i = 1; isset($sockets[$i - 1]); $i++) {
$cfg['Servers'][$i]['socket'] = $sockets[$i - 1];
$cfg['Servers'][$i]['host'] = 'localhost';
}
/*
* Revert back to last configured server to make
* it easier in config.user.inc.php
*/
$i--;
/* Uploads setup */
$cfg['UploadDir'] = '';
$cfg['SaveDir'] = '';
/* Include User Defined Settings Hook */
if (file_exists('/etc/phpmyadmin/config.user.inc.php')) {
include('/etc/phpmyadmin/config.user.inc.php');
}
+50
View File
@@ -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 "$@"
+20
View File
@@ -0,0 +1,20 @@
[PHP]
allow_url_fopen = Off
max_execution_time = 600
memory_limit = 512M
open_basedir = /var/www/html:/tmp/:/etc/phpmyadmin/
post_max_size = 512M
upload_max_filesize = 512M
[Session]
session.cookie_httponly = 1
session.hash_function = 1
session.save_path = "/sessions"
session.use_strict_mode = 1
[opcache]
opcache.fast_shutdown = 1
opcache.restrict_api = /disabled/
opcache.save_comments = 0
opcache.use_cwd = 0
opcache.validate_timestamps = 0
+59
View File
@@ -0,0 +1,59 @@
FROM php:7.2-fpm
# 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.9+snapshot
ENV URL https://files.phpmyadmin.net/snapshots/phpMyAdmin-${VERSION}-all-languages.tar.xz
LABEL version=$VERSION
# Download tarball and extract
RUN set -ex; \
curl --output phpMyAdmin.tar.xz --location $URL; \
tar -xf phpMyAdmin.tar.xz -C /usr/src; \
rm -r phpMyAdmin.tar.xz; \
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
# 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 ["php-fpm"]
+137
View File
@@ -0,0 +1,137 @@
<?php
require('/etc/phpmyadmin/config.secret.inc.php');
/* Ensure we got the environment */
$vars = array(
'PMA_ARBITRARY',
'PMA_HOST',
'PMA_HOSTS',
'PMA_VERBOSE',
'PMA_VERBOSES',
'PMA_PORT',
'PMA_PORTS',
'PMA_SOCKET',
'PMA_SOCKETS',
'PMA_USER',
'PMA_PASSWORD',
'PMA_ABSOLUTE_URI',
'PMA_CONTROLHOST',
'PMA_CONTROLPORT',
'PMA_PMADB',
'PMA_CONTROLUSER',
'PMA_CONTROLPASS',
'PMA_QUERYHISTORYDB'
);
foreach ($vars as $var) {
$env = getenv($var);
if (!isset($_ENV[$var]) && $env !== false) {
$_ENV[$var] = $env;
}
}
if (isset($_ENV['PMA_QUERYHISTORYDB'])) {
$cfg['QueryHistoryDB'] = boolval($_ENV['PMA_QUERYHISTORYDB']);
}
/* Arbitrary server connection */
if (isset($_ENV['PMA_ARBITRARY']) && $_ENV['PMA_ARBITRARY'] === '1') {
$cfg['AllowArbitraryServer'] = true;
}
/* Play nice behind reverse proxys */
if (isset($_ENV['PMA_ABSOLUTE_URI'])) {
$cfg['PmaAbsoluteUri'] = trim($_ENV['PMA_ABSOLUTE_URI']);
}
/* Figure out hosts */
/* Fallback to default linked */
$hosts = array('db');
/* Set by environment */
if (!empty($_ENV['PMA_HOST'])) {
$hosts = array($_ENV['PMA_HOST']);
$verbose = array($_ENV['PMA_VERBOSE']);
$ports = array($_ENV['PMA_PORT']);
} elseif (!empty($_ENV['PMA_HOSTS'])) {
$hosts = array_map('trim', explode(',', $_ENV['PMA_HOSTS']));
$verbose = array_map('trim', explode(',', $_ENV['PMA_VERBOSES']));
$ports = array_map('trim', explode(',', $_ENV['PMA_PORTS']));
}
if (!empty($_ENV['PMA_SOCKET'])) {
$sockets = array($_ENV['PMA_SOCKET']);
} elseif (!empty($_ENV['PMA_SOCKETS'])) {
$sockets = explode(',', $_ENV['PMA_SOCKETS']);
}
/* Server settings */
for ($i = 1; isset($hosts[$i - 1]); $i++) {
$cfg['Servers'][$i]['host'] = $hosts[$i - 1];
if (isset($verbose[$i - 1])) {
$cfg['Servers'][$i]['verbose'] = $verbose[$i - 1];
}
if (isset($ports[$i - 1])) {
$cfg['Servers'][$i]['port'] = $ports[$i - 1];
}
if (isset($_ENV['PMA_USER'])) {
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = $_ENV['PMA_USER'];
$cfg['Servers'][$i]['password'] = isset($_ENV['PMA_PASSWORD']) ? $_ENV['PMA_PASSWORD'] : '';
} else {
$cfg['Servers'][$i]['auth_type'] = 'cookie';
}
if (isset($_ENV['PMA_PMADB'])) {
$cfg['Servers'][$i]['pmadb'] = $_ENV['PMA_PMADB'];
$cfg['Servers'][$i]['relation'] = 'pma__relation';
$cfg['Servers'][$i]['table_info'] = 'pma__table_info';
$cfg['Servers'][$i]['table_coords'] = 'pma__table_coords';
$cfg['Servers'][$i]['pdf_pages'] = 'pma__pdf_pages';
$cfg['Servers'][$i]['column_info'] = 'pma__column_info';
$cfg['Servers'][$i]['bookmarktable'] = 'pma__bookmark';
$cfg['Servers'][$i]['history'] = 'pma__history';
$cfg['Servers'][$i]['recent'] = 'pma__recent';
$cfg['Servers'][$i]['favorite'] = 'pma__favorite';
$cfg['Servers'][$i]['table_uiprefs'] = 'pma__table_uiprefs';
$cfg['Servers'][$i]['tracking'] = 'pma__tracking';
$cfg['Servers'][$i]['userconfig'] = 'pma__userconfig';
$cfg['Servers'][$i]['users'] = 'pma__users';
$cfg['Servers'][$i]['usergroups'] = 'pma__usergroups';
$cfg['Servers'][$i]['navigationhiding'] = 'pma__navigationhiding';
$cfg['Servers'][$i]['savedsearches'] = 'pma__savedsearches';
$cfg['Servers'][$i]['central_columns'] = 'pma__central_columns';
$cfg['Servers'][$i]['designer_settings'] = 'pma__designer_settings';
$cfg['Servers'][$i]['export_templates'] = 'pma__export_templates';
}
if (isset($_ENV['PMA_CONTROLHOST'])) {
$cfg['Servers'][$i]['controlhost'] = $_ENV['PMA_CONTROLHOST'];
}
if (isset($_ENV['PMA_CONTROLPORT'])) {
$cfg['Servers'][$i]['controlport'] = $_ENV['PMA_CONTROLPORT'];
}
if (isset($_ENV['PMA_CONTROLUSER'])) {
$cfg['Servers'][$i]['controluser'] = $_ENV['PMA_CONTROLUSER'];
}
if (isset($_ENV['PMA_CONTROLPASS'])) {
$cfg['Servers'][$i]['controlpass'] = $_ENV['PMA_CONTROLPASS'];
}
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['AllowNoPassword'] = true;
}
for ($i = 1; isset($sockets[$i - 1]); $i++) {
$cfg['Servers'][$i]['socket'] = $sockets[$i - 1];
$cfg['Servers'][$i]['host'] = 'localhost';
}
/*
* Revert back to last configured server to make
* it easier in config.user.inc.php
*/
$i--;
/* Uploads setup */
$cfg['UploadDir'] = '';
$cfg['SaveDir'] = '';
/* Include User Defined Settings Hook */
if (file_exists('/etc/phpmyadmin/config.user.inc.php')) {
include('/etc/phpmyadmin/config.user.inc.php');
}
+50
View File
@@ -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 "$@"
+20
View File
@@ -0,0 +1,20 @@
[PHP]
allow_url_fopen = Off
max_execution_time = 600
memory_limit = 512M
open_basedir = /var/www/html:/tmp/:/etc/phpmyadmin/
post_max_size = 512M
upload_max_filesize = 512M
[Session]
session.cookie_httponly = 1
session.hash_function = 1
session.save_path = "/sessions"
session.use_strict_mode = 1
[opcache]
opcache.fast_shutdown = 1
opcache.restrict_api = /disabled/
opcache.save_comments = 0
opcache.use_cwd = 0
opcache.validate_timestamps = 0
+1 -1
View File
@@ -2,7 +2,7 @@
allow_url_fopen = Off
max_execution_time = 600
memory_limit = 512M
open_basedir = /www/:/tmp/:/etc/phpmyadmin/
open_basedir = /var/www/html:/tmp/:/etc/phpmyadmin/
post_max_size = 512M
upload_max_filesize = 512M
-20
View File
@@ -1,20 +0,0 @@
#!/bin/sh
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
mkdir -p /var/nginx/client_body_temp
chown nobody:nogroup /sessions /var/nginx/client_body_temp
mkdir -p /var/run/php/
chown nobody:nogroup /var/run/php/
touch /var/log/php-fpm.log
chown nobody:nogroup /var/log/php-fpm.log
exec "$@"
+9 -3
View File
@@ -3,8 +3,14 @@
FROM phpmyadmin/phpmyadmin
# Install test dependencies
RUN apk add --no-cache curl py2-pip
RUN pip install mechanize html5lib
RUN set -ex; \
\
apt-get update; \
apt-get install -y --no-install-recommends \
curl \
python-pip \
; \
pip install mechanize html5lib; \
rm -rf /var/lib/apt/lists/*
COPY test.ini /etc/supervisor.d/
COPY phpmyadmin_test.py test-docker.sh world.sql /
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python2
import argparse
import os
import re
+37 -42
View File
@@ -19,74 +19,69 @@ PHPMYADMIN_HOSTNAME=${TESTSUITE_HOSTNAME:=localhost}
PHPMYADMIN_PORT=${TESTSUITE_PORT:=80}
PHPMYADMIN_URL=http://$PHPMYADMIN_HOSTNAME:$PORT/
# Set database environment
PHPMYADMIN_DB_HOSTNAME=${PMA_HOST:=localhost}
PHPMYADMIN_DB_PORT=${PMA_PORT:=3306}
# Color text output
GREEN="\033[0;32m"
RED="\033[0;31m"
NC="\033[0m" # No Color
ret=0
# Check if script is running inside container
if [ -f /.dockerenv ] ; then
echo "Tests running inside container..."
# Find test script
if [ -f ./phpmyadmin_test.py ] ; then
FILENAME=./phpmyadmin_test.py
else
FILENAME=./testing/phpmyadmin_test.py
fi
# Set database environment
PHPMYADMIN_DB_HOSTNAME=${PMA_HOST:=localhost}
PHPMYADMIN_DB_PORT=${PMA_PORT:=3306}
PHPMYADMIN_DB_URL=http://$PHPMYADMIN_DB_HOSTNAME:$PHPMYADMIN_DB_PORT/
# Check if script is running inside container
if ! [ -f /.dockerenv ] ; then
echo "Tests running outside container..."
COMMAND_HOST="docker exec ${NAME}"
docker ps -a
# Wait for database to start
TIMEOUT=0
while ! curl "$PHPMYADMIN_DB_URL" &>/dev/null; do
while [ $(docker logs db_server 2>&1 | fgrep -c "mysqld: ready for connections.") -le 0 ] ; do
echo "Waiting for ${PHPMYADMIN_DB_HOSTNAME} database start..."
sleep 10
TIMEOUT=$((TIMEOUT + 1))
if [ $TIMEOUT -gt 3 ] ; then
echo "Failed to connect ${PHPMYADMIN_DB_HOSTNAME} database!"
echo "Result of ${PHPMYADMIN_DB_HOSTNAME} tests: ${RED}FAILED${NC}"
ret=1
docker logs ${NAME}
exit 1
fi
done
# Wait for container to start
TIMEOUT=0
while [ $(docker logs ${NAME} 2>&1 | fgrep -c "Command line: 'apache2 -D FOREGROUND'") -le 0 ] ; do
echo "Waiting for PHPMyAdmin start..."
sleep 1
TIMEOUT=$((TIMEOUT + 1))
if [ $TIMEOUT -gt 10 ] ; then
echo "Failed to connect PHPMyAdmin!"
echo "Result of ${PHPMYADMIN_DB_HOSTNAME} tests: ${RED}FAILED${NC}"
docker logs ${NAME}
exit 1
fi
done
else
echo "Tests running outside container..."
docker ps -a
COMMAND_HOST="docker exec ${NAME}"
echo "Tests running inside container..."
FILENAME=/phpmyadmin_test.py
fi
# Wait for container to start
TIMEOUT=0
while ! $COMMAND_HOST ps aux | grep -q nginx ; do
echo "Waiting for PHPMyAdmin start..."
sleep 1
TIMEOUT=$((TIMEOUT + 1))
if [ $TIMEOUT -gt 10 ] ; then
echo "Failed to connect PHPMyAdmin!"
echo "Result of ${PHPMYADMIN_DB_HOSTNAME} tests: ${RED}FAILED${NC}"
ret=1
exit 1
fi
done
# Perform tests
if [ $ret -eq 0 ] ; then
if [ -f /phpmyadmin_test.py ] ; then
FILENAME=/phpmyadmin_test.py
elif [ -f ./phpmyadmin_test.py ] ; then
FILENAME=./phpmyadmin_test.py
else
FILENAME=./testing/phpmyadmin_test.py
fi
python $FILENAME --url "$PHPMYADMIN_URL" --username root --password $TESTSUITE_PASSWORD $SERVER
ret=$?
fi
ret=0
$FILENAME --url "$PHPMYADMIN_URL" --username root --password $TESTSUITE_PASSWORD $SERVER
ret=$?
# Show debug output in case of failure
if [ $ret -ne 0 ] ; then
curl "$PHPMYADMIN_URL"
$COMMAND_HOST ps faux
$COMMAND_HOST cat /var/log/php-fpm.log
$COMMAND_HOST cat /var/log/nginx-error.log
$COMMAND_HOST cat /var/log/supervisord.log
${COMMAND_HOST} ps faux
echo "Result of ${PHPMYADMIN_DB_HOSTNAME} tests: ${RED}FAILED${NC}"
exit $ret
fi
-32
View File
@@ -1,32 +0,0 @@
#!/bin/sh
# Helper script to wait for testing inside container completes
# Needs running docker-compose container based on docker-compose.testing.yml
GREEN="\033[0;32m"
RED="\033[0;31m"
NC="\033[0m" # No Color
TIMEOUT=0
sleep 5
while [ `docker-compose -f docker-compose.testing.yml logs phpmyadmin | grep -c 'Result of db_server tests'` -lt 1 ] ; do
sleep 1
TIMEOUT=$(($TIMEOUT + 1))
if [ $TIMEOUT -gt 20 ] ; then
docker-compose -f docker-compose.testing.yml logs phpmyadmin
echo "${RED}Timeout!${NC}"
exit 1
fi
done
if [ `docker-compose -f docker-compose.testing.yml logs phpmyadmin | grep -c 'Result of db_server tests.*SUCCESS'` -lt 1 ] ; then
docker-compose -f docker-compose.testing.yml logs phpmyadmin
echo "${RED}Failed${NC}"
exit 2
fi
docker-compose -f docker-compose.testing.yml logs phpmyadmin
echo "${GREEN}Success${NC}"
exit 0
Executable
+26
View File
@@ -0,0 +1,26 @@
#!/bin/bash
set -e
declare -A cmd=(
[apache]='apache2-foreground'
[fpm]='php-fpm'
[fpm-alpine]='php-fpm'
)
declare -A base=(
[apache]='debian'
[fpm]='debian'
[fpm-alpine]='alpine'
)
for variant in apache fpm fpm-alpine; do
template="Dockerfile-${base[$variant]}.template"
cp $template "$variant/Dockerfile"
cp config.inc.php "$variant/config.inc.php"
cp docker-entrypoint.sh "$variant/docker-entrypoint.sh"
cp php.ini "$variant/php.ini"
sed -ri -e '
s/%%VARIANT%%/'"$variant"'/;
s/%%CMD%%/'"${cmd[$variant]}"'/;
' "$variant/Dockerfile"
done