Compare commits

..
60 Commits
Author SHA1 Message Date
Isaac Bennetch 1241428f99 Update to 5.2.1 release
Signed-off-by: Isaac Bennetch <bennetch@gmail.com>
2023-02-07 22:01:01 -05:00
William Desportes d1f327e462 Fix #393 - Upgrade the image to PHP 8.1 2023-01-01 12:11:54 +04:00
William Desportes c59f287b98 Move documentation for ENVs of #384 and fixup the wording 2022-11-25 17:47:44 +01:00
William Desportes a5fd64c9fb Add CHANGELOG entries for #381 and #384 2022-11-25 17:44:59 +01:00
William Desportes e6f53b6f8e Add tests for phpmyadmin/docker#384 to the CI 2022-11-25 17:30:38 +01:00
William Desportes 71d54acc93 Merge #384 - Add ENV PMA_UPLOADDIR and PMA_SAVEDIR ENVs
Pull-request: #384
2022-11-25 16:29:15 +01:00
William Desportes c3e03b7429 Add tests for phpmyadmin/docker#384 2022-11-25 16:23:47 +01:00
William Desportes 83bd66d27f Update config.inc.php files 2022-11-25 15:14:29 +01:00
William Desportes 1effd43182 Merge #381 - Fix issue port 80- range when using APACHE_PORT
Pull-request: #381
2022-11-25 15:14:06 +01:00
William Desportes 908e79d246 Merge #389 - Use GitHub Actions to use the new bashbrew action
Pull-request: #389
2022-11-17 22:16:51 +01:00
Tianon Gravi 010de91f3c Update GitHub Actions to use new bashbrew action
This should fix errors that the old code would've run into thanks to the update to Go 1.18, and should help prevent them in the future by pinning to a specific release of both Bashbrew and the related scripts.
2022-11-17 11:46:54 -08:00
7e5dd3b39d Update description of PMA_UPLOADDIR and PM_SAVEDIR
Co-authored-by: William Desportes <williamdes@wdes.fr>
2022-09-21 14:39:50 +01:00
Chris ProudandGitHub 9b09f1ae4c Add ENV PMA_UPLOADDIR and PMA_SAVEDIR to README.md 2022-09-21 14:07:05 +01:00
Chris ProudandGitHub 80ce7025ac Remove Trim() from around dir env settings 2022-09-21 13:10:09 +01:00
Chris ProudandGitHub 0c1b04d2fc [+] ENV PMA_UPLOADDIR and PMA_SAVEDIR 2022-09-20 17:15:13 +01:00
ByteBittenandGitHub 031d27ad30 Fix issue port 80- range when using APACHE_PORT
Setting port to 8000-8099 caused issues after a restart.
Ex: Port got set from 8090 to 809090 resulting in error AH00526.
Using full line replace as ports.conf next character is new line.
2022-08-17 14:56:16 +02:00
William Desportes 905cae841e Update the examples to have something more explicit for Docker command line examples
Ref: https://github.com/phpmyadmin/phpmyadmin/commit/7faf6a53ecd3ce5b47d484b717c9b153d970f678
2022-08-10 00:39:02 +02:00
William Desportes 0ed2e6651b Apply some coding standard rules on config.inc.php 2022-08-01 11:01:02 +02:00
William Desportes df4d08c1a8 Add a missing CHANGELOG entry 2022-08-01 10:54:12 +02:00
William Desportes 0c9a5f06d5 Fix a typo in the README 2022-08-01 10:53:59 +02:00
William Desportes 918d2639a9 Give more time for databases to start on d-compose tests 2022-06-20 01:18:56 +02:00
William Desportes 3f1f550631 Update CHANGELOG.md 2022-06-20 01:13:00 +02:00
William Desportes 9b6fb4229f Stop using container names 2022-06-20 01:07:20 +02:00
William Desportes 8b33eefd53 Add project name for test runs 2022-06-20 01:07:15 +02:00
William Desportes 095161cdb1 Implement test cleanup 2022-06-20 01:07:11 +02:00
William Desportes b936b8ebd1 Ref #369 - Update files using ./update.sh 2022-06-20 01:07:06 +02:00
William Desportes 5ab888d0d4 Ref #369 - Remove apache specific settings from non apache entrypoints 2022-06-20 01:06:59 +02:00
William Desportes fee52fdd0b Merge #369 - Allow a different Apache port with APACHE_PORT
Pull-request: #369
Fixes: #340
Ref: #187
2022-06-20 01:06:42 +02:00
William Desportes 3c16423f78 Ref #369 - Add tests for a different Apache2 port 2022-06-20 00:35:02 +02:00
William Desportes 0b7054a449 Fix #372 - Support docker secrets from file for {PMA_USER,PMA_CONTROLUSER,PMA_CONTROLHOST}
- Support docker secrets from file for `PMA_USER`
- Support docker secrets from file for `PMA_CONTROLUSER`
- Support docker secrets from file for `PMA_CONTROLHOST`
2022-06-19 19:47:49 +02:00
William Desportes 6718899e83 Update CHANGELOG.md 2022-06-19 19:42:20 +02:00
Devin Matte aa6481613d Allowing different apache ports 2022-06-10 13:39:10 -04:00
William Desportes 0f9d9d2630 Fix the section about E2E tests 2022-06-10 16:00:17 +02:00
William Desportes 336ba22d89 Stop forcing a specifig auth mysql plugin as many users do not do such config 2022-06-10 15:53:25 +02:00
William Desportes 545fcca480 Mark test script as python3 2022-06-10 15:52:00 +02:00
William Desportes 3c859c0511 Add mariadb-connector-c for support of caching sha2 password method 2022-06-10 15:43:52 +02:00
William Desportes 347512bfc4 Re-work the makefile 2022-06-10 15:38:42 +02:00
William Desportes d621982217 Move docker-compose test files into a folder 2022-06-10 15:14:55 +02:00
William Desportes cc19f8ada1 Use Alpine 3.15 for the test image 2022-06-10 13:25:56 +02:00
William Desportes c0cd783445 Add permissions on GitHub workflows 2022-06-10 12:20:10 +02:00
William Desportes 326191915b Change the config syntax replacement way for phpMyAdmin 5.2 to define the "configFile" directive
Fixes #361
Fixes #364
Fixes #365
Fixes #366
2022-05-12 21:17:50 +02:00
William Desportes cddd8dda1b Add commands to check the replaced line can be found and was replaced + lint the file afterwards
Ref #361
Ref #364
Ref #365
Ref #366
2022-05-12 21:07:32 +02:00
William Desportes a9851bbd0c Bump actions/checkout to v3 2022-05-12 21:05:38 +02:00
Isaac Bennetch b057ee3d89 Update to 5.2.0 release
Signed-off-by: Isaac Bennetch <bennetch@gmail.com>
2022-05-11 10:21:57 -04:00
Isaac Bennetch 90bc75ac92 Version 5.1.4
Signed-off-by: Isaac Bennetch <bennetch@gmail.com>
2022-05-11 10:17:10 -04:00
Isaac Bennetch 026ddf5c11 Fix incorrect image tag name in README.md
Signed-off-by: Isaac Bennetch <bennetch@gmail.com>
2022-02-11 09:12:01 -05:00
Isaac Bennetch 2b79d71002 Update to 5.1.3 release
Signed-off-by: Isaac Bennetch <bennetch@gmail.com>
2022-02-11 08:58:24 -05:00
Isaac Bennetch 4dd05de348 Update to 5.1.2 release
Signed-off-by: Isaac Bennetch <bennetch@gmail.com>
2022-01-21 22:08:10 -05:00
William Desportes 7c28533a32 Fix #325 - Upgrade to PHP 8 2021-08-23 17:39:00 +02:00
William Desportes 056d2b51fd Write CHANGELOG entries since 4.9.2 2021-08-23 17:26:34 +02:00
William Desportes 030928a01e Fix #345 - Add back composer.json and remove non needed source files 2021-08-23 16:46:30 +02:00
William Desportes a73a82a790 Change the tags list link to the official image 2021-08-13 02:59:02 +02:00
William Desportes 0f4250dc7f Move test section to the end
I bet most users to not care about it
2021-08-13 02:55:48 +02:00
William Desportes 17b7a91289 Add a warning and example on the README
Ref: #338
Ref: #342
2021-08-13 02:53:23 +02:00
William Desportes 886f7ae6e3 Fix yaml format fence on the README 2021-08-13 02:47:32 +02:00
William Desportes 1655371fb0 Remove microbadger, it has shutdown 2021-08-13 02:45:41 +02:00
William Desportes 60c187d10d Add some format details from the PHP FAQ
Closes: #328
2021-08-13 02:42:49 +02:00
William Desportes 3dafd123f8 Merge #341 - Fix GPG keyservers 2021-08-13 01:43:47 +02:00
Daniel Rudolf e8ade8e3b1 Follow-up: GPG: Fix GPG keyservers
Signed-off-by: Daniel Rudolf <github.com@daniel-rudolf.de>
2021-08-11 20:25:33 +02:00
Daniel Rudolf 12e6fdf738 GPG: Fix GPG keyservers
sks-keyservers.net was shut down some time ago. keys.gnupg.net is just
an alias. Neither pgp.mit.edu, nor keyserver.pgp.com are available
right now, but there was no take-down notice, so we should assume they
are temporarily unavailable. Use keys.openpgp.org as main alternative.

Signed-off-by: Daniel Rudolf <github.com@daniel-rudolf.de>
2021-08-11 18:49:58 +02:00
27 changed files with 587 additions and 189 deletions
+8 -5
View File
@@ -1,5 +1,8 @@
name: GitHub CI
permissions:
contents: read
on:
pull_request:
push:
@@ -18,14 +21,14 @@ jobs:
outputs:
strategy: ${{ steps.generate-jobs.outputs.strategy }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: docker-library/bashbrew@v0.1.5
- id: generate-jobs
name: Generate Jobs
run: |
git clone --depth 1 https://github.com/docker-library/bashbrew.git -b master ~/bashbrew
strategy="$(~/bashbrew/scripts/github-actions/generate.sh)"
strategy="$(GITHUB_REPOSITORY=phpmyadmin "$BASHBREW_SCRIPTS/github-actions/generate.sh")"
echo "strategy=$strategy" >> "$GITHUB_OUTPUT"
jq . <<<"$strategy" # sanity check / debugging aid
echo "::set-output name=strategy::$strategy"
test:
needs: generate-jobs
@@ -33,7 +36,7 @@ jobs:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Prepare Environment
run: ${{ matrix.runs.prepare }}
- name: Pull Dependencies
+12 -9
View File
@@ -1,26 +1,29 @@
name: Internal test suite
permissions:
contents: read
on:
pull_request:
push:
jobs:
test-apache-container:
name: Test on database ${{ matrix.database-image }}
name: Test (${{ matrix.configuration }}) on database ${{ matrix.database-image }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
database-image: ["mariadb:10.4", "mysql:5.7", "mariadb:latest", "mysql:latest"]
configuration: ["default", "one-host", "fs-import-export", "different-apache-port"]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Build images
run: docker-compose -f docker-compose.testing.yml build
- name: Run normal tests
run: docker-compose -f docker-compose.testing.yml up --build --abort-on-container-exit --exit-code-from=sut
working-directory: ./testing/
run: docker-compose -f ./docker-compose/docker-compose.testing-${{ matrix.configuration }}.yml build
- name: Run ${{ matrix.configuration }} tests
working-directory: ./testing/
run: docker-compose -f ./docker-compose/docker-compose.testing-${{ matrix.configuration }}.yml up --build --abort-on-container-exit --exit-code-from=sut
env:
DB: ${{ matrix.database-image }}
- name: Run one host tests
run: docker-compose -f docker-compose.testing-one-host.yml up --build --abort-on-container-exit --exit-code-from=sut
env:
DB: ${{ matrix.database-image }}
+71
View File
@@ -0,0 +1,71 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## [Unreleased] - YYYY-MM-DD
- Move docker-compose test files into a folder
- Fix the section about E2E tests in `README.md`
- Support docker secrets from file for `PMA_USER` (#372)
- Support docker secrets from file for `PMA_CONTROLUSER` (#372)
- Support docker secrets from file for `PMA_CONTROLHOST` (#372)
- Allow a different Apache port with `APACHE_PORT` (#340)
- Add support for ENVs `PMA_UPLOADDIR` and `PMA_SAVEDIR` (#384)
- Fixed a bug with `APACHE_PORT` ENV on container restart (#381)
- Update to PHP 8.1 (#393)
## [5.1.4] - 2022-05-11
- Fix incorrect image tag name in `README.md`
## [5.1.2] - 2022-01-22
- Fix GPG keyservers in Dockerfiles
- Remove microbadger badges, it closed
- Improve the README file
- Fix add back composer.json and remove non needed source files (#345)
- Update to PHP 8.0 (#325)
## [5.1.1] - 2021-06-04
- Improve documentation
## [5.1.0] - 2021-02-24
- Set ini setting `max_input_vars = 10000`
- Add support for ENV `PMA_QUERYHISTORYMAX`
- Add support for ENV `MAX_EXECUTION_TIME`
- Add support for ENV `MEMORY_LIMIT`
- Move to GitHub actions
- Re-work the test system
- Support docker secrets from file for `PMA_CONTROLPASS`
- Generate phpmyadmin-misc.ini from ENVs
## [4.9.{6,7}] - 2020-10-{10,16} and [5.0.{3,4}] - 2020-10-{10,16}
- Add `tzdata` package
- Extract downloaded files directly to web root `/var/www/html/` (#277)
- Add SHA checksum when downloading a version
- Improved `UPLOAD_LIMIT` documentation
- Update documentation from `phpmyadmin/phpmyadmin` to `phpmyadmin`
- `phpmyadmin` is now the official image in the Docker official library
## [5.0.2] - 2020-03-21
- Add org.opencontainers.image.* labels
- Apply some feedback from docker-library team to Dockerfiles
## [4.9.3] - 2020-01-02 and [5.0.0] - 2019-12-26
- Add support for ENV `HIDE_PHP_VERSION` to set ini setting `expose_php = Off`
- Add support for ENV `UPLOAD_LIMIT` to set `upload_max_filesize` and `post_max_size` ini settings
- Add support for ENVs `PMA_CONFIG_BASE64` and `PMA_USER_CONFIG_BASE64` (#192)
- Support docker secrets from files for `PMA_PASSWORD`, `MYSQL_ROOT_PASSWORD` and `MYSQL_PASSWORD`
- Support docker secrets from files for `PMA_HOSTS` and `PMA_HOST`
## [4.9.2-2] - 2020-12-20
- Update to PHP 7.4 (#257)
- Drop ini setting `opcache.enable_cli=1`
+9 -7
View File
@@ -1,4 +1,4 @@
FROM php:7.4-%%VARIANT%%
FROM php:8.1-%%VARIANT%%
# docker-entrypoint.sh dependencies
RUN apk add --no-cache \
@@ -91,19 +91,21 @@ RUN set -ex; \
curl -fsSL -o phpMyAdmin.tar.xz $URL; \
curl -fsSL -o phpMyAdmin.tar.xz.asc $URL.asc; \
echo "$SHA256 *phpMyAdmin.tar.xz" | sha256sum -c -; \
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 keyserver.ubuntu.com --recv-keys "$GPGKEY" \
|| gpg --batch --keyserver pgp.mit.edu --recv-keys "$GPGKEY" \
|| gpg --batch --keyserver keyserver.pgp.com --recv-keys "$GPGKEY"; \
|| gpg --batch --keyserver keyserver.pgp.com --recv-keys "$GPGKEY" \
|| gpg --batch --keyserver keys.openpgp.org --recv-keys "$GPGKEY"; \
gpg --batch --verify phpMyAdmin.tar.xz.asc phpMyAdmin.tar.xz; \
tar -xf phpMyAdmin.tar.xz -C /var/www/html --strip-components=1; \
mkdir -p /var/www/html/tmp; \
chown www-data:www-data /var/www/html/tmp; \
gpgconf --kill all; \
rm -r "$GNUPGHOME" phpMyAdmin.tar.xz phpMyAdmin.tar.xz.asc; \
rm -rf /var/www/html/setup/ /var/www/html/examples/ /var/www/html/test/ /var/www/html/po/ /var/www/html/composer.json /var/www/html/RELEASE-DATE-$VERSION; \
sed -i "s@define('CONFIG_DIR'.*@define('CONFIG_DIR', '/etc/phpmyadmin/');@" /var/www/html/libraries/vendor_config.php; \
rm -r -v /var/www/html/setup/ /var/www/html/examples/ /var/www/html/js/src/ /var/www/html/templates/test/ /var/www/html/babel.config.json /var/www/html/doc/html/_sources/ /var/www/html/RELEASE-DATE-$VERSION /var/www/html/CONTRIBUTING.md; \
grep -q -F "'configFile' => ROOT_PATH . 'config.inc.php'," /var/www/html/libraries/vendor_config.php; \
sed -i "s@'configFile' => .*@'configFile' => '/etc/phpmyadmin/config.inc.php',@" /var/www/html/libraries/vendor_config.php; \
grep -q -F "'configFile' => '/etc/phpmyadmin/config.inc.php'," /var/www/html/libraries/vendor_config.php; \
php -l /var/www/html/libraries/vendor_config.php; \
apk del --no-network .fetch-deps
# Copy configuration
+9 -7
View File
@@ -1,4 +1,4 @@
FROM php:7.4-%%VARIANT%%
FROM php:8.1-%%VARIANT%%
# Install dependencies
RUN set -ex; \
@@ -98,19 +98,21 @@ RUN set -ex; \
curl -fsSL -o phpMyAdmin.tar.xz $URL; \
curl -fsSL -o phpMyAdmin.tar.xz.asc $URL.asc; \
echo "$SHA256 *phpMyAdmin.tar.xz" | sha256sum -c -; \
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 keyserver.ubuntu.com --recv-keys "$GPGKEY" \
|| gpg --batch --keyserver pgp.mit.edu --recv-keys "$GPGKEY" \
|| gpg --batch --keyserver keyserver.pgp.com --recv-keys "$GPGKEY"; \
|| gpg --batch --keyserver keyserver.pgp.com --recv-keys "$GPGKEY" \
|| gpg --batch --keyserver keys.openpgp.org --recv-keys "$GPGKEY"; \
gpg --batch --verify phpMyAdmin.tar.xz.asc phpMyAdmin.tar.xz; \
tar -xf phpMyAdmin.tar.xz -C /var/www/html --strip-components=1; \
mkdir -p /var/www/html/tmp; \
chown www-data:www-data /var/www/html/tmp; \
gpgconf --kill all; \
rm -r "$GNUPGHOME" phpMyAdmin.tar.xz phpMyAdmin.tar.xz.asc; \
rm -rf /var/www/html/setup/ /var/www/html/examples/ /var/www/html/test/ /var/www/html/po/ /var/www/html/composer.json /var/www/html/RELEASE-DATE-$VERSION; \
sed -i "s@define('CONFIG_DIR'.*@define('CONFIG_DIR', '/etc/phpmyadmin/');@" /var/www/html/libraries/vendor_config.php; \
rm -r -v /var/www/html/setup/ /var/www/html/examples/ /var/www/html/js/src/ /var/www/html/templates/test/ /var/www/html/babel.config.json /var/www/html/doc/html/_sources/ /var/www/html/RELEASE-DATE-$VERSION /var/www/html/CONTRIBUTING.md; \
grep -q -F "'configFile' => ROOT_PATH . 'config.inc.php'," /var/www/html/libraries/vendor_config.php; \
sed -i "s@'configFile' => .*@'configFile' => '/etc/phpmyadmin/config.inc.php',@" /var/www/html/libraries/vendor_config.php; \
grep -q -F "'configFile' => '/etc/phpmyadmin/config.inc.php'," /var/www/html/libraries/vendor_config.php; \
php -l /var/www/html/libraries/vendor_config.php; \
\
apt-mark auto '.*' > /dev/null; \
apt-mark manual $savedAptMark; \
+9 -6
View File
@@ -16,21 +16,24 @@ 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
docker-compose -f ./testing/docker-compose/docker-compose.testing-default.yml up -d
run-tests:
docker-compose exec phpmyadmin /test-docker.sh phpmyadmin_testing 80 phpmyadmin_testing_db
testing-%:
docker-compose -p "phpmyadmin_$@" -f ./testing/docker-compose/docker-compose.$@.yml up --build --abort-on-container-exit --exit-code-from=sut
docker-compose -p "phpmyadmin_$@" -f ./testing/docker-compose/docker-compose.$@.yml down
run-tests: testing-default testing-one-host testing-fs-import-export testing-different-apache-port
logs:
docker-compose -f docker-compose.testing.yml logs
docker-compose -f ./testing/docker-compose/docker-compose.testing-default.yml logs
clean: stop rm prune
stop:
docker-compose -f docker-compose.testing.yml stop
docker-compose -f ./testing/docker-compose/docker-compose.testing-default.yml stop
rm:
docker-compose -f docker-compose.testing.yml rm
docker-compose -f ./testing/docker-compose/docker-compose.testing-default.yml rm
prune:
docker rm `docker ps -q -a --filter status=exited`
+39 -24
View File
@@ -19,9 +19,6 @@ Run phpMyAdmin with Alpine, Apache and PHP FPM.
[![s390x build status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/multiarch/job/s390x/job/phpmyadmin.svg?label=s390x)](https://doi-janky.infosiftr.net/job/multiarch/job/s390x/job/phpmyadmin)
[![Docker Pulls](https://img.shields.io/docker/pulls/_/phpmyadmin.svg)][hub]
[![Docker Stars](https://img.shields.io/docker/stars/_/phpmyadmin.svg)][hub]
[![Docker Layers](https://images.microbadger.com/badges/image/phpmyadmin.svg)](https://microbadger.com/images/phpmyadmin "Get your own image badge on microbadger.com")
[![Docker Version](https://images.microbadger.com/badges/version/phpmyadmin.svg)](https://microbadger.com/images/phpmyadmin "Get your own version badge on microbadger.com")
All of the following examples will bring you phpMyAdmin on `http://localhost:8080`
where you can enjoy your happy MySQL administration.
@@ -43,9 +40,9 @@ The following tags are available:
* `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
* Specific patch versions, such as `5.0.0`, `5.0.0-fpm`, and `5.0.0-fpm-alpine`. Note that, on rare occasion, there may be an intermediary "docker-only" release, such as 4.9.2-1
A complete list of tags is [available at Docker Hub](https://hub.docker.com/r/phpmyadmin/phpmyadmin/tags)
A complete list of tags is [available at Docker Hub](https://hub.docker.com/_/phpmyadmin?tab=tags)
## Image variants
@@ -64,7 +61,7 @@ First you need to run a MySQL or MariaDB server in Docker, and the phpMyAdmin im
linked to the running database container:
```sh
docker run --name myadmin -d --link mysql_db_server:db -p 8080:80 phpmyadmin
docker run --name phpmyadmin -d --link mysql_db_server:db -p 8080:80 phpmyadmin:latest
```
## Usage with external server
@@ -73,7 +70,7 @@ You can specify a MySQL host in the `PMA_HOST` environment variable. You can als
use `PMA_PORT` to specify the port of the server in case it's not the default one:
```sh
docker run --name myadmin -d -e PMA_HOST=dbhost -p 8080:80 phpmyadmin
docker run --name phpmyadmin -d -e PMA_HOST=dbhost -p 8080:80 phpmyadmin:latest
```
## Usage with arbitrary server
@@ -81,7 +78,7 @@ docker run --name myadmin -d -e PMA_HOST=dbhost -p 8080:80 phpmyadmin
You can use arbitrary servers by adding the environment variable `PMA_ARBITRARY=1` to the startup command:
```sh
docker run --name myadmin -d -e PMA_ARBITRARY=1 -p 8080:80 phpmyadmin
docker run --name phpmyadmin -d -e PMA_ARBITRARY=1 -p 8080:80 phpmyadmin:latest
```
## Usage with docker-compose and arbitrary server
@@ -89,7 +86,7 @@ docker run --name myadmin -d -e PMA_ARBITRARY=1 -p 8080:80 phpmyadmin
This will run phpMyAdmin with the arbitrary server option - allowing you to specify any MySQL/MariaDB
server on the login page.
```sh
```yaml
version: '3.1'
services:
@@ -108,16 +105,6 @@ services:
- PMA_ARBITRARY=1
```
## Run the E2E tests with docker-compose
You can run the E2E tests with the local test environment by running MariaDB/MySQL databases. Adding ENV variable `PHPMYADMIN_RUN_TEST=true` already added on docker-compose file. Simply run:
Using the docker-compose.testing.yml from https://github.com/phpmyadmin/docker
```sh
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)
@@ -131,7 +118,17 @@ in it, and then linking it into the container using:
On the `docker run` line like this:
```sh
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
docker run --name phpmyadmin -d --link mysql_db_server:db -p 8080:80 -v /some/local/directory/config.user.inc.php:/etc/phpmyadmin/config.user.inc.php phpmyadmin:latest
```
Be sure to have `<?php` as your first line of the configuration file or the contents will not be detected as PHP code.
Example:
```php
<?php
$cfg['ShowPhpInfo'] = true; // Adds a link to phpinfo() on the home page
```
See the following links for config file information:
@@ -156,33 +153,51 @@ Set the variable ``PMA_ABSOLUTE_URI`` to the fully-qualified path (``https://pma
* ``PMA_ABSOLUTE_URI`` - the full URL to phpMyAdmin. Sometimes needed when used in a reverse-proxy configuration. Don't set this unless needed. See [documentation](https://docs.phpmyadmin.net/en/latest/config.html#cfg_PmaAbsoluteUri).
* ``PMA_CONFIG_BASE64`` - if set, this option will override the default `config.inc.php` with the base64 decoded contents of the variable
* ``PMA_USER_CONFIG_BASE64`` - if set, this option will override the default `config.user.inc.php` with the base64 decoded contents of the variable
* ``PMA_UPLOADDIR`` - if defined, this option will set the path where files can be saved to be available to import ([$cfg['UploadDir']](https://docs.phpmyadmin.net/en/latest/config.html#cfg_UploadDir))
* ``PMA_SAVEDIR`` - if defined, this option will set the path where exported files can be saved ([$cfg['SaveDir']](https://docs.phpmyadmin.net/en/latest/config.html#cfg_SaveDir))
* ``PMA_CONTROLHOST`` - when set, this points to an alternate database host used for storing the [phpMyAdmin Configuration Storage database](https://docs.phpmyadmin.net/en/latest/setup.html#phpmyadmin-configuration-storage) database
* ``PMA_CONTROLPORT`` - if set, will override the default port (3306) for connecting to the control host for storing the [phpMyAdmin Configuration Storage database](https://docs.phpmyadmin.net/en/latest/setup.html#phpmyadmin-configuration-storage) database
* ``PMA_PMADB`` - define the name of the database to be used for the [phpMyAdmin Configuration Storage database](https://docs.phpmyadmin.net/en/latest/setup.html#phpmyadmin-configuration-storage). When not set, the advanced features are not enabled by default (they can still potentially be enabled by the user when logging in with the zero conf (zero configuration) feature. Suggested values: `phpmyadmin` or `pmadb`
* ``PMA_PMADB`` - define the name of the database to be used for the [phpMyAdmin Configuration Storage database](https://docs.phpmyadmin.net/en/latest/setup.html#phpmyadmin-configuration-storage). When not set, the advanced features are not enabled by default: they can still potentially be enabled by the user when logging in with the zero conf (zero configuration) feature. Suggested values: `phpmyadmin` or `pmadb`
* ``PMA_CONTROLUSER`` - define the username for phpMyAdmin to use for advanced features (the [controluser](https://docs.phpmyadmin.net/en/latest/config.html#cfg_Servers_controluser))
* ``PMA_CONTROLPASS`` - define the password for phpMyAdmin to use with the [controluser](https://docs.phpmyadmin.net/en/latest/config.html#cfg_Servers_controlpass)
* ``PMA_QUERYHISTORYDB`` - when set [to true](https://docs.phpmyadmin.net/en/latest/config.html#cfg_QueryHistoryDB), enables storing [SQL history](https://docs.phpmyadmin.net/en/latest/config.html#cfg_Servers_history) to the [phpMyAdmin Configuration Storage database](https://docs.phpmyadmin.net/en/latest/setup.html#phpmyadmin-configuration-storage). When [false](https://docs.phpmyadmin.net/en/latest/config.html#cfg_QueryHistoryDB), history is stored in the browser and is cleared when logging out
* ``PMA_QUERYHISTORYMAX`` - when set to an integer, controls the number of history items. See [documentation](https://docs.phpmyadmin.net/en/latest/config.html#cfg_QueryHistoryMax). Defaults to `25`.
* ``MAX_EXECUTION_TIME`` - if set, will override the maximum execution time in seconds (default 600) for phpMyAdmin ([$cfg['ExecTimeLimit']](https://docs.phpmyadmin.net/en/latest/config.html#cfg_ExecTimeLimit)) and PHP [max_execution_time](https://www.php.net/manual/en/info.configuration.php#ini.max-execution-time) (format as `[0-9+]`)
* ``MEMORY_LIMIT`` - if set, will override the memory limit (default 512M) for phpMyAdmin ([$cfg['MemoryLimit']](https://docs.phpmyadmin.net/en/latest/config.html#cfg_MemoryLimit)) and PHP [memory_limit](https://www.php.net/manual/en/ini.core.php#ini.memory-limit) (format as `[0-9+](K,M,G)`)
* ``MEMORY_LIMIT`` - if set, will override the memory limit (default 512M) for phpMyAdmin ([$cfg['MemoryLimit']](https://docs.phpmyadmin.net/en/latest/config.html#cfg_MemoryLimit)) and PHP [memory_limit](https://www.php.net/manual/en/ini.core.php#ini.memory-limit) (format as `[0-9+](K,M,G)` where K is for Kilobytes, M for Megabytes, G for Gigabytes and 1K = 1024 bytes)
* ``UPLOAD_LIMIT`` - if set, this option will override the default value for apache and php-fpm (format as `[0-9+](K,M,G)` default value is 2048K, this will change ``upload_max_filesize`` and ``post_max_size`` values)
* ``HIDE_PHP_VERSION`` - if defined, this option will hide the PHP version (`expose_php = Off`). Set to any value (such as `HIDE_PHP_VERSION=true`).
* ``APACHE_PORT`` - if defined, this option will change the default Apache port from `80` in case you want it to run on a different port like an unprivileged port. Set to any port value (such as `APACHE_PORT=8090`)
For usage with Docker secrets, appending ``_FILE`` to the ``PMA_PASSWORD`` environment variable is allowed (it overrides ``PMA_PASSWORD`` if it is set):
```sh
docker run --name myadmin -d -e PMA_PASSWORD_FILE=/run/secrets/db_password.txt -p 8080:80 phpmyadmin
docker run --name phpmyadmin -d -e PMA_PASSWORD_FILE=/run/secrets/db_password.txt -p 8080:80 phpmyadmin:latest
```
#### Variables that can be read from a file using ``_FILE``
- `PMA_PASSWORD`
- `MYSQL_ROOT_PASSWORD`
- `MYSQL_PASSWORD`
- `PMA_USER`
- `PMA_PASSWORD`
- `PMA_HOSTS`
- `PMA_HOST`
- `PMA_CONTROLHOST`
- `PMA_CONTROLUSER`
- `PMA_CONTROLPASS`
## Run the E2E tests for this docker image
You can run the E2E test suite on a local test environment.
The Requirements are `make`, `docker` and `docker-compose`.
Clone this repository: `https://github.com/phpmyadmin/docker.git`
And then run this command to start the test suite:
```sh
make run-tests
```
For more detailed documentation see https://docs.phpmyadmin.net/en/latest/setup.html#installing-using-docker
[hub]: https://hub.docker.com/_/phpmyadmin
+11 -9
View File
@@ -1,4 +1,4 @@
FROM php:7.4-apache
FROM php:8.1-apache
# Install dependencies
RUN set -ex; \
@@ -68,8 +68,8 @@ RUN set -ex; \
} > $PHP_INI_DIR/conf.d/phpmyadmin-misc.ini
# Calculate download URL
ENV VERSION 5.1.1
ENV SHA256 1964d7190223c11e89fa1b7970c618e3a3bae2e859f5f60383f64c3848ef6921
ENV VERSION 5.2.1
ENV SHA256 373f9599dfbd96d6fe75316d5dad189e68c305f297edf42377db9dd6b41b2557
ENV URL https://files.phpmyadmin.net/phpMyAdmin/${VERSION}/phpMyAdmin-${VERSION}-all-languages.tar.xz
LABEL org.opencontainers.image.title="Official phpMyAdmin Docker image" \
@@ -98,19 +98,21 @@ RUN set -ex; \
curl -fsSL -o phpMyAdmin.tar.xz $URL; \
curl -fsSL -o phpMyAdmin.tar.xz.asc $URL.asc; \
echo "$SHA256 *phpMyAdmin.tar.xz" | sha256sum -c -; \
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 keyserver.ubuntu.com --recv-keys "$GPGKEY" \
|| gpg --batch --keyserver pgp.mit.edu --recv-keys "$GPGKEY" \
|| gpg --batch --keyserver keyserver.pgp.com --recv-keys "$GPGKEY"; \
|| gpg --batch --keyserver keyserver.pgp.com --recv-keys "$GPGKEY" \
|| gpg --batch --keyserver keys.openpgp.org --recv-keys "$GPGKEY"; \
gpg --batch --verify phpMyAdmin.tar.xz.asc phpMyAdmin.tar.xz; \
tar -xf phpMyAdmin.tar.xz -C /var/www/html --strip-components=1; \
mkdir -p /var/www/html/tmp; \
chown www-data:www-data /var/www/html/tmp; \
gpgconf --kill all; \
rm -r "$GNUPGHOME" phpMyAdmin.tar.xz phpMyAdmin.tar.xz.asc; \
rm -rf /var/www/html/setup/ /var/www/html/examples/ /var/www/html/test/ /var/www/html/po/ /var/www/html/composer.json /var/www/html/RELEASE-DATE-$VERSION; \
sed -i "s@define('CONFIG_DIR'.*@define('CONFIG_DIR', '/etc/phpmyadmin/');@" /var/www/html/libraries/vendor_config.php; \
rm -r -v /var/www/html/setup/ /var/www/html/examples/ /var/www/html/js/src/ /var/www/html/templates/test/ /var/www/html/babel.config.json /var/www/html/doc/html/_sources/ /var/www/html/RELEASE-DATE-$VERSION /var/www/html/CONTRIBUTING.md; \
grep -q -F "'configFile' => ROOT_PATH . 'config.inc.php'," /var/www/html/libraries/vendor_config.php; \
sed -i "s@'configFile' => .*@'configFile' => '/etc/phpmyadmin/config.inc.php',@" /var/www/html/libraries/vendor_config.php; \
grep -q -F "'configFile' => '/etc/phpmyadmin/config.inc.php'," /var/www/html/libraries/vendor_config.php; \
php -l /var/www/html/libraries/vendor_config.php; \
\
apt-mark auto '.*' > /dev/null; \
apt-mark manual $savedAptMark; \
+27 -18
View File
@@ -1,9 +1,9 @@
<?php
require('/etc/phpmyadmin/config.secret.inc.php');
require '/etc/phpmyadmin/config.secret.inc.php';
/* Ensure we got the environment */
$vars = array(
$vars = [
'PMA_ARBITRARY',
'PMA_HOST',
'PMA_HOSTS',
@@ -24,8 +24,11 @@ $vars = array(
'PMA_QUERYHISTORYDB',
'PMA_QUERYHISTORYMAX',
'MAX_EXECUTION_TIME',
'MEMORY_LIMIT'
);
'MEMORY_LIMIT',
'PMA_UPLOADDIR',
'PMA_SAVEDIR',
];
foreach ($vars as $var) {
$env = getenv($var);
if (!isset($_ENV[$var]) && $env !== false) {
@@ -33,11 +36,11 @@ foreach ($vars as $var) {
}
}
if (isset($_ENV['PMA_QUERYHISTORYDB'])) {
$cfg['QueryHistoryDB'] = boolval($_ENV['PMA_QUERYHISTORYDB']);
$cfg['QueryHistoryDB'] = (bool) $_ENV['PMA_QUERYHISTORYDB'];
}
if (isset($_ENV['PMA_QUERYHISTORYMAX'])) {
$cfg['QueryHistoryMax'] = intval($_ENV['PMA_QUERYHISTORYMAX']);
$cfg['QueryHistoryMax'] = (int) $_ENV['PMA_QUERYHISTORYMAX'];
}
/* Arbitrary server connection */
@@ -53,21 +56,22 @@ if (isset($_ENV['PMA_ABSOLUTE_URI'])) {
/* Figure out hosts */
/* Fallback to default linked */
$hosts = array('db');
$hosts = ['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'])) {
if (! empty($_ENV['PMA_HOST'])) {
$hosts = [$_ENV['PMA_HOST']];
$verbose = [$_ENV['PMA_VERBOSE']];
$ports = [$_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'])) {
if (! empty($_ENV['PMA_SOCKET'])) {
$sockets = [$_ENV['PMA_SOCKET']];
} elseif (! empty($_ENV['PMA_SOCKETS'])) {
$sockets = explode(',', $_ENV['PMA_SOCKETS']);
}
@@ -135,8 +139,13 @@ for ($i = 1; isset($sockets[$i - 1]); $i++) {
$i--;
/* Uploads setup */
$cfg['UploadDir'] = '';
$cfg['SaveDir'] = '';
if (isset($_ENV['PMA_UPLOADDIR'])) {
$cfg['UploadDir'] = $_ENV['PMA_UPLOADDIR'];
}
if (isset($_ENV['PMA_SAVEDIR'])) {
$cfg['SaveDir'] = $_ENV['PMA_SAVEDIR'];
}
if (isset($_ENV['MAX_EXECUTION_TIME'])) {
$cfg['ExecTimeLimit'] = $_ENV['MAX_EXECUTION_TIME'];
@@ -148,5 +157,5 @@ if (isset($_ENV['MEMORY_LIMIT'])) {
/* Include User Defined Settings Hook */
if (file_exists('/etc/phpmyadmin/config.user.inc.php')) {
include('/etc/phpmyadmin/config.user.inc.php');
include '/etc/phpmyadmin/config.user.inc.php';
}
+12
View File
@@ -28,6 +28,15 @@ if [ ! -z "${PMA_USER_CONFIG_BASE64}" ]; then
echo "${PMA_USER_CONFIG_BASE64}" | base64 -d > /etc/phpmyadmin/config.user.inc.php
fi
# start: Apache specific settings
if [ -n "${APACHE_PORT+x}" ]; then
echo "Setting apache port to ${APACHE_PORT}."
sed -i "/VirtualHost \*:80/c\\<VirtualHost \*:${APACHE_PORT}\>" /etc/apache2/sites-enabled/000-default.conf
sed -i "/Listen 80/c\Listen ${APACHE_PORT}" /etc/apache2/ports.conf
apachectl configtest
fi
# end: Apache specific settings
get_docker_secret() {
local env_var="${1}"
local env_var_file="${env_var}_FILE"
@@ -40,11 +49,14 @@ get_docker_secret() {
fi
}
get_docker_secret PMA_USER
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
get_docker_secret PMA_CONTROLHOST
get_docker_secret PMA_CONTROLUSER
get_docker_secret PMA_CONTROLPASS
exec "$@"
+27 -18
View File
@@ -1,9 +1,9 @@
<?php
require('/etc/phpmyadmin/config.secret.inc.php');
require '/etc/phpmyadmin/config.secret.inc.php';
/* Ensure we got the environment */
$vars = array(
$vars = [
'PMA_ARBITRARY',
'PMA_HOST',
'PMA_HOSTS',
@@ -24,8 +24,11 @@ $vars = array(
'PMA_QUERYHISTORYDB',
'PMA_QUERYHISTORYMAX',
'MAX_EXECUTION_TIME',
'MEMORY_LIMIT'
);
'MEMORY_LIMIT',
'PMA_UPLOADDIR',
'PMA_SAVEDIR',
];
foreach ($vars as $var) {
$env = getenv($var);
if (!isset($_ENV[$var]) && $env !== false) {
@@ -33,11 +36,11 @@ foreach ($vars as $var) {
}
}
if (isset($_ENV['PMA_QUERYHISTORYDB'])) {
$cfg['QueryHistoryDB'] = boolval($_ENV['PMA_QUERYHISTORYDB']);
$cfg['QueryHistoryDB'] = (bool) $_ENV['PMA_QUERYHISTORYDB'];
}
if (isset($_ENV['PMA_QUERYHISTORYMAX'])) {
$cfg['QueryHistoryMax'] = intval($_ENV['PMA_QUERYHISTORYMAX']);
$cfg['QueryHistoryMax'] = (int) $_ENV['PMA_QUERYHISTORYMAX'];
}
/* Arbitrary server connection */
@@ -53,21 +56,22 @@ if (isset($_ENV['PMA_ABSOLUTE_URI'])) {
/* Figure out hosts */
/* Fallback to default linked */
$hosts = array('db');
$hosts = ['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'])) {
if (! empty($_ENV['PMA_HOST'])) {
$hosts = [$_ENV['PMA_HOST']];
$verbose = [$_ENV['PMA_VERBOSE']];
$ports = [$_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'])) {
if (! empty($_ENV['PMA_SOCKET'])) {
$sockets = [$_ENV['PMA_SOCKET']];
} elseif (! empty($_ENV['PMA_SOCKETS'])) {
$sockets = explode(',', $_ENV['PMA_SOCKETS']);
}
@@ -135,8 +139,13 @@ for ($i = 1; isset($sockets[$i - 1]); $i++) {
$i--;
/* Uploads setup */
$cfg['UploadDir'] = '';
$cfg['SaveDir'] = '';
if (isset($_ENV['PMA_UPLOADDIR'])) {
$cfg['UploadDir'] = $_ENV['PMA_UPLOADDIR'];
}
if (isset($_ENV['PMA_SAVEDIR'])) {
$cfg['SaveDir'] = $_ENV['PMA_SAVEDIR'];
}
if (isset($_ENV['MAX_EXECUTION_TIME'])) {
$cfg['ExecTimeLimit'] = $_ENV['MAX_EXECUTION_TIME'];
@@ -148,5 +157,5 @@ if (isset($_ENV['MEMORY_LIMIT'])) {
/* Include User Defined Settings Hook */
if (file_exists('/etc/phpmyadmin/config.user.inc.php')) {
include('/etc/phpmyadmin/config.user.inc.php');
include '/etc/phpmyadmin/config.user.inc.php';
}
+12
View File
@@ -28,6 +28,15 @@ if [ ! -z "${PMA_USER_CONFIG_BASE64}" ]; then
echo "${PMA_USER_CONFIG_BASE64}" | base64 -d > /etc/phpmyadmin/config.user.inc.php
fi
# start: Apache specific settings
if [ -n "${APACHE_PORT+x}" ]; then
echo "Setting apache port to ${APACHE_PORT}."
sed -i "/VirtualHost \*:80/c\\<VirtualHost \*:${APACHE_PORT}\>" /etc/apache2/sites-enabled/000-default.conf
sed -i "/Listen 80/c\Listen ${APACHE_PORT}" /etc/apache2/ports.conf
apachectl configtest
fi
# end: Apache specific settings
get_docker_secret() {
local env_var="${1}"
local env_var_file="${env_var}_FILE"
@@ -40,11 +49,14 @@ get_docker_secret() {
fi
}
get_docker_secret PMA_USER
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
get_docker_secret PMA_CONTROLHOST
get_docker_secret PMA_CONTROLUSER
get_docker_secret PMA_CONTROLPASS
exec "$@"
+11 -9
View File
@@ -1,4 +1,4 @@
FROM php:7.4-fpm-alpine
FROM php:8.1-fpm-alpine
# docker-entrypoint.sh dependencies
RUN apk add --no-cache \
@@ -66,8 +66,8 @@ RUN set -ex; \
} > $PHP_INI_DIR/conf.d/phpmyadmin-misc.ini
# Calculate download URL
ENV VERSION 5.1.1
ENV SHA256 1964d7190223c11e89fa1b7970c618e3a3bae2e859f5f60383f64c3848ef6921
ENV VERSION 5.2.1
ENV SHA256 373f9599dfbd96d6fe75316d5dad189e68c305f297edf42377db9dd6b41b2557
ENV URL https://files.phpmyadmin.net/phpMyAdmin/${VERSION}/phpMyAdmin-${VERSION}-all-languages.tar.xz
LABEL org.opencontainers.image.title="Official phpMyAdmin Docker image" \
@@ -91,19 +91,21 @@ RUN set -ex; \
curl -fsSL -o phpMyAdmin.tar.xz $URL; \
curl -fsSL -o phpMyAdmin.tar.xz.asc $URL.asc; \
echo "$SHA256 *phpMyAdmin.tar.xz" | sha256sum -c -; \
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 keyserver.ubuntu.com --recv-keys "$GPGKEY" \
|| gpg --batch --keyserver pgp.mit.edu --recv-keys "$GPGKEY" \
|| gpg --batch --keyserver keyserver.pgp.com --recv-keys "$GPGKEY"; \
|| gpg --batch --keyserver keyserver.pgp.com --recv-keys "$GPGKEY" \
|| gpg --batch --keyserver keys.openpgp.org --recv-keys "$GPGKEY"; \
gpg --batch --verify phpMyAdmin.tar.xz.asc phpMyAdmin.tar.xz; \
tar -xf phpMyAdmin.tar.xz -C /var/www/html --strip-components=1; \
mkdir -p /var/www/html/tmp; \
chown www-data:www-data /var/www/html/tmp; \
gpgconf --kill all; \
rm -r "$GNUPGHOME" phpMyAdmin.tar.xz phpMyAdmin.tar.xz.asc; \
rm -rf /var/www/html/setup/ /var/www/html/examples/ /var/www/html/test/ /var/www/html/po/ /var/www/html/composer.json /var/www/html/RELEASE-DATE-$VERSION; \
sed -i "s@define('CONFIG_DIR'.*@define('CONFIG_DIR', '/etc/phpmyadmin/');@" /var/www/html/libraries/vendor_config.php; \
rm -r -v /var/www/html/setup/ /var/www/html/examples/ /var/www/html/js/src/ /var/www/html/templates/test/ /var/www/html/babel.config.json /var/www/html/doc/html/_sources/ /var/www/html/RELEASE-DATE-$VERSION /var/www/html/CONTRIBUTING.md; \
grep -q -F "'configFile' => ROOT_PATH . 'config.inc.php'," /var/www/html/libraries/vendor_config.php; \
sed -i "s@'configFile' => .*@'configFile' => '/etc/phpmyadmin/config.inc.php',@" /var/www/html/libraries/vendor_config.php; \
grep -q -F "'configFile' => '/etc/phpmyadmin/config.inc.php'," /var/www/html/libraries/vendor_config.php; \
php -l /var/www/html/libraries/vendor_config.php; \
apk del --no-network .fetch-deps
# Copy configuration
+27 -18
View File
@@ -1,9 +1,9 @@
<?php
require('/etc/phpmyadmin/config.secret.inc.php');
require '/etc/phpmyadmin/config.secret.inc.php';
/* Ensure we got the environment */
$vars = array(
$vars = [
'PMA_ARBITRARY',
'PMA_HOST',
'PMA_HOSTS',
@@ -24,8 +24,11 @@ $vars = array(
'PMA_QUERYHISTORYDB',
'PMA_QUERYHISTORYMAX',
'MAX_EXECUTION_TIME',
'MEMORY_LIMIT'
);
'MEMORY_LIMIT',
'PMA_UPLOADDIR',
'PMA_SAVEDIR',
];
foreach ($vars as $var) {
$env = getenv($var);
if (!isset($_ENV[$var]) && $env !== false) {
@@ -33,11 +36,11 @@ foreach ($vars as $var) {
}
}
if (isset($_ENV['PMA_QUERYHISTORYDB'])) {
$cfg['QueryHistoryDB'] = boolval($_ENV['PMA_QUERYHISTORYDB']);
$cfg['QueryHistoryDB'] = (bool) $_ENV['PMA_QUERYHISTORYDB'];
}
if (isset($_ENV['PMA_QUERYHISTORYMAX'])) {
$cfg['QueryHistoryMax'] = intval($_ENV['PMA_QUERYHISTORYMAX']);
$cfg['QueryHistoryMax'] = (int) $_ENV['PMA_QUERYHISTORYMAX'];
}
/* Arbitrary server connection */
@@ -53,21 +56,22 @@ if (isset($_ENV['PMA_ABSOLUTE_URI'])) {
/* Figure out hosts */
/* Fallback to default linked */
$hosts = array('db');
$hosts = ['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'])) {
if (! empty($_ENV['PMA_HOST'])) {
$hosts = [$_ENV['PMA_HOST']];
$verbose = [$_ENV['PMA_VERBOSE']];
$ports = [$_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'])) {
if (! empty($_ENV['PMA_SOCKET'])) {
$sockets = [$_ENV['PMA_SOCKET']];
} elseif (! empty($_ENV['PMA_SOCKETS'])) {
$sockets = explode(',', $_ENV['PMA_SOCKETS']);
}
@@ -135,8 +139,13 @@ for ($i = 1; isset($sockets[$i - 1]); $i++) {
$i--;
/* Uploads setup */
$cfg['UploadDir'] = '';
$cfg['SaveDir'] = '';
if (isset($_ENV['PMA_UPLOADDIR'])) {
$cfg['UploadDir'] = $_ENV['PMA_UPLOADDIR'];
}
if (isset($_ENV['PMA_SAVEDIR'])) {
$cfg['SaveDir'] = $_ENV['PMA_SAVEDIR'];
}
if (isset($_ENV['MAX_EXECUTION_TIME'])) {
$cfg['ExecTimeLimit'] = $_ENV['MAX_EXECUTION_TIME'];
@@ -148,5 +157,5 @@ if (isset($_ENV['MEMORY_LIMIT'])) {
/* Include User Defined Settings Hook */
if (file_exists('/etc/phpmyadmin/config.user.inc.php')) {
include('/etc/phpmyadmin/config.user.inc.php');
include '/etc/phpmyadmin/config.user.inc.php';
}
+4
View File
@@ -28,6 +28,7 @@ if [ ! -z "${PMA_USER_CONFIG_BASE64}" ]; then
echo "${PMA_USER_CONFIG_BASE64}" | base64 -d > /etc/phpmyadmin/config.user.inc.php
fi
get_docker_secret() {
local env_var="${1}"
local env_var_file="${env_var}_FILE"
@@ -40,11 +41,14 @@ get_docker_secret() {
fi
}
get_docker_secret PMA_USER
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
get_docker_secret PMA_CONTROLHOST
get_docker_secret PMA_CONTROLUSER
get_docker_secret PMA_CONTROLPASS
exec "$@"
+11 -9
View File
@@ -1,4 +1,4 @@
FROM php:7.4-fpm
FROM php:8.1-fpm
# Install dependencies
RUN set -ex; \
@@ -68,8 +68,8 @@ RUN set -ex; \
} > $PHP_INI_DIR/conf.d/phpmyadmin-misc.ini
# Calculate download URL
ENV VERSION 5.1.1
ENV SHA256 1964d7190223c11e89fa1b7970c618e3a3bae2e859f5f60383f64c3848ef6921
ENV VERSION 5.2.1
ENV SHA256 373f9599dfbd96d6fe75316d5dad189e68c305f297edf42377db9dd6b41b2557
ENV URL https://files.phpmyadmin.net/phpMyAdmin/${VERSION}/phpMyAdmin-${VERSION}-all-languages.tar.xz
LABEL org.opencontainers.image.title="Official phpMyAdmin Docker image" \
@@ -98,19 +98,21 @@ RUN set -ex; \
curl -fsSL -o phpMyAdmin.tar.xz $URL; \
curl -fsSL -o phpMyAdmin.tar.xz.asc $URL.asc; \
echo "$SHA256 *phpMyAdmin.tar.xz" | sha256sum -c -; \
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 keyserver.ubuntu.com --recv-keys "$GPGKEY" \
|| gpg --batch --keyserver pgp.mit.edu --recv-keys "$GPGKEY" \
|| gpg --batch --keyserver keyserver.pgp.com --recv-keys "$GPGKEY"; \
|| gpg --batch --keyserver keyserver.pgp.com --recv-keys "$GPGKEY" \
|| gpg --batch --keyserver keys.openpgp.org --recv-keys "$GPGKEY"; \
gpg --batch --verify phpMyAdmin.tar.xz.asc phpMyAdmin.tar.xz; \
tar -xf phpMyAdmin.tar.xz -C /var/www/html --strip-components=1; \
mkdir -p /var/www/html/tmp; \
chown www-data:www-data /var/www/html/tmp; \
gpgconf --kill all; \
rm -r "$GNUPGHOME" phpMyAdmin.tar.xz phpMyAdmin.tar.xz.asc; \
rm -rf /var/www/html/setup/ /var/www/html/examples/ /var/www/html/test/ /var/www/html/po/ /var/www/html/composer.json /var/www/html/RELEASE-DATE-$VERSION; \
sed -i "s@define('CONFIG_DIR'.*@define('CONFIG_DIR', '/etc/phpmyadmin/');@" /var/www/html/libraries/vendor_config.php; \
rm -r -v /var/www/html/setup/ /var/www/html/examples/ /var/www/html/js/src/ /var/www/html/templates/test/ /var/www/html/babel.config.json /var/www/html/doc/html/_sources/ /var/www/html/RELEASE-DATE-$VERSION /var/www/html/CONTRIBUTING.md; \
grep -q -F "'configFile' => ROOT_PATH . 'config.inc.php'," /var/www/html/libraries/vendor_config.php; \
sed -i "s@'configFile' => .*@'configFile' => '/etc/phpmyadmin/config.inc.php',@" /var/www/html/libraries/vendor_config.php; \
grep -q -F "'configFile' => '/etc/phpmyadmin/config.inc.php'," /var/www/html/libraries/vendor_config.php; \
php -l /var/www/html/libraries/vendor_config.php; \
\
apt-mark auto '.*' > /dev/null; \
apt-mark manual $savedAptMark; \
+27 -18
View File
@@ -1,9 +1,9 @@
<?php
require('/etc/phpmyadmin/config.secret.inc.php');
require '/etc/phpmyadmin/config.secret.inc.php';
/* Ensure we got the environment */
$vars = array(
$vars = [
'PMA_ARBITRARY',
'PMA_HOST',
'PMA_HOSTS',
@@ -24,8 +24,11 @@ $vars = array(
'PMA_QUERYHISTORYDB',
'PMA_QUERYHISTORYMAX',
'MAX_EXECUTION_TIME',
'MEMORY_LIMIT'
);
'MEMORY_LIMIT',
'PMA_UPLOADDIR',
'PMA_SAVEDIR',
];
foreach ($vars as $var) {
$env = getenv($var);
if (!isset($_ENV[$var]) && $env !== false) {
@@ -33,11 +36,11 @@ foreach ($vars as $var) {
}
}
if (isset($_ENV['PMA_QUERYHISTORYDB'])) {
$cfg['QueryHistoryDB'] = boolval($_ENV['PMA_QUERYHISTORYDB']);
$cfg['QueryHistoryDB'] = (bool) $_ENV['PMA_QUERYHISTORYDB'];
}
if (isset($_ENV['PMA_QUERYHISTORYMAX'])) {
$cfg['QueryHistoryMax'] = intval($_ENV['PMA_QUERYHISTORYMAX']);
$cfg['QueryHistoryMax'] = (int) $_ENV['PMA_QUERYHISTORYMAX'];
}
/* Arbitrary server connection */
@@ -53,21 +56,22 @@ if (isset($_ENV['PMA_ABSOLUTE_URI'])) {
/* Figure out hosts */
/* Fallback to default linked */
$hosts = array('db');
$hosts = ['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'])) {
if (! empty($_ENV['PMA_HOST'])) {
$hosts = [$_ENV['PMA_HOST']];
$verbose = [$_ENV['PMA_VERBOSE']];
$ports = [$_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'])) {
if (! empty($_ENV['PMA_SOCKET'])) {
$sockets = [$_ENV['PMA_SOCKET']];
} elseif (! empty($_ENV['PMA_SOCKETS'])) {
$sockets = explode(',', $_ENV['PMA_SOCKETS']);
}
@@ -135,8 +139,13 @@ for ($i = 1; isset($sockets[$i - 1]); $i++) {
$i--;
/* Uploads setup */
$cfg['UploadDir'] = '';
$cfg['SaveDir'] = '';
if (isset($_ENV['PMA_UPLOADDIR'])) {
$cfg['UploadDir'] = $_ENV['PMA_UPLOADDIR'];
}
if (isset($_ENV['PMA_SAVEDIR'])) {
$cfg['SaveDir'] = $_ENV['PMA_SAVEDIR'];
}
if (isset($_ENV['MAX_EXECUTION_TIME'])) {
$cfg['ExecTimeLimit'] = $_ENV['MAX_EXECUTION_TIME'];
@@ -148,5 +157,5 @@ if (isset($_ENV['MEMORY_LIMIT'])) {
/* Include User Defined Settings Hook */
if (file_exists('/etc/phpmyadmin/config.user.inc.php')) {
include('/etc/phpmyadmin/config.user.inc.php');
include '/etc/phpmyadmin/config.user.inc.php';
}
+4
View File
@@ -28,6 +28,7 @@ if [ ! -z "${PMA_USER_CONFIG_BASE64}" ]; then
echo "${PMA_USER_CONFIG_BASE64}" | base64 -d > /etc/phpmyadmin/config.user.inc.php
fi
get_docker_secret() {
local env_var="${1}"
local env_var_file="${env_var}_FILE"
@@ -40,11 +41,14 @@ get_docker_secret() {
fi
}
get_docker_secret PMA_USER
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
get_docker_secret PMA_CONTROLHOST
get_docker_secret PMA_CONTROLUSER
get_docker_secret PMA_CONTROLPASS
exec "$@"
+3 -3
View File
@@ -1,9 +1,9 @@
# Testing image for phpMyAdmin
FROM alpine:3.12
FROM alpine:3.15
# Install test dependencies
RUN set -ex; \
\
apk add --no-cache --update mariadb-client bash \
py3-html5lib py3-pytest py3-mechanize
apk add --no-cache --update mariadb-client mariadb-connector-c bash \
py3-html5lib py3-pytest py3-mechanize curl
@@ -3,33 +3,31 @@ version: "3.1"
services:
db_server:
image: ${DB:-mariadb:10.3}
container_name: phpmyadmin_testing_db
environment:
MYSQL_ROOT_PASSWORD: "${TESTSUITE_PASSWORD:-my-secret-pw}"
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-uroot", "-p${TESTSUITE_PASSWORD:-my-secret-pw}"]
start_period: 5s
start_period: 10s
interval: 5s
timeout: 60s
retries: 10
networks:
testing:
volumes:
- ./testing/testing.cnf:/etc/mysql/conf.d/testing.cnf:ro
aliases:
- phpmyadmin_testing_db
tmpfs:
- /var/lib/mysql:rw,noexec,nosuid,size=300m
phpmyadmin:
build:
context: apache
container_name: phpmyadmin_testing_apache
context: ../../apache
environment:
PMA_ARBITRARY: 1
UPLOAD_LIMIT: 123M
MAX_EXECUTION_TIME: 125
HIDE_PHP_VERSION: 1
volumes:
- ./testing/config.user.inc.php:/etc/phpmyadmin/config.user.inc.php
- ../config.user.inc.php:/etc/phpmyadmin/config.user.inc.php:ro
healthcheck:
test: ["CMD", "curl", "-Ss", "http://localhost/robots.txt"]
start_period: 5s
@@ -38,6 +36,8 @@ services:
retries: 10
networks:
testing:
aliases:
- phpmyadmin_testing_apache
depends_on:
db_server:
condition: service_healthy
@@ -49,7 +49,7 @@ services:
db_server:
condition: service_healthy
build:
context: testing
context: ../
command: "/tests/testing/test-docker.sh"
networks:
testing:
@@ -60,7 +60,7 @@ services:
TESTSUITE_PORT: 80
TESTSUITE_PASSWORD: "${TESTSUITE_PASSWORD:-my-secret-pw}"
volumes:
- ./:/tests:ro
- ../../:/tests:ro
- /var/run/docker.sock:/var/run/docker.sock
working_dir: /tests
@@ -0,0 +1,70 @@
version: "3.1"
services:
db_server:
image: ${DB:-mariadb:10.3}
environment:
MYSQL_ROOT_PASSWORD: "${TESTSUITE_PASSWORD:-my-secret-pw}"
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-uroot", "-p${TESTSUITE_PASSWORD:-my-secret-pw}"]
start_period: 10s
interval: 5s
timeout: 60s
retries: 10
networks:
testing:
aliases:
- phpmyadmin_testing_db
tmpfs:
- /var/lib/mysql:rw,noexec,nosuid,size=300m
phpmyadmin:
build:
context: ../../apache
environment:
PMA_HOST: db_server
UPLOAD_LIMIT: 123M
MAX_EXECUTION_TIME: 125
HIDE_PHP_VERSION: 1
APACHE_PORT: 8090
volumes:
- ../config.user.inc.php:/etc/phpmyadmin/config.user.inc.php:ro
healthcheck:
test: ["CMD", "curl", "-Ss", "http://localhost:8090/robots.txt"]
start_period: 5s
interval: 3s
timeout: 60s
retries: 10
networks:
testing:
aliases:
- phpmyadmin_testing_apache
depends_on:
db_server:
condition: service_healthy
sut:
depends_on:
phpmyadmin:
condition: service_healthy
db_server:
condition: service_healthy
build:
context: ../
command: "/tests/testing/test-docker.sh"
networks:
testing:
environment:
TESTSUITE_HOSTNAME: phpmyadmin_testing_apache
TESTSUITE_PORT: 8090
TESTSUITE_PASSWORD: "${TESTSUITE_PASSWORD:-my-secret-pw}"
PMA_HOST: phpmyadmin_testing_db
PMA_PORT: 3306
volumes:
- ../../:/tests:ro
- /var/run/docker.sock:/var/run/docker.sock
working_dir: /tests
networks:
testing:
driver: bridge
@@ -0,0 +1,80 @@
version: "3.1"
services:
db_server:
image: ${DB:-mariadb:10.3}
environment:
MYSQL_ROOT_PASSWORD: "${TESTSUITE_PASSWORD:-my-secret-pw}"
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-uroot", "-p${TESTSUITE_PASSWORD:-my-secret-pw}"]
start_period: 10s
interval: 5s
timeout: 60s
retries: 10
networks:
testing:
aliases:
- phpmyadmin_testing_db
tmpfs:
- /var/lib/mysql:rw,noexec,nosuid,size=300m
phpmyadmin:
build:
context: ../../apache
environment:
PMA_HOST: db_server
UPLOAD_LIMIT: 123M
MAX_EXECUTION_TIME: 125
HIDE_PHP_VERSION: 1
PMA_UPLOADDIR: /etc/phpmyadmin/imports
PMA_SAVEDIR: /etc/phpmyadmin/exports
volumes:
- ../config.user.inc.php:/etc/phpmyadmin/config.user.inc.php:ro
- phpmyadmin-data:/etc/phpmyadmin/imports:ro
- phpmyadmin-data:/etc/phpmyadmin/exports
healthcheck:
test: ["CMD", "curl", "-Ss", "http://localhost/robots.txt"]
start_period: 5s
interval: 3s
timeout: 60s
retries: 10
networks:
testing:
aliases:
- phpmyadmin_testing_apache
depends_on:
db_server:
condition: service_healthy
sut:
depends_on:
phpmyadmin:
condition: service_healthy
db_server:
condition: service_healthy
build:
context: ../
command: "/tests/testing/test-docker.sh"
networks:
testing:
environment:
TESTSUITE_HOSTNAME: phpmyadmin_testing_apache
TESTSUITE_PORT: 80
TESTSUITE_PASSWORD: "${TESTSUITE_PASSWORD:-my-secret-pw}"
PMA_HOST: phpmyadmin_testing_db
PMA_PORT: 3306
PMA_UPLOADDIR: /etc/phpmyadmin/imports
PMA_SAVEDIR: /etc/phpmyadmin/exports
volumes:
- ../../:/tests:ro
- /var/run/docker.sock:/var/run/docker.sock
- phpmyadmin-data:/etc/phpmyadmin/imports
- phpmyadmin-data:/etc/phpmyadmin/exports
working_dir: /tests
networks:
testing:
driver: bridge
volumes:
phpmyadmin-data:
@@ -3,33 +3,31 @@ version: "3.1"
services:
db_server:
image: ${DB:-mariadb:10.3}
container_name: phpmyadmin_testing_db
environment:
MYSQL_ROOT_PASSWORD: "${TESTSUITE_PASSWORD:-my-secret-pw}"
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-uroot", "-p${TESTSUITE_PASSWORD:-my-secret-pw}"]
start_period: 5s
start_period: 10s
interval: 5s
timeout: 60s
retries: 10
networks:
testing:
volumes:
- ./testing/testing.cnf:/etc/mysql/conf.d/testing.cnf:ro
aliases:
- phpmyadmin_testing_db
tmpfs:
- /var/lib/mysql:rw,noexec,nosuid,size=300m
phpmyadmin:
build:
context: apache
container_name: phpmyadmin_testing_apache
context: ../../apache
environment:
PMA_HOST: db_server
UPLOAD_LIMIT: 123M
MAX_EXECUTION_TIME: 125
HIDE_PHP_VERSION: 1
volumes:
- ./testing/config.user.inc.php:/etc/phpmyadmin/config.user.inc.php
- ../config.user.inc.php:/etc/phpmyadmin/config.user.inc.php:ro
healthcheck:
test: ["CMD", "curl", "-Ss", "http://localhost/robots.txt"]
start_period: 5s
@@ -38,6 +36,8 @@ services:
retries: 10
networks:
testing:
aliases:
- phpmyadmin_testing_apache
depends_on:
db_server:
condition: service_healthy
@@ -49,7 +49,7 @@ services:
db_server:
condition: service_healthy
build:
context: testing
context: ../
command: "/tests/testing/test-docker.sh"
networks:
testing:
@@ -60,7 +60,7 @@ services:
PMA_HOST: phpmyadmin_testing_db
PMA_PORT: 3306
volumes:
- ./:/tests:ro
- ../../:/tests:ro
- /var/run/docker.sock:/var/run/docker.sock
working_dir: /tests
+75 -9
View File
@@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python3
import argparse
import os
import subprocess
@@ -31,15 +31,18 @@ def do_login(br, url, username, password, server):
response = br.submit()
return response
def test_phpmyadmin(url, username, password, server, sqlfile):
def get_world_sql_path():
if os.path.exists('/world.sql'):
return '/world.sql'
elif os.path.exists('./world.sql'):
return './world.sql'
else:
path = os.path.dirname(os.path.realpath(__file__))
return path + '/world.sql'
def test_import(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:
path = os.path.dirname(os.path.realpath(__file__))
sqlfile = path + '/world.sql'
sqlfile = get_world_sql_path()
br = create_browser()
@@ -78,9 +81,12 @@ def docker_secret(env_name):
def test_phpmyadmin_secrets():
docker_secret('MYSQL_PASSWORD')
docker_secret('MYSQL_ROOT_PASSWORD')
docker_secret('PMA_USER')
docker_secret('PMA_PASSWORD')
docker_secret('PMA_HOSTS')
docker_secret('PMA_HOST')
docker_secret('PMA_CONTROLHOST')
docker_secret('PMA_CONTROLUSER')
docker_secret('PMA_CONTROLPASS')
@@ -105,3 +111,63 @@ def test_php_ini(url, username, password, server):
assert(b'<tr><td class="e">post_max_size</td><td class="v">123M</td><td class="v">123M</td></tr>' in response)
assert(b'<tr><td class="e">expose_php</td><td class="v">Off</td><td class="v">Off</td></tr>' in response)
def test_import_from_folder(url, username, password, server, sqlfile):
upload_dir = os.environ.get('PMA_UPLOADDIR');
if not upload_dir:
pytest.skip("Missing PMA_UPLOADDIR ENV", allow_module_level=True)
# Copy file into the volume
with open(get_world_sql_path(), 'rb') as src, open(upload_dir + '/world-data.sql', 'wb') as dst:
dst.write(src.read())
br = create_browser()
response = do_login(br, url, username, password, server)
assert(b'Server version' in response.read())
# Open server import
response = br.follow_link(text_regex=re.compile('Import'))
response = response.read()
assert(b'Browse your computer:' in response)
assert(upload_dir.encode() in response)
assert(b'world-data.sql' in response)
def test_export_to_folder(url, username, password, server, sqlfile):
save_dir = os.environ.get('PMA_SAVEDIR');
if not save_dir:
pytest.skip("Missing PMA_SAVEDIR ENV", allow_module_level=True)
# Delete file from previous runs
if os.path.exists(save_dir + "/db_server.sql"):
os.remove(save_dir + "/db_server.sql")
assert os.path.exists(save_dir + "/db_server.sql") == False
# Avoid: "The web server does not have permission to save the file"
os.chmod(save_dir , 0o777)
br = create_browser()
response = do_login(br, url, username, password, server)
assert(b'Server version' in response.read())
# Open server export
response = br.follow_link(text_regex=re.compile('Export'))
response = response.read()
assert(b'Save on server in the directory' in response)
assert(save_dir.encode() in response)
br.select_form('dump')
br.find_control("quick_export_onserver").items[0].selected=True
response = br.submit()
response = response.read()
assert(b'Dump has been saved to file' in response)
assert(b'Dump has been saved to file /etc/phpmyadmin/exports/db_server.sql' in response)
assert os.path.exists(save_dir + "/db_server.sql") == True
+8
View File
@@ -28,6 +28,14 @@ if [ $ret -ne 0 ] ; then
exit $ret
fi
curl -fsSL --output /dev/null "${PHPMYADMIN_URL}"
ret=$?
if [ $ret -ne 0 ] ; then
echo "Could not connect to ${PHPMYADMIN_URL}"
exit $ret
fi
# Perform tests
ret=0
pytest -p no:cacheprovider -q --url "$PHPMYADMIN_URL" --username ${TESTSUITE_USER:=root} --password "$TESTSUITE_PASSWORD" $SERVER $FILENAME
-2
View File
@@ -1,2 +0,0 @@
[mysqld]
default_authentication_plugin = mysql_native_password
+3
View File
@@ -35,4 +35,7 @@ for variant in apache fpm fpm-alpine; do
s/%%VARIANT%%/'"$variant"'/;
s/%%CMD%%/'"${cmd[$variant]}"'/;
' "$variant/Dockerfile"
if [ "$variant" != "apache" ]; then
sed -i "/^# start: Apache specific settings$/,/^# end: Apache specific settings$/d" "$variant/docker-entrypoint.sh"
fi
done