Compare commits

...
49 Commits
Author SHA1 Message Date
Isaac Bennetch 31f2bdd82c Update to phpMyAdmin release 4.9.3
Signed-off-by: Isaac Bennetch <bennetch@gmail.com>
2020-01-01 22:14:24 -05:00
William Desportes 5d4b4dec94 Merge #259 - Improve documentation of which Docker tags we offer
Pull-request: #259
Signed-off-by: William Desportes <williamdes@wdes.fr>
2019-12-26 17:10:42 +01:00
William Desportes 4f88748138 Improve README.md and add a link to the main repo
[ci skip]

Signed-off-by: William Desportes <williamdes@wdes.fr>
2019-12-26 13:32:14 +01:00
William Desportes b295aa6bf7 Improve README and fix PMA_HOSTS and PMA_HOST
Signed-off-by: William Desportes <williamdes@wdes.fr>
2019-12-26 13:27:08 +01:00
William Desportes dd2ca51984 Update files after 2313c19aed (#247)
Signed-off-by: William Desportes <williamdes@wdes.fr>
2019-12-26 13:21:11 +01:00
William Desportes 568e58cc53 Merge #247 - Implement *_FILE read ENV from file
Pull-request: #247
Signed-off-by: William Desportes <williamdes@wdes.fr>
2019-12-26 13:21:08 +01:00
Mandy SchoepandWilliam Desportes 60e766aa9e Added support for PMA_HOST_FILE and PMA_HOSTS_FILE 2019-12-26 13:17:43 +01:00
Mandy SchoepandWilliam Desportes 05d5c516d3 Fix and improve test suite 2019-12-24 11:21:35 +01:00
Mandy SchoepandWilliam Desportes 2576eb2c26 Implement loading secrets from files 2019-12-24 11:21:06 +01:00
Mandy SchoepandWilliam Desportes bf6422b6a6 Fix .gitignore, README.md and .travis.yml 2019-12-24 11:20:10 +01:00
William Desportes 8edcc52dfb Implement #192 - override config using base64 encoded config in ENVs
Closes: #192
Pull-request: #262

Signed-off-by: William Desportes <williamdes@wdes.fr>
2019-12-24 11:13:18 +01:00
William Desportes ed101c2f39 Merge #261 - code improvements and implement UPLOAD_LIMIT
Ref: #238
Closes: #240
Closes: #239
Closes: #233
Closes: #189
Closes: #139
Closes: #241
Signed-off-by: William Desportes <williamdes@wdes.fr>
2019-12-24 11:11:23 +01:00
Isaac Bennetch fb5222a52c Improve documentation of which Docker tags we offer; standardize this list and adjust Docker Hub to match.
Closes #256, closes #231, closes #229, closes #214

Signed-off-by: Isaac Bennetch <bennetch@gmail.com>
2019-12-23 21:01:26 -05:00
William Desportes d147a455af Remove a non existent use case
Signed-off-by: William Desportes <williamdes@wdes.fr>
2019-12-24 00:35:25 +01:00
William Desportes 4e2998a2c5 Fix README.md and add a comment
Signed-off-by: William Desportes <williamdes@wdes.fr>
2019-12-24 00:35:25 +01:00
William Desportes 44ab81b7cf Implement upload limit as an ENV value
Signed-off-by: William Desportes <williamdes@wdes.fr>
2019-12-24 00:35:09 +01:00
William Desportes 4b236d823a Fix README.md
Signed-off-by: William Desportes <williamdes@wdes.fr>
2019-12-24 00:34:46 +01:00
William Desportes 1eede2e6b4 Use PHP_INI_DIR from base image
Ref: https://hub.docker.com/_/php
2019-12-24 00:34:46 +01:00
William Desportes 7cd2b5b46f Use url.php since it is available on all versions
Signed-off-by: William Desportes <williamdes@wdes.fr>
2019-12-24 00:34:46 +01:00
William Desportes 62b73c11a9 Add .gitattributes file
Signed-off-by: William Desportes <williamdes@wdes.fr>
2019-12-24 00:34:46 +01:00
William Desportes a309c96f6a Use user and group for sessions
Signed-off-by: William Desportes <williamdes@wdes.fr>
2019-12-24 00:34:46 +01:00
William Desportes 78f64ee5ce Add a new ENV
Signed-off-by: William Desportes <williamdes@wdes.fr>
2019-12-24 00:34:46 +01:00
Patrik KernstockandIsaac Bennetch 2313c19aed Hide PHP version (#209)
Add option to hide PHP version by adding `expose_php = Off` to `php.ini` for security reasons
Co-authored-by: William Desportes <williamdes@wdes.fr>
2019-12-23 18:26:48 -05:00
William Desportes 7d8a3e5717 Improve README.md
Signed-off-by: William Desportes <williamdes@wdes.fr>
2019-12-23 14:26:33 +01:00
J0WIandIsaac Bennetch b696c1f43d Update to PHP 7.4 (#257)
* Update to PHP 7.4
2019-12-20 02:50:31 -05:00
William Desportes 53a793568a Merge #242 - drop opcache from cli actions
Pull-request: #242
Signed-off-by: William Desportes <williamdes@wdes.fr>
2019-11-30 18:48:28 +01:00
J0WI 43888414d6 Drop opcache from cli actions 2019-11-29 19:49:53 +01:00
Isaac Bennetch 0343ca5338 Update to phpMyAdmin release 4.9.2
Signed-off-by: Isaac Bennetch <bennetch@gmail.com>
2019-11-23 07:11:36 -05:00
William Desportes 9d1872d753 Improve TravisCI file with steps
Signed-off-by: William Desportes <williamdes@wdes.fr>
2019-10-22 00:09:47 +02:00
William Desportes 5f2beb027a Revert "Increase limits for upload and post"
This reverts commit e9d1da4ebc.
2019-10-21 21:03:25 +02:00
William Desportes 0bd0e9a958 Merge #251 - improve/fix Travis CI file
Signed-off-by: William Desportes <williamdes@wdes.fr>
2019-10-21 21:00:58 +02:00
0X8CandGitHub 8dfcf48b25 Update .travis.yml 2019-10-17 14:14:21 +08:00
William Desportes e9d1da4ebc Increase limits for upload and post
Ref: #238
Closes: #240
Closes: #239
Closes: #233
Closes: #189
2019-09-30 19:19:06 +02:00
Isaac Bennetch f522725291 Update to phpMyAdmin release 4.9.1
Signed-off-by: Isaac Bennetch <bennetch@gmail.com>
2019-09-21 10:28:42 -04:00
Isaac Bennetch a68a25c673 Fix the template file from c5174eeef9
Signed-off-by: Isaac Bennetch <bennetch@gmail.com>
2019-09-21 10:27:28 -04:00
William Desportes 21dbdb8968 Merge #232 - Add documentation for using secrets
Pull-request: #232
Signed-off-by: William Desportes <williamdes@wdes.fr>
2019-09-06 19:47:06 +02:00
William Desportes ff0e3c994a Merge #221 - remove files and improve configuration
Pull-request: #221
Signed-off-by: William Desportes <williamdes@wdes.fr>
2019-09-06 19:38:29 +02:00
William Desportes 24d76d8e35 Merge #216 - Add generate-stackbrew-library.sh
Pull-request: #216
Ref: #56
Signed-off-by: William Desportes <williamdes@wdes.fr>
2019-09-06 09:20:54 +02:00
William Desportes d3281e86e1 Merge #234 - Fix makefile
Pull-request: #234
Signed-off-by: William Desportes <williamdes@wdes.fr>
2019-09-06 09:16:51 +02:00
ankitjain28may 6167470118 Added suggestions 2019-08-23 14:46:06 +05:30
ankitjain28may 304a628535 Fix makefile 2019-08-13 02:31:23 +05:30
David WhynotandGitHub 342c5fb3fc Add documentation for using secrets. 2019-08-08 15:37:09 -04:00
J0WI c5174eeef9 Cleanup php.ini 2019-07-11 02:19:28 +02:00
Isaac Bennetch 909eab579e Check for dependency and BASH version before running the script
Signed-off-by: Isaac Bennetch <bennetch@gmail.com>
2019-06-08 13:40:03 -04:00
Isaac Bennetch 168df32465 Merge branch 'update-version' of git://github.com/J0WI/docker-phpmyadmin
Signed-off-by: Isaac Bennetch <bennetch@gmail.com>
2019-06-08 13:29:50 -04:00
William DesportesandGitHub 7d35294fc5 Fixed missing accent
[ci skip]
Signed-off-by: William Desportes <williamdes@wdes.fr>
2019-04-01 15:10:11 +02:00
J0WI ca4e508924 Fix typo 2019-03-29 18:11:31 +01:00
J0WI effe2b1e80 Add generate-stackbrew-library.sh 2019-03-29 09:37:58 +01:00
J0WI e670276b37 Fetch latest version from api 2019-03-29 09:11:16 +01:00
25 changed files with 721 additions and 272 deletions
+1
View File
@@ -0,0 +1 @@
*.sql linguist-detectable=false
+5
View File
@@ -1 +1,6 @@
config.secret.inc.php
__pycache__
.pytest_cache
.vscode
.history
.venv
+78 -30
View File
@@ -2,41 +2,89 @@ services:
- docker
language: python
python:
- "2.7"
python: 2.7
dist: bionic
env:
matrix:
- DB=mysql:latest
- DB=mariadb:latest
stages:
- name: "Build images"
- name: "Test docker-compose"
- name: "Run tests in testing container"
before_install:
- export TESTSUITE_PASSWORD=`openssl rand -base64 30`
- 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
- pip install mechanize html5lib pytest
script:
# Build image
- 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
# Test for single database using env
- docker run --name envadmin -d --link db_server:db2 -e PMA_HOST=db2 -p 6060:80 phpmyadmin/phpmyadmin
- ./testing/test-docker.sh envadmin 6060
# Test for arbitrary database
- docker run --name arbitraryadmin -d --link db_server:db3 -e PMA_ARBITRARY=1 -p 7070:80 phpmyadmin/phpmyadmin
- ./testing/test-docker.sh arbitraryadmin 7070 db3
# Test for arbitrary database with user config
- docker run --name userconfigadmin -d --link db_server:db3 -v `readlink -f ./testing/config.test.inc.php`:/etc/phpmyadmin/config.user.inc.php -p 7080:80 phpmyadmin/phpmyadmin
- ./testing/test-docker.sh userconfigadmin 7080 db3
# Test docker-compose
- docker-compose -f docker-compose.yml -f docker-compose.db.yml up -d
- ./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 db_server
- docker-compose -f docker-compose.testing.yml up -d
- docker-compose exec phpmyadmin /test-docker.sh phpmyadmin_testing 80 phpmyadmin_testing_db
_helpers:
- &test-docker-compose
stage: "Test docker-compose"
script:
- 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
- docker-compose stop
- &test-apache-image
stage: "Run tests in testing container"
script:
# Build image
- 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
# Test for single database using env
- docker run --name envadmin -d --link db_server:db2 -e PMA_HOST=db2 -p 6060:80 phpmyadmin/phpmyadmin
- ./testing/test-docker.sh envadmin 6060
# Test for arbitrary database
- docker run --name arbitraryadmin -d --link db_server:db3 -e PMA_ARBITRARY=1 -p 7070:80 phpmyadmin/phpmyadmin
- ./testing/test-docker.sh arbitraryadmin 7070 db3
# Test for arbitrary database with user config
- docker run --name userconfigadmin -d --link db_server:db3 -v `readlink -f ./testing/config.test.inc.php`:/etc/phpmyadmin/config.user.inc.php -p 7080:80 phpmyadmin/phpmyadmin
- ./testing/test-docker.sh userconfigadmin 7080 db3
- &test-docker-compose-db
stage: "Test docker-compose"
script:
- docker-compose -f docker-compose.yml -f docker-compose.db.yml up -d
- ./testing/test-docker.sh phpmyadmin 8080 db_server
- docker-compose stop
- &build-image
stage: "Build images"
before_install: skip
install: skip
jobs:
include:
- <<: *test-docker-compose
name: "Run and stop container using testing docker-compose file for MariaDB"
env: DB=mariadb:latest
- <<: *test-docker-compose
name: "Run and stop container using testing docker-compose file for MySQL"
env: DB=mysql:latest
- <<: *test-docker-compose-db
name: "Run and stop container using db docker-compose file for MariaDB"
env: DB=mariadb:latest
- <<: *test-docker-compose-db
name: "Run and stop container using db docker-compose file for MySQL"
env: DB=mysql:latest
- <<: *build-image
name: "Apache amd64"
arch: amd64
script:
- docker build -t phpmyadmin/phpmyadmin apache
- <<: *build-image
name: "fpm amd64"
arch: amd64
script:
- docker build -t phpmyadmin/phpmyadmin fpm
- <<: *build-image
name: "fpm-alpine amd64"
arch: amd64
script:
- docker build -t phpmyadmin/phpmyadmin fpm-alpine
- <<: *test-apache-image
name: "Run testing for MariaDB"
env: DB=mariadb:latest
- <<: *test-apache-image
name: "Run testing for MySQL"
env: DB=mysql:latest
+33 -6
View File
@@ -1,8 +1,8 @@
FROM php:7.2-%%VARIANT%%
FROM php:7.4-%%VARIANT%%
# docker-entrypoint.sh dependencies
RUN apk add --no-cache \
bash
bash
# Install dependencies
RUN set -ex; \
@@ -14,10 +14,17 @@ RUN set -ex; \
libpng-dev \
libwebp-dev \
libxpm-dev \
libzip-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; \
docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp --with-xpm; \
docker-php-ext-install -j "$(nproc)" \
bz2 \
gd \
mysqli \
opcache \
zip \
; \
\
runDeps="$( \
scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/lib/php/extensions \
@@ -28,8 +35,29 @@ RUN set -ex; \
apk add --virtual .phpmyadmin-phpexts-rundeps $runDeps; \
apk del .build-deps
# set recommended PHP.ini settings
# see https://secure.php.net/manual/en/opcache.installation.php
RUN { \
echo 'opcache.memory_consumption=128'; \
echo 'opcache.interned_strings_buffer=8'; \
echo 'opcache.max_accelerated_files=4000'; \
echo 'opcache.revalidate_freq=2'; \
echo 'opcache.fast_shutdown=1'; \
} > $PHP_INI_DIR/conf.d/opcache-recommended.ini; \
\
{ \
echo 'session.cookie_httponly = 1'; \
echo 'session.use_strict_mode = 1'; \
} > $PHP_INI_DIR/conf.d/session-strict.ini; \
\
{ \
echo 'allow_url_fopen = Off'; \
echo 'max_execution_time = 600'; \
echo 'memory_limit = 512M'; \
} > $PHP_INI_DIR/conf.d/phpmyadmin-misc.ini
# Calculate download URL
ENV VERSION 4.9.0.1
ENV VERSION %%VERSION%%
ENV URL https://files.phpmyadmin.net/phpMyAdmin/${VERSION}/phpMyAdmin-${VERSION}-all-languages.tar.xz
LABEL version=$VERSION
@@ -62,7 +90,6 @@ RUN set -ex; \
# 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
+58 -31
View File
@@ -1,38 +1,66 @@
FROM php:7.2-%%VARIANT%%
FROM php:7.4-%%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/*
\
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 \
libzip-dev \
; \
\
docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp --with-xpm; \
docker-php-ext-install -j "$(nproc)" \
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/*
# set recommended PHP.ini settings
# see https://secure.php.net/manual/en/opcache.installation.php
RUN { \
echo 'opcache.memory_consumption=128'; \
echo 'opcache.interned_strings_buffer=8'; \
echo 'opcache.max_accelerated_files=4000'; \
echo 'opcache.revalidate_freq=2'; \
echo 'opcache.fast_shutdown=1'; \
} > $PHP_INI_DIR/conf.d/opcache-recommended.ini; \
\
{ \
echo 'session.cookie_httponly = 1'; \
echo 'session.use_strict_mode = 1'; \
} > $PHP_INI_DIR/conf.d/session-strict.ini; \
\
{ \
echo 'allow_url_fopen = Off'; \
echo 'max_execution_time = 600'; \
echo 'memory_limit = 512M'; \
} > $PHP_INI_DIR/conf.d/phpmyadmin-misc.ini
# Calculate download URL
ENV VERSION 4.9.0.1
ENV VERSION %%VERSION%%
ENV URL https://files.phpmyadmin.net/phpMyAdmin/${VERSION}/phpMyAdmin-${VERSION}-all-languages.tar.xz
LABEL version=$VERSION
@@ -70,7 +98,6 @@ RUN set -ex; \
# 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
+4 -1
View File
@@ -1,6 +1,6 @@
DOCKER_REPO = phpmyadmin/phpmyadmin
.PHONY: all build build_nc run logs clean stop rm prune
.PHONY: all build run logs clean stop rm prune
all: build run logs
@@ -18,6 +18,9 @@ build-fpm-alpine:
run:
docker-compose -f docker-compose.testing.yml up -d
run-tests:
docker-compose exec phpmyadmin /test-docker.sh phpmyadmin_testing 80 phpmyadmin_testing_db
logs:
docker-compose -f docker-compose.testing.yml logs
+43 -10
View File
@@ -1,6 +1,6 @@
# Official phpMyAdmin Docker image
Run phpMyAdmin with Alpine, supervisor, nginx and PHP FPM.
Run phpMyAdmin with Alpine, Apache and PHP FPM.
[![Build Status](https://travis-ci.org/phpmyadmin/docker.svg?branch=master)](https://travis-ci.org/phpmyadmin/docker)
[![Docker Pulls](https://img.shields.io/docker/pulls/phpmyadmin/phpmyadmin.svg)][hub]
@@ -22,14 +22,29 @@ The official MySQL and MariaDB use following environment variables to define the
* `MYSQL_ROOT_PASSWORD` - This variable is mandatory and specifies the password that will be set for the `root` superuser account.
* `MYSQL_USER`, `MYSQL_PASSWORD` - These variables are optional, used in conjunction to create a new user and to set that user's password.
## Docker hub tags
## Supported Docker hub tags
You can use following tags on Docker hub:
The following tags are available:
* `latest` - latest stable release
* `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.8` - bleeding edge docker image + latest snapshots from 4.8 branch (currently master)
* `latest`, `fpm`, and `fpm-alpine` are always the most recent released version
* Major versions, such as `5`, `5-fpm`, and `5-fpm-alpine`
* Specific minor versions, such as `5.0`, `5.0-fpm`, and `5-fpm-alpine`
* Specific patch versions, such as `5.0.0`, `5.0.0-fpm`, and `5.0.0-alpine`. Note that, on rare occasion,
there may be an intermediary "docker-only" release, such as 4.9.2-1
* `edge`, `edge-fpm`, `edge-fpm-alpine`, a development version build from the daily snapshot
A complete list of tags is [available at Docker Hub](https://hub.docker.com/r/phpmyadmin/phpmyadmin/tags)
## Image variants
We provide three variations:
* "apache" includes a full Apache webserver with PHP and includes everything needed to work out of the box.
This is the default when only a version number is requested.
* "fpm" only starts a PHP FPM container. Use this variant if you already have a seperate webserver.
This includes more tools and is therefore a larger image than the "fpm-alpine" variation.
* "fpm-alpine" has a very small footprint. It is based on Alpine Linux and only starts a PHP FPM process.
Use this variant if you already have a seperate webserver. If you need more tools that are not available on Alpine Linux, use the fpm image instead.
## Usage with linked server
@@ -80,15 +95,15 @@ docker-compose -f docker-compose.testing.yml up phpmyadmin
## Adding Custom Configuration
You can add your own custom config.inc.php settings (such as Configuration Storage setup)
by creating a file named "config.user.inc.php" with the various user defined settings
You can add your own custom config.inc.php settings (such as Configuration Storage setup)
by creating a file named "config.user.inc.php" with the various user defined settings
in it, and then linking it into the container using:
```
-v /some/local/directory/config.user.inc.php:/etc/phpmyadmin/config.user.inc.php
```
On the "docker run" line like this:
```
```
docker run --name myadmin -d --link mysql_db_server:db -p 8080:80 -v /some/local/directory/config.user.inc.php:/etc/phpmyadmin/config.user.inc.php phpmyadmin/phpmyadmin
```
@@ -111,9 +126,27 @@ Set the variable ``PMA_ABSOLUTE_URI`` to the fully-qualified path (``https://pma
* ``PMA_PORTS`` - define comma separated list of ports of the MySQL servers
* ``PMA_USER`` and ``PMA_PASSWORD`` - define username to use for config authentication method
* ``PMA_ABSOLUTE_URI`` - define user-facing URI
* ``HIDE_PHP_VERSION`` - if defined, will hide the php version (`expose_php = Off`). Set to any value (such as HIDE_PHP_VERSION=true).
* ``UPLOAD_LIMIT`` - if set, will override the default value for apache and php-fpm (default value is 2048 kb)
* ``PMA_CONFIG_BASE64`` - if set, will override the default config.inc.php with the base64 decoded contents of the variable
* ``PMA_USER_CONFIG_BASE64`` - if set, will override the default config.user.inc.php with the base64 decoded contents of the variable
For usage with Docker secrets, appending ``_FILE`` to the ``PMA_PASSWORD`` environment variable is allowed (it overrides ``PMA_PASSWORD`` if it is set):
```
docker run --name myadmin -d -e PMA_PASSWORD_FILE=/run/secrets/db_password.txt -p 8080:80 phpmyadmin/phpmyadmin
```
#### Variables that can be read from a file using ``_FILE``
- PMA_PASSWORD
- MYSQL_ROOT_PASSWORD
- MYSQL_PASSWORD
- PMA_HOSTS
- PMA_HOST
For more detailed documentation see https://docs.phpmyadmin.net/en/latest/setup.html#installing-using-docker
[hub]: https://hub.docker.com/r/phpmyadmin/phpmyadmin/
Please report any issues with the Docker container to https://github.com/phpmyadmin/docker/issues
Please report any issues with phpMyAdmin to https://github.com/phpmyadmin/phpmyadmin/issues
+58 -31
View File
@@ -1,38 +1,66 @@
FROM php:7.2-apache
FROM php:7.4-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/*
\
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 \
libzip-dev \
; \
\
docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp --with-xpm; \
docker-php-ext-install -j "$(nproc)" \
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/*
# set recommended PHP.ini settings
# see https://secure.php.net/manual/en/opcache.installation.php
RUN { \
echo 'opcache.memory_consumption=128'; \
echo 'opcache.interned_strings_buffer=8'; \
echo 'opcache.max_accelerated_files=4000'; \
echo 'opcache.revalidate_freq=2'; \
echo 'opcache.fast_shutdown=1'; \
} > $PHP_INI_DIR/conf.d/opcache-recommended.ini; \
\
{ \
echo 'session.cookie_httponly = 1'; \
echo 'session.use_strict_mode = 1'; \
} > $PHP_INI_DIR/conf.d/session-strict.ini; \
\
{ \
echo 'allow_url_fopen = Off'; \
echo 'max_execution_time = 600'; \
echo 'memory_limit = 512M'; \
} > $PHP_INI_DIR/conf.d/phpmyadmin-misc.ini
# Calculate download URL
ENV VERSION 4.9.0.1
ENV VERSION 4.9.3
ENV URL https://files.phpmyadmin.net/phpMyAdmin/${VERSION}/phpMyAdmin-${VERSION}-all-languages.tar.xz
LABEL version=$VERSION
@@ -70,7 +98,6 @@ RUN set -ex; \
# 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
+42 -2
View File
@@ -16,9 +16,10 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
group="$(id -g)"
fi
chown www-data:www-data /sessions /var/nginx/client_body_temp
# Custom folders for sessions
chown ${user}:${group} /sessions /var/nginx/client_body_temp
if ! [ -e index.php -a -e db_designer.php ]; then
if ! [ -e index.php -a -e url.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!"
@@ -47,4 +48,43 @@ EOT
fi
fi
if [ ! -z "${HIDE_PHP_VERSION}" ]; then
echo "PHP version is now hidden."
echo -e 'expose_php = Off\n' > $PHP_INI_DIR/conf.d/phpmyadmin-hide-php-version.ini
fi
UPLOAD_LIMIT_INI_FILE="$PHP_INI_DIR/conf.d/phpmyadmin-upload-limit.ini"
if [ ! -z "${UPLOAD_LIMIT}" ]; then
echo "Adding the custom upload limit."
echo -e "upload_max_filesize = $UPLOAD_LIMIT\npost_max_size = $UPLOAD_LIMIT\n" > $UPLOAD_LIMIT_INI_FILE
fi
if [ ! -z "${PMA_CONFIG_BASE64}" ]; then
echo "Adding the custom config.inc.php from base64."
echo "${PMA_CONFIG_BASE64}" | base64 -d > /etc/phpmyadmin/config.inc.php
fi
if [ ! -z "${PMA_USER_CONFIG_BASE64}" ]; then
echo "Adding the custom config.user.inc.php from base64."
echo "${PMA_USER_CONFIG_BASE64}" | base64 -d > /etc/phpmyadmin/config.user.inc.php
fi
function get_docker_secret() {
local env_var="${1}"
local env_var_file="${env_var}_FILE"
# Check if the variable with name $env_var_file (which is $PMA_PASSWORD_FILE for example)
# is not empty and export $PMA_PASSWORD as the password in the Docker secrets file
if [[ -n "${!env_var_file}" ]]; then
export "${env_var}"="$(cat "${!env_var_file}")"
fi
}
get_docker_secret PMA_PASSWORD
get_docker_secret MYSQL_ROOT_PASSWORD
get_docker_secret MYSQL_PASSWORD
get_docker_secret PMA_HOSTS
get_docker_secret PMA_HOST
exec "$@"
-20
View File
@@ -1,20 +0,0 @@
[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
+10 -6
View File
@@ -1,26 +1,30 @@
version: '2'
version: '3.1'
services:
db_server:
image: ${DB}
image: ${DB:-mariadb:10.3}
container_name: phpmyadmin_testing_db
environment:
- MYSQL_ROOT_PASSWORD=${TESTSUITE_PASSWORD}
- MYSQL_ROOT_PASSWORD=${TESTSUITE_PASSWORD:-my-secret-pw}
volumes:
- ./testing/testing.cnf:/etc/mysql/conf.d/testing.cnf:ro
tmpfs:
- /var/lib/mysql:rw,noexec,nosuid,size=300m
phpmyadmin:
build:
context: testing/
links:
- db_server:db_server
container_name: phpmyadmin_testing
volumes:
- /sessions
- ./testing/conftest.py:/conftest.py
- ./testing/test-docker.sh:/test-docker.sh
- ./testing/phpmyadmin_test.py:/phpmyadmin_test.py
- ./docker-entrypoint.sh:/docker-entrypoint.sh
ports:
- 8090:80
environment:
- PMA_ARBITRARY=1
- TESTSUITE_PASSWORD=${TESTSUITE_PASSWORD}
- TESTSUITE_PASSWORD=${TESTSUITE_PASSWORD:-my-secret-pw}
depends_on:
- db_server
+42 -2
View File
@@ -16,9 +16,10 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
group="$(id -g)"
fi
chown www-data:www-data /sessions /var/nginx/client_body_temp
# Custom folders for sessions
chown ${user}:${group} /sessions /var/nginx/client_body_temp
if ! [ -e index.php -a -e db_designer.php ]; then
if ! [ -e index.php -a -e url.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!"
@@ -47,4 +48,43 @@ EOT
fi
fi
if [ ! -z "${HIDE_PHP_VERSION}" ]; then
echo "PHP version is now hidden."
echo -e 'expose_php = Off\n' > $PHP_INI_DIR/conf.d/phpmyadmin-hide-php-version.ini
fi
UPLOAD_LIMIT_INI_FILE="$PHP_INI_DIR/conf.d/phpmyadmin-upload-limit.ini"
if [ ! -z "${UPLOAD_LIMIT}" ]; then
echo "Adding the custom upload limit."
echo -e "upload_max_filesize = $UPLOAD_LIMIT\npost_max_size = $UPLOAD_LIMIT\n" > $UPLOAD_LIMIT_INI_FILE
fi
if [ ! -z "${PMA_CONFIG_BASE64}" ]; then
echo "Adding the custom config.inc.php from base64."
echo "${PMA_CONFIG_BASE64}" | base64 -d > /etc/phpmyadmin/config.inc.php
fi
if [ ! -z "${PMA_USER_CONFIG_BASE64}" ]; then
echo "Adding the custom config.user.inc.php from base64."
echo "${PMA_USER_CONFIG_BASE64}" | base64 -d > /etc/phpmyadmin/config.user.inc.php
fi
function get_docker_secret() {
local env_var="${1}"
local env_var_file="${env_var}_FILE"
# Check if the variable with name $env_var_file (which is $PMA_PASSWORD_FILE for example)
# is not empty and export $PMA_PASSWORD as the password in the Docker secrets file
if [[ -n "${!env_var_file}" ]]; then
export "${env_var}"="$(cat "${!env_var_file}")"
fi
}
get_docker_secret PMA_PASSWORD
get_docker_secret MYSQL_ROOT_PASSWORD
get_docker_secret MYSQL_PASSWORD
get_docker_secret PMA_HOSTS
get_docker_secret PMA_HOST
exec "$@"
+33 -6
View File
@@ -1,8 +1,8 @@
FROM php:7.2-fpm-alpine
FROM php:7.4-fpm-alpine
# docker-entrypoint.sh dependencies
RUN apk add --no-cache \
bash
bash
# Install dependencies
RUN set -ex; \
@@ -14,10 +14,17 @@ RUN set -ex; \
libpng-dev \
libwebp-dev \
libxpm-dev \
libzip-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; \
docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp --with-xpm; \
docker-php-ext-install -j "$(nproc)" \
bz2 \
gd \
mysqli \
opcache \
zip \
; \
\
runDeps="$( \
scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/lib/php/extensions \
@@ -28,8 +35,29 @@ RUN set -ex; \
apk add --virtual .phpmyadmin-phpexts-rundeps $runDeps; \
apk del .build-deps
# set recommended PHP.ini settings
# see https://secure.php.net/manual/en/opcache.installation.php
RUN { \
echo 'opcache.memory_consumption=128'; \
echo 'opcache.interned_strings_buffer=8'; \
echo 'opcache.max_accelerated_files=4000'; \
echo 'opcache.revalidate_freq=2'; \
echo 'opcache.fast_shutdown=1'; \
} > $PHP_INI_DIR/conf.d/opcache-recommended.ini; \
\
{ \
echo 'session.cookie_httponly = 1'; \
echo 'session.use_strict_mode = 1'; \
} > $PHP_INI_DIR/conf.d/session-strict.ini; \
\
{ \
echo 'allow_url_fopen = Off'; \
echo 'max_execution_time = 600'; \
echo 'memory_limit = 512M'; \
} > $PHP_INI_DIR/conf.d/phpmyadmin-misc.ini
# Calculate download URL
ENV VERSION 4.9.0.1
ENV VERSION 4.9.3
ENV URL https://files.phpmyadmin.net/phpMyAdmin/${VERSION}/phpMyAdmin-${VERSION}-all-languages.tar.xz
LABEL version=$VERSION
@@ -62,7 +90,6 @@ RUN set -ex; \
# 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
+42 -2
View File
@@ -16,9 +16,10 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
group="$(id -g)"
fi
chown www-data:www-data /sessions /var/nginx/client_body_temp
# Custom folders for sessions
chown ${user}:${group} /sessions /var/nginx/client_body_temp
if ! [ -e index.php -a -e db_designer.php ]; then
if ! [ -e index.php -a -e url.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!"
@@ -47,4 +48,43 @@ EOT
fi
fi
if [ ! -z "${HIDE_PHP_VERSION}" ]; then
echo "PHP version is now hidden."
echo -e 'expose_php = Off\n' > $PHP_INI_DIR/conf.d/phpmyadmin-hide-php-version.ini
fi
UPLOAD_LIMIT_INI_FILE="$PHP_INI_DIR/conf.d/phpmyadmin-upload-limit.ini"
if [ ! -z "${UPLOAD_LIMIT}" ]; then
echo "Adding the custom upload limit."
echo -e "upload_max_filesize = $UPLOAD_LIMIT\npost_max_size = $UPLOAD_LIMIT\n" > $UPLOAD_LIMIT_INI_FILE
fi
if [ ! -z "${PMA_CONFIG_BASE64}" ]; then
echo "Adding the custom config.inc.php from base64."
echo "${PMA_CONFIG_BASE64}" | base64 -d > /etc/phpmyadmin/config.inc.php
fi
if [ ! -z "${PMA_USER_CONFIG_BASE64}" ]; then
echo "Adding the custom config.user.inc.php from base64."
echo "${PMA_USER_CONFIG_BASE64}" | base64 -d > /etc/phpmyadmin/config.user.inc.php
fi
function get_docker_secret() {
local env_var="${1}"
local env_var_file="${env_var}_FILE"
# Check if the variable with name $env_var_file (which is $PMA_PASSWORD_FILE for example)
# is not empty and export $PMA_PASSWORD as the password in the Docker secrets file
if [[ -n "${!env_var_file}" ]]; then
export "${env_var}"="$(cat "${!env_var_file}")"
fi
}
get_docker_secret PMA_PASSWORD
get_docker_secret MYSQL_ROOT_PASSWORD
get_docker_secret MYSQL_PASSWORD
get_docker_secret PMA_HOSTS
get_docker_secret PMA_HOST
exec "$@"
-20
View File
@@ -1,20 +0,0 @@
[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
+58 -31
View File
@@ -1,38 +1,66 @@
FROM php:7.2-fpm
FROM php:7.4-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/*
\
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 \
libzip-dev \
; \
\
docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp --with-xpm; \
docker-php-ext-install -j "$(nproc)" \
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/*
# set recommended PHP.ini settings
# see https://secure.php.net/manual/en/opcache.installation.php
RUN { \
echo 'opcache.memory_consumption=128'; \
echo 'opcache.interned_strings_buffer=8'; \
echo 'opcache.max_accelerated_files=4000'; \
echo 'opcache.revalidate_freq=2'; \
echo 'opcache.fast_shutdown=1'; \
} > $PHP_INI_DIR/conf.d/opcache-recommended.ini; \
\
{ \
echo 'session.cookie_httponly = 1'; \
echo 'session.use_strict_mode = 1'; \
} > $PHP_INI_DIR/conf.d/session-strict.ini; \
\
{ \
echo 'allow_url_fopen = Off'; \
echo 'max_execution_time = 600'; \
echo 'memory_limit = 512M'; \
} > $PHP_INI_DIR/conf.d/phpmyadmin-misc.ini
# Calculate download URL
ENV VERSION 4.9.0.1
ENV VERSION 4.9.3
ENV URL https://files.phpmyadmin.net/phpMyAdmin/${VERSION}/phpMyAdmin-${VERSION}-all-languages.tar.xz
LABEL version=$VERSION
@@ -70,7 +98,6 @@ RUN set -ex; \
# 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
+42 -2
View File
@@ -16,9 +16,10 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
group="$(id -g)"
fi
chown www-data:www-data /sessions /var/nginx/client_body_temp
# Custom folders for sessions
chown ${user}:${group} /sessions /var/nginx/client_body_temp
if ! [ -e index.php -a -e db_designer.php ]; then
if ! [ -e index.php -a -e url.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!"
@@ -47,4 +48,43 @@ EOT
fi
fi
if [ ! -z "${HIDE_PHP_VERSION}" ]; then
echo "PHP version is now hidden."
echo -e 'expose_php = Off\n' > $PHP_INI_DIR/conf.d/phpmyadmin-hide-php-version.ini
fi
UPLOAD_LIMIT_INI_FILE="$PHP_INI_DIR/conf.d/phpmyadmin-upload-limit.ini"
if [ ! -z "${UPLOAD_LIMIT}" ]; then
echo "Adding the custom upload limit."
echo -e "upload_max_filesize = $UPLOAD_LIMIT\npost_max_size = $UPLOAD_LIMIT\n" > $UPLOAD_LIMIT_INI_FILE
fi
if [ ! -z "${PMA_CONFIG_BASE64}" ]; then
echo "Adding the custom config.inc.php from base64."
echo "${PMA_CONFIG_BASE64}" | base64 -d > /etc/phpmyadmin/config.inc.php
fi
if [ ! -z "${PMA_USER_CONFIG_BASE64}" ]; then
echo "Adding the custom config.user.inc.php from base64."
echo "${PMA_USER_CONFIG_BASE64}" | base64 -d > /etc/phpmyadmin/config.user.inc.php
fi
function get_docker_secret() {
local env_var="${1}"
local env_var_file="${env_var}_FILE"
# Check if the variable with name $env_var_file (which is $PMA_PASSWORD_FILE for example)
# is not empty and export $PMA_PASSWORD as the password in the Docker secrets file
if [[ -n "${!env_var_file}" ]]; then
export "${env_var}"="$(cat "${!env_var_file}")"
fi
}
get_docker_secret PMA_PASSWORD
get_docker_secret MYSQL_ROOT_PASSWORD
get_docker_secret MYSQL_PASSWORD
get_docker_secret PMA_HOSTS
get_docker_secret PMA_HOST
exec "$@"
-20
View File
@@ -1,20 +0,0 @@
[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
+97
View File
@@ -0,0 +1,97 @@
#!/bin/bash
set -e
self="$(basename "$BASH_SOURCE")"
cd "$(dirname "$(readlink -f "$BASH_SOURCE")")"
# Get the most recent commit which modified any of "$@".
fileCommit() {
git log -1 --format='format:%H' HEAD -- "$@"
}
# Get the most recent commit which modified "$1/Dockerfile" or any file that
# the Dockerfile copies into the rootfs (with COPY).
dockerfileCommit() {
local dir="$1"; shift
(
cd "$dir";
fileCommit Dockerfile \
$(git show HEAD:./Dockerfile | awk '
toupper($1) == "COPY" {
for (i = 2; i < NF; i++)
print $i;
}
')
)
}
# depends on docker library
#getArches() {
# local repo="$1"; shift
# local officialImagesUrl='https://github.com/docker-library/official-images/raw/master/library/'
#
# eval "declare -g -A parentRepoToArches=( $(
# find -name 'Dockerfile' -exec awk '
# toupper($1) == "FROM" && $2 !~ /^('"$repo"'|scratch|microsoft\/[^:]+)(:|$)/ {
# print "'"$officialImagesUrl"'" $2
# }
# ' '{}' + \
# | sort -u \
# | xargs bashbrew cat --format '[{{ .RepoName }}:{{ .TagName }}]="{{ join " " .TagEntry.Architectures }}"'
# ) )"
#}
#getArches 'phpmyadmin'
# Header.
cat <<-EOH
# This file is generated via https://github.com/phpmyadmin/docker/blob/$(fileCommit "$self")/$self
Maintainers: Isaac Bennetch <bennetch@gmail.com>
Michal Čihař <michal@cihar.com>
GitRepo: https://github.com/phpmyadmin/docker.git
EOH
# prints "$2$1$3$1...$N"
join() {
local sep="$1"; shift
local out; printf -v out "${sep//%/%%}%s" "$@"
echo "${out#$sep}"
}
latest="$(
git ls-remote --tags https://github.com/phpmyadmin/phpmyadmin.git \
| cut -d/ -f3 \
| grep -vE -- '-rc|-b' \
| sort -V \
| tail -1
)"
for variant in apache fpm fpm-alpine; do
commit="$(dockerfileCommit "$variant")"
fullversion="$(git show "$commit":"$variant/Dockerfile" | awk '$1 == "ENV" && $2 == "VERSION" { print $3; exit }')"
versionAliases=( "$fullversion" "${fullversion%.*}" "${fullversion%.*.*}" )
if [ "$fullversion" = "$latest" ]; then
versionAliases+=( "latest" )
fi
variantAliases=( "${versionAliases[@]/%/-$variant}" )
variantAliases=( "${variantAliases[@]//latest-}" )
if [ "$variant" = "apache" ]; then
variantAliases+=( "${versionAliases[@]}" )
fi
variantParent="$(awk 'toupper($1) == "FROM" { print $2 }' "$variant/Dockerfile")"
# depends on docker library
#variantArches="${parentRepoToArches[$variantParent]}"
variantArches="amd64 arm32v7 arm64v8 i386 ppc64le"
cat <<-EOE
Tags: $(join ', ' "${variantAliases[@]}")
Architectures: $(join ', ' $variantArches)
GitCommit: $commit
Directory: $variant
EOE
done
-20
View File
@@ -1,20 +0,0 @@
[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
+3 -2
View File
@@ -10,7 +10,8 @@ RUN set -ex; \
curl \
python-pip \
; \
pip install mechanize html5lib; \
pip install setuptools wheel; \
pip install mechanize html5lib pytest; \
rm -rf /var/lib/apt/lists/*
COPY phpmyadmin_test.py test-docker.sh world.sql /
COPY phpmyadmin_test.py test-docker.sh world.sql conftest.py /
+28
View File
@@ -0,0 +1,28 @@
import pytest
def pytest_addoption(parser):
parser.addoption("--url")
parser.addoption("--username")
parser.addoption("--password")
parser.addoption("--server")
parser.addoption("--sqlfile")
@pytest.fixture
def url(request):
return request.config.getoption("--url")
@pytest.fixture
def username(request):
return request.config.getoption("--username")
@pytest.fixture
def password(request):
return request.config.getoption("--password")
@pytest.fixture
def server(request):
return request.config.getoption("--server")
@pytest.fixture
def sqlfile(request):
return request.config.getoption("--sqlfile")
+31 -27
View File
@@ -1,26 +1,27 @@
#!/usr/bin/env python2
import argparse
import os
import subprocess
import re
import sys
import mechanize
import tempfile
import pytest
def test_content(match, content):
if not match in content:
print(content)
raise Exception('{0} not found in content!'.format(match))
def do_test_content(match, content):
assert(match in content)
def test_phpmyadmin(url, username, password, server=None, sqlfile=None):
def test_phpmyadmin(url, username, password, server, sqlfile):
if sqlfile is None:
if os.path.exists('/world.sql'):
sqlfile = '/world.sql'
elif os.path.exists('./world.sql'):
sqlfile = './world.sql'
else:
sqlfile = './testing/world.sql'
path = os.path.dirname(os.path.realpath(__file__))
sqlfile = path + '/world.sql'
br = mechanize.Browser()
# Ignore robots.txt
@@ -38,36 +39,39 @@ def test_phpmyadmin(url, username, password, server=None, sqlfile=None):
# Login and check if loggged in
response = br.submit()
test_content('Server version', response.read())
do_test_content('Server version', response.read())
# Open server import
response = br.follow_link(text_regex=re.compile('Import'))
test_content('OpenDocument Spreadsheet', response.read())
do_test_content('OpenDocument Spreadsheet', response.read())
# Upload SQL file
br.select_form('import')
br.form.add_file(open(sqlfile), 'text/plain', sqlfile)
response = br.submit()
test_content('5326 queries executed', response.read())
do_test_content('5326 queries executed', response.read())
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--url', required=True)
parser.add_argument('--username', required=True)
parser.add_argument('--password', required=True)
parser.add_argument('--server')
parser.add_argument('--sqlfile', default=None)
args = parser.parse_args()
def docker_secret(env_name):
dir_path = os.path.dirname(os.path.realpath(__file__))
secret_file = tempfile.mkstemp()
test_phpmyadmin(
args.url,
args.username,
args.password,
args.server,
args.sqlfile
)
password = "The_super_secret_password"
password_file = open(secret_file[1], 'wb')
password_file.write(str.encode(password))
password_file.close()
test_env = {env_name + '_FILE': secret_file[1]}
if __name__ == '__main__':
main()
# Run entrypoint and afterwards echo the environment variables
result = subprocess.Popen(dir_path+ "/../docker-entrypoint.sh 'env'", shell=True, stdout=subprocess.PIPE, env=test_env)
output = result.stdout.read().decode()
assert (env_name + "=" + password) in output
def test_phpmyadmin_secrets():
docker_secret('MYSQL_PASSWORD')
docker_secret('MYSQL_ROOT_PASSWORD')
docker_secret('PMA_PASSWORD')
docker_secret('PMA_HOSTS')
docker_secret('PMA_HOST')
+2 -2
View File
@@ -28,6 +28,7 @@ GREEN="\033[0;32m"
RED="\033[0;31m"
NC="\033[0m" # No Color
# Find test script
if [ -f ./phpmyadmin_test.py ] ; then
FILENAME=./phpmyadmin_test.py
@@ -75,12 +76,11 @@ fi
# Perform tests
ret=0
$FILENAME --url "$PHPMYADMIN_URL" --username root --password $TESTSUITE_PASSWORD $SERVER
pytest -q --url "$PHPMYADMIN_URL" --username root --password "$TESTSUITE_PASSWORD" $SERVER $FILENAME
ret=$?
# Show debug output in case of failure
if [ $ret -ne 0 ] ; then
curl "$PHPMYADMIN_URL"
${COMMAND_HOST} ps faux
echo "Result of ${PHPMYADMIN_DB_HOSTNAME} tests: ${RED}FAILED${NC}"
exit $ret
+11 -1
View File
@@ -1,6 +1,14 @@
#!/bin/bash
set -e
# Check for dependencies
command -v curl >/dev/null 2>&1 || { echo >&2 "'curl' is required but not found. Aborting."; exit 1; }
command -v jq >/dev/null 2>&1 || { echo >&2 "'jq' is required but not found. Aborting."; exit 1; }
if [ -z "${BASH_VERSINFO}" ] || [ -z "${BASH_VERSINFO[0]}" ] || [ ${BASH_VERSINFO[0]} -lt 4 ]; then
echo "BASH version 4.0 or greater is required. Aborting."
exit 1
fi
declare -A cmd=(
[apache]='apache2-foreground'
[fpm]='php-fpm'
@@ -13,13 +21,15 @@ declare -A base=(
[fpm-alpine]='alpine'
)
latest="$(curl -fsSL 'https://www.phpmyadmin.net/home_page/version.json' | jq -r '.version')"
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/%%VERSION%%/'"$latest"'/;
s/%%VARIANT%%/'"$variant"'/;
s/%%CMD%%/'"${cmd[$variant]}"'/;
' "$variant/Dockerfile"