mirror of
https://github.com/phpmyadmin/docker.git
synced 2026-08-24 10:13:22 -05:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d3d7a78dae | ||
|
|
d2f01baf40 | ||
|
|
56806ecbc7 | ||
|
|
662b82d27e | ||
|
|
fa5fb6c985 | ||
|
|
b1e2062fb4 | ||
|
|
f01eddea45 | ||
|
|
7899e91e35 | ||
|
|
7af014ffdf | ||
|
|
0512d0c6b3 | ||
|
|
17003ccf85 | ||
|
|
d5a587d00d | ||
|
|
b2409f5930 | ||
|
|
7a1cbfd6a3 | ||
|
|
25dde22ee9 | ||
|
|
f0ebd7aec5 | ||
|
|
98aa7b80c8 | ||
|
|
2d6fd72542 | ||
|
|
c706c520ef | ||
|
|
8269a39bfa | ||
|
|
c625c70fde | ||
|
|
2608fbd118 | ||
|
|
df45b3f76c | ||
|
|
edf7b2a375 | ||
|
|
b369d770dd | ||
|
|
e831e55d59 | ||
|
|
7a5f742d7d | ||
|
|
316a237509 | ||
|
|
44a266c45d | ||
|
|
2fe5947116 | ||
|
|
92a5a76a26 | ||
|
|
5dd9a0f015 | ||
|
|
f18aca104e | ||
|
|
d42e7c8a7d | ||
|
|
ca768f47fc | ||
|
|
c6aee5664c | ||
|
|
93e2be73ec | ||
|
|
85198de04f | ||
|
|
c5d83d0fba | ||
|
|
d5f2f27d37 |
+2
-2
@@ -12,11 +12,11 @@ python:
|
||||
env:
|
||||
matrix:
|
||||
- DB=mysql:latest
|
||||
- DB=mariadb:latest
|
||||
- DB=mariadb:10.2
|
||||
|
||||
before_install:
|
||||
- export TESTSUITE_PASSWORD=`openssl rand -base64 30`
|
||||
- docker run --name db_server -e MYSQL_ROOT_PASSWORD=$TESTSUITE_PASSWORD -d $DB
|
||||
- docker run --name db_server -e MYSQL_ROOT_PASSWORD=$TESTSUITE_PASSWORD -v $PWD/testing/testing.cnf:/etc/mysql/conf.d/testing.cnf:ro -d $DB
|
||||
|
||||
install:
|
||||
- pip install mechanize html5lib
|
||||
|
||||
+42
-35
@@ -1,7 +1,13 @@
|
||||
FROM php:7.2-fpm-alpine
|
||||
|
||||
RUN apk add --no-cache \
|
||||
nginx \
|
||||
supervisor
|
||||
|
||||
# Install dependencies
|
||||
RUN apk add --no-cache --virtual .build-deps \
|
||||
RUN set -ex; \
|
||||
\
|
||||
apk add --no-cache --virtual .build-deps \
|
||||
bzip2-dev \
|
||||
freetype-dev \
|
||||
libjpeg-turbo-dev \
|
||||
@@ -20,48 +26,49 @@ RUN apk add --no-cache --virtual .build-deps \
|
||||
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
|
||||
)"; \
|
||||
apk add --virtual .phpmyadmin-phpexts-rundeps $runDeps; \
|
||||
apk del .build-deps; \
|
||||
apk add --no-cache nginx supervisor
|
||||
|
||||
# Include keyring to verify download
|
||||
COPY phpmyadmin.keyring /
|
||||
|
||||
# Copy configuration
|
||||
COPY etc /etc/
|
||||
|
||||
# Copy main script
|
||||
COPY run.sh /run.sh
|
||||
RUN chmod u+rwx /run.sh
|
||||
apk del .build-deps
|
||||
|
||||
# Calculate download URL
|
||||
ENV VERSION 4.7.9
|
||||
ENV URL https://files.phpmyadmin.net/phpMyAdmin/${VERSION}/phpMyAdmin-${VERSION}-all-languages.tar.gz
|
||||
ENV VERSION 4.8.4
|
||||
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 -x \
|
||||
&& GNUPGHOME="$(mktemp -d)" \
|
||||
&& export GNUPGHOME \
|
||||
&& apk add --no-cache curl gnupg \
|
||||
&& curl --output phpMyAdmin.tar.gz --location $URL \
|
||||
&& curl --output phpMyAdmin.tar.gz.asc --location $URL.asc \
|
||||
&& gpgv --keyring /phpmyadmin.keyring phpMyAdmin.tar.gz.asc phpMyAdmin.tar.gz \
|
||||
&& apk del --no-cache curl gnupg \
|
||||
&& rm -rf "$GNUPGHOME" \
|
||||
&& tar xzf phpMyAdmin.tar.gz \
|
||||
&& rm -f phpMyAdmin.tar.gz phpMyAdmin.tar.gz.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 root:nobody /www \
|
||||
&& find /www -type d -exec chmod 750 {} \; \
|
||||
&& find /www -type f -exec chmod 640 {} \;
|
||||
|
||||
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
|
||||
RUN mkdir /sessions
|
||||
mkdir /sessions; \
|
||||
mkdir -p /var/nginx/client_body_temp; \
|
||||
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 ["phpmyadmin"]
|
||||
CMD ["supervisord", "-n", "-j", "/supervisord.pid"]
|
||||
|
||||
@@ -1,17 +1,13 @@
|
||||
version: '2'
|
||||
|
||||
services:
|
||||
mariadb:
|
||||
image: mariadb:latest
|
||||
db_server:
|
||||
image: ${DB}
|
||||
container_name: phpmyadmin_testing_mariadb
|
||||
environment:
|
||||
- MYSQL_ROOT_PASSWORD=test123
|
||||
|
||||
mysql:
|
||||
image: mysql:latest
|
||||
container_name: phpmyadmin_testing_mysql
|
||||
environment:
|
||||
- MYSQL_ROOT_PASSWORD=test123
|
||||
volumes:
|
||||
- ./testing/testing.cnf:/etc/mysql/conf.d/testing.cnf:ro
|
||||
|
||||
phpmyadmin:
|
||||
build:
|
||||
@@ -25,5 +21,4 @@ services:
|
||||
- PMA_ARBITRARY=1
|
||||
- TESTSUITE_PASSWORD=test123
|
||||
depends_on:
|
||||
- mariadb
|
||||
- mysql
|
||||
- db_server
|
||||
|
||||
+2
-3
@@ -1,4 +1,3 @@
|
||||
user nobody;
|
||||
worker_processes 4;
|
||||
|
||||
daemon off;
|
||||
@@ -53,7 +52,7 @@ http {
|
||||
listen 80 default_server;
|
||||
server_name _;
|
||||
|
||||
root /www;
|
||||
root /var/www/html;
|
||||
|
||||
index index.php index.html index.htm;
|
||||
|
||||
@@ -73,7 +72,7 @@ http {
|
||||
|
||||
location ~ \.php$ {
|
||||
fastcgi_intercept_errors on;
|
||||
fastcgi_pass unix:/var/run/php/php-fpm.sock;
|
||||
fastcgi_pass 127.0.0.1:9000;
|
||||
|
||||
# regex to split $uri to $fastcgi_script_name and $fastcgi_path
|
||||
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
[global]
|
||||
error_log = /var/log/php-fpm.log
|
||||
log_level = warning
|
||||
|
||||
[www]
|
||||
user = nobody
|
||||
group = nobody
|
||||
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
|
||||
-1918
File diff suppressed because it is too large
Load Diff
@@ -11,9 +11,17 @@ $vars = array(
|
||||
'PMA_VERBOSES',
|
||||
'PMA_PORT',
|
||||
'PMA_PORTS',
|
||||
'PMA_SOCKET',
|
||||
'PMA_SOCKETS',
|
||||
'PMA_USER',
|
||||
'PMA_PASSWORD',
|
||||
'PMA_ABSOLUTE_URI'
|
||||
'PMA_ABSOLUTE_URI',
|
||||
'PMA_CONTROLHOST',
|
||||
'PMA_CONTROLPORT',
|
||||
'PMA_PMADB',
|
||||
'PMA_CONTROLUSER',
|
||||
'PMA_CONTROLPASS',
|
||||
'PMA_QUERYHISTORYDB'
|
||||
);
|
||||
foreach ($vars as $var) {
|
||||
$env = getenv($var);
|
||||
@@ -21,6 +29,9 @@ foreach ($vars as $var) {
|
||||
$_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') {
|
||||
@@ -43,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 */
|
||||
@@ -64,9 +80,47 @@ for ($i = 1; isset($hosts[$i - 1]); $i++) {
|
||||
} 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
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
[program:php-fpm]
|
||||
command=php-fpm --nodaemonize --fpm-config /etc/php-fpm.conf -c /etc/php.ini
|
||||
user=nobody
|
||||
command=php-fpm --nodaemonize --fpm-config /usr/local/etc/php-fpm.conf
|
||||
autostart=true
|
||||
autorestart=true
|
||||
priority=1
|
||||
|
||||
@@ -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
|
||||
Binary file not shown.
@@ -1,22 +1,50 @@
|
||||
#!/bin/sh
|
||||
if [ ! -f /etc/phpmyadmin/config.secret.inc.php ] ; then
|
||||
cat > /etc/phpmyadmin/config.secret.inc.php <<EOT
|
||||
if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ] || [ "$1" == supervisord ] ; 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
|
||||
|
||||
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:nobody /sessions /var/nginx/client_body_temp
|
||||
mkdir -p /var/run/php/
|
||||
chown nobody:nobody /var/run/php/
|
||||
touch /var/log/php-fpm.log
|
||||
chown nobody:nobody /var/log/php-fpm.log
|
||||
|
||||
if [ "$1" = 'phpmyadmin' ]; then
|
||||
exec supervisord --nodaemon --configuration="/etc/supervisord.conf" --loglevel=info
|
||||
fi
|
||||
exec "$@"
|
||||
|
||||
+1
-1
@@ -6,5 +6,5 @@ FROM phpmyadmin/phpmyadmin
|
||||
RUN apk add --no-cache curl py2-pip
|
||||
RUN pip install mechanize html5lib
|
||||
|
||||
COPY test-mariadb.ini test-mysql.ini /etc/supervisor.d/
|
||||
COPY test.ini /etc/supervisor.d/
|
||||
COPY phpmyadmin_test.py test-docker.sh world.sql /
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
[program:test-mysql]
|
||||
command=/test-docker.sh test 80 mysql
|
||||
command=/test-docker.sh test 80 db_server
|
||||
autostart=true
|
||||
autorestart=false
|
||||
priority=3
|
||||
@@ -0,0 +1,2 @@
|
||||
[mysqld]
|
||||
default_authentication_plugin = mysql_native_password
|
||||
@@ -11,7 +11,7 @@ TIMEOUT=0
|
||||
|
||||
sleep 5
|
||||
|
||||
while [ `docker-compose -f docker-compose.testing.yml logs phpmyadmin | grep -c 'Result of \(mysql\|mariadb\) tests'` -lt 2 ] ; do
|
||||
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
|
||||
@@ -21,7 +21,7 @@ while [ `docker-compose -f docker-compose.testing.yml logs phpmyadmin | grep -c
|
||||
fi
|
||||
done
|
||||
|
||||
if [ `docker-compose -f docker-compose.testing.yml logs phpmyadmin | grep -c 'Result of \(mysql\|mariadb\) tests.*SUCCESS'` -lt 2 ] ; then
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user