Compare commits

...
105 Commits
Author SHA1 Message Date
Isaac Bennetch 497becb0f2 Update to 5.0.4
Signed-off-by: Isaac Bennetch <bennetch@gmail.com>
2020-10-15 18:51:26 -04:00
Isaac Bennetch ba8ecc42f1 Update to 4.9.7
Signed-off-by: Isaac Bennetch <bennetch@gmail.com>
2020-10-15 18:50:23 -04:00
Isaac Bennetch 3b0375d811 Release 5.0.3
Signed-off-by: Isaac Bennetch <bennetch@gmail.com>
2020-10-10 00:18:15 -04:00
Isaac Bennetch 4f54fc3b46 Release 4.9.6
Signed-off-by: Isaac Bennetch <bennetch@gmail.com>
2020-10-10 00:15:20 -04:00
William Desportes 785cd48c48 #268 - Add instructions to download bashbrew 2020-09-03 18:23:25 +02:00
William Desportes 301a7c4d18 Merge #268 - Update generate-stackbrew-library.sh 2020-09-03 18:07:59 +02:00
William Desportes ad9f085601 Merge #303 - Fix docker hub tags page link 2020-09-03 18:07:16 +02:00
ff56a56a29 Use the docker library path for tags page
Co-authored-by: William Desportes <williamdes@wdes.fr>
2020-09-03 18:03:41 +02:00
Thomas DutrionandGitHub e3b575ca8e Fix docker hub tags page link
Fix Docker hub tags page link in README
2020-09-03 17:35:54 +02:00
William Desportes b9da1f2c54 Merge #301 - Update paths to image 2020-08-31 19:13:36 +02:00
J0WI d00506237d Update paths to image 2020-08-30 17:22:07 +02:00
William Desportes 39cec98bb5 Use fences for pseudo regex example of #297
Signed-off-by: William Desportes <williamdes@wdes.fr>
2020-07-31 23:47:13 +02:00
William Desportes 300ade5226 Merge #297 - Improve UPLOAD_LIMIT documentation 2020-07-31 23:44:12 +02:00
Thomas DecauxandGitHub 76651f53b3 Specify UPLOAD_LIMIT format
Default value format "2048Kb" will not work with Apache !
2020-07-31 15:35:37 +02:00
William Desportes 9d66e78f8a Merge #289 - Add SHA checksum when downloading a version
Signed-off-by: William Desportes <williamdes@wdes.fr>
2020-06-01 10:57:51 +02:00
William Desportes 85a642d7b3 Make sha256 fetching more strict
Signed-off-by: William Desportes <williamdes@wdes.fr>
2020-06-01 10:56:52 +02:00
J0WI 6e3aeb3adf Update generate-stackbrew-library.sh 2020-05-16 03:07:45 +02:00
William Desportes c0b2ac28f9 Merge #288 - Use same "latest" procedure as in update.sh
Signed-off-by: William Desportes <williamdes@wdes.fr>
2020-05-09 17:46:43 +02:00
J0WI 52d6fe4caf Use same "latest" procedure as in update.sh 2020-05-08 04:46:46 +02:00
J0WI f464cf5a67 Add SHA checksum 2020-05-08 04:44:41 +02:00
William Desportes d1f2dea243 Revert 490df186e5
This commit is no more needed because 27f6f7e5ae fixed the tag process

Signed-off-by: William Desportes <williamdes@wdes.fr>
2020-05-07 09:48:08 +02:00
William Desportes 27f6f7e5ae Fix parsing each revision on generate-stackbrew-library.sh
Signed-off-by: William Desportes <williamdes@wdes.fr>
2020-05-07 08:50:07 +02:00
William Desportes 490df186e5 Add each variant to the tag list
Signed-off-by: William Desportes <williamdes@wdes.fr>
2020-05-07 08:49:31 +02:00
William Desportes d826f3a721 Merge #286 - cleanup after review for #56
Partial revert of 6b63869f1c

Signed-off-by: William Desportes <williamdes@wdes.fr>
2020-05-07 08:30:07 +02:00
J0WI 12d40a0300 Cleanup according to review 2020-05-07 01:11:27 +02:00
William Desportes 48f16c0dde Update files after #285
Ref: https://github.com/phpmyadmin/docker/pull/285#issuecomment-612213968
2020-04-18 18:05:28 +02:00
Isaac BennetchandGitHub 0dbbe66eb3 Merge pull request #285 from ibennetch/webroot
Extract downloaded files directly to web root /var/www/html/
2020-04-18 11:30:12 -04:00
Isaac Bennetch 4d5c71ca6e Extract downloaded files directly to web root /var/www/html/
Fixes #277

Signed-off-by: Isaac Bennetch <bennetch@gmail.com>
2020-04-10 16:34:27 -04:00
Isaac BennetchandGitHub 459489d8c1 Merge pull request #283 from krufab/bugfix/281-added-tzdata-package
#281 Added tzdata also to the template alpine file
2020-03-29 13:57:44 -04:00
Fabio Kruger ac3c819a69 #281 Added tzdata also to the template alpine file
Signed-off-by: Fabio Kruger <krufab@gmail.com>
2020-03-29 19:15:03 +02:00
Isaac BennetchandGitHub 34c0696109 Merge pull request #282 from krufab/bugfix/281-added-tzdata-package
#281 Added tzdata package
2020-03-28 21:26:23 -04:00
Fabio Kruger 3a9dc863e2 #281 Added tzdata package
Signed-off-by: Fabio Kruger <krufab@gmail.com>
2020-03-27 23:16:29 +01:00
Isaac Bennetch 6c9a35dc6e Release 5.0.2
Signed-off-by: Isaac Bennetch <bennetch@gmail.com>
2020-03-21 00:44:01 -04:00
William Desportes 26be7daa0c Merge #275 - add some org.opencontainers.image.* labels
Pull-request: #275
2020-03-17 21:41:24 +01:00
William Desportes 6b63869f1c Add org.opencontainers.image.* labels
Licence: https://github.com/phpmyadmin/phpmyadmin/blob/master/composer.json
2020-03-17 21:37:29 +01:00
William Desportes a4071cd297 Merge #274 - apply some feedback from docker-library team
Pull-request: #274
2020-03-17 20:15:46 +01:00
J0WI e05baec603 Apply various minor enhancements 2020-03-17 18:16:01 +01:00
William Desportes 6cd68f9647 Fix generate-stackbrew-library.sh Maintainers format
Signed-off-by: William Desportes <williamdes@wdes.fr>
2020-01-16 23:16:05 +01:00
William Desportes 48f555eb3d Maintainer replacement
I put my name here because Michal Čihař resigned from phpMyAdmin
https://blog.cihar.com/archives/2019/05/29/spring-cleanup/
I hope this change is okay :)
[ci skip]
Signed-off-by: William Desportes <williamdes@wdes.fr>
2020-01-16 23:01:11 +01:00
Isaac Bennetch 8c9962be4f Release 5.0.1
Signed-off-by: Isaac Bennetch <bennetch@gmail.com>
2020-01-07 22:07:49 -05:00
Isaac Bennetch 30fea9d2f4 Add version 4.9.4
Signed-off-by: Isaac Bennetch <bennetch@gmail.com>
2020-01-07 22:06:55 -05:00
Isaac Bennetch c850d7ece9 Release 5.0.1
Signed-off-by: Isaac Bennetch <bennetch@gmail.com>
2020-01-07 21:55:13 -05:00
Isaac Bennetch 8917fb7bc2 Update to phpMyAdmin release 5.0.0
Signed-off-by: Isaac Bennetch <bennetch@gmail.com>
2020-01-01 22:22:25 -05:00
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
Isaac Bennetch 6d26530177 Update to phpMyAdmin release 5.0.0
Signed-off-by: Isaac Bennetch <bennetch@gmail.com>
2019-12-26 12:20:27 -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
Isaac Bennetch 41ef7ee430 Upgrade to phpMyAdmin version 4.9.0.1
Signed-off-by: Isaac Bennetch <bennetch@gmail.com>
2019-06-04 12:36:40 -04:00
William Desportes 33fc40f4a3 Merge pull-request #222 (remove .dockerignore)
Signed-off-by: William Desportes <williamdes@wdes.fr>
2019-05-22 18:37:52 +02:00
William Desportes 219e173c5e Merge pull-request #225 (clean unused files)
Signed-off-by: William Desportes <williamdes@wdes.fr>
2019-05-22 18:21:48 +02:00
J0WI f30ef539da Cleanup obsolete files 2019-05-22 16:57:57 +02:00
J0WI 036fd21c08 Remove .dockerignore 2019-04-24 19:50:44 +02:00
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
J0WIandIsaac Bennetch 78e3cb7aba Refactor Dockerfile to support multiple variants and drop supervisord (#200)
* Refactor Dockerfile to support multiple variants and drop supervisord
* Rename run.sh to docker-entrypoint.sh
* Update tests for apache conatiner
* Fix tests in conatiner
* Fix database startup
* Update Makefile to build all variants
* Update phpMyAdmin to 4.8.4
* Rebase on top of v4.8.5
2019-03-29 03:48:30 -04:00
Isaac Bennetch a114733200 Update to version 4.8.5
Signed-off-by: Isaac Bennetch <bennetch@gmail.com>
2019-01-25 22:52:24 -05:00
Isaac BennetchandGitHub 967db65940 Merge pull request #201 from J0WI/travis-nosudo
[Travis CI] Drop sudo and use default distro
2018-12-30 08:48:14 -05:00
Isaac Bennetch 921f2867f7 Updated version information to remove old, unsupported releases.
Signed-off-by: Isaac Bennetch <bennetch@gmail.com>
2018-12-30 06:46:42 -07:00
Isaac BennetchandGitHub df7df179f2 Merge pull request #202 from glensc/patch-1
Add 4.8 tag to README
2018-12-30 08:37:10 -05:00
Elan RuusamäeandGitHub 0e87cd4731 readme: 4.8 tag is also present
for ones that prefer not to have unexpected version update (but patches are ok), prefer `X.Y` docker tag over `latest`.

improve wording as technically there is no 4.8 branch yet
2018-12-19 11:55:56 +02:00
J0WI c775ef93dc Drop sudo and use default distro 2018-11-25 17:21:33 +01:00
35 changed files with 1632 additions and 481 deletions
-7
View File
@@ -1,7 +0,0 @@
.travis.yml
docker-compose.yml
docker-compose.testing.yml
README.md
LICENSE
Makefile
testing
+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 -33
View File
@@ -1,45 +1,90 @@
dist: trusty
sudo: required
services:
- docker
language: python
python:
- "2.7"
python: 2.7
dist: bionic
env:
matrix:
- DB=mysql:latest
- DB=mariadb:10.2
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 .
# 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 phpmyadmin
- ./testing/wait-for-testing.sh
_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 apache
# Test for single database
- docker run --name testadmin -d --link db_server:db -p 9090:80 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
- ./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
- ./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
- ./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 apache
- <<: *build-image
name: "fpm amd64"
arch: amd64
script:
- docker build -t phpmyadmin fpm
- <<: *build-image
name: "fpm-alpine amd64"
arch: amd64
script:
- docker build -t 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
-74
View File
@@ -1,74 +0,0 @@
FROM php:7.2-fpm-alpine
RUN apk add --no-cache \
nginx \
supervisor
# Install dependencies
RUN set -ex; \
\
apk add --no-cache --virtual .build-deps \
bzip2-dev \
freetype-dev \
libjpeg-turbo-dev \
libpng-dev \
libwebp-dev \
libxpm-dev \
; \
\
docker-php-ext-configure gd --with-freetype-dir=/usr --with-jpeg-dir=/usr --with-webp-dir=/usr --with-png-dir=/usr --with-xpm-dir=/usr; \
docker-php-ext-install bz2 gd mysqli opcache zip; \
\
runDeps="$( \
scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/lib/php/extensions \
| tr ',' '\n' \
| sort -u \
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
)"; \
apk add --virtual .phpmyadmin-phpexts-rundeps $runDeps; \
apk del .build-deps
# Calculate download URL
ENV VERSION 4.8.4
ENV URL https://files.phpmyadmin.net/phpMyAdmin/${VERSION}/phpMyAdmin-${VERSION}-all-languages.tar.xz
LABEL version=$VERSION
# Download tarball, verify it using gpg and extract
RUN set -ex; \
apk add --no-cache --virtual .fetch-deps \
gnupg \
; \
\
export GNUPGHOME="$(mktemp -d)"; \
export GPGKEY="3D06A59ECE730EB71B511C17CE752F178259BD92"; \
curl --output phpMyAdmin.tar.xz --location $URL; \
curl --output phpMyAdmin.tar.xz.asc --location $URL.asc; \
gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPGKEY" \
|| gpg --batch --keyserver ipv4.pool.sks-keyservers.net --recv-keys "$GPGKEY" \
|| gpg --batch --keyserver keys.gnupg.net --recv-keys "$GPGKEY" \
|| gpg --batch --keyserver pgp.mit.edu --recv-keys "$GPGKEY" \
|| gpg --batch --keyserver keyserver.pgp.com --recv-keys "$GPGKEY"; \
gpg --batch --verify phpMyAdmin.tar.xz.asc phpMyAdmin.tar.xz; \
tar -xf phpMyAdmin.tar.xz -C /usr/src; \
gpgconf --kill all; \
rm -r "$GNUPGHOME" phpMyAdmin.tar.xz phpMyAdmin.tar.xz.asc; \
mv /usr/src/phpMyAdmin-$VERSION-all-languages /usr/src/phpmyadmin; \
rm -rf /usr/src/phpmyadmin/setup/ /usr/src/phpmyadmin/examples/ /usr/src/phpmyadmin/test/ /usr/src/phpmyadmin/po/ /usr/src/phpmyadmin/composer.json /usr/src/phpmyadmin/RELEASE-DATE-$VERSION; \
sed -i "s@define('CONFIG_DIR'.*@define('CONFIG_DIR', '/etc/phpmyadmin/');@" /usr/src/phpmyadmin/libraries/vendor_config.php; \
# Add directory for sessions to allow session persistence
mkdir /sessions; \
mkdir -p /var/nginx/client_body_temp; \
apk del .fetch-deps
# Copy configuration
COPY etc /etc/
COPY php.ini /usr/local/etc/php/conf.d/php-phpmyadmin.ini
# Copy main script
COPY run.sh /run.sh
# We expose phpMyAdmin on port 80
EXPOSE 80
ENTRYPOINT [ "/run.sh" ]
CMD ["supervisord", "-n", "-j", "/supervisord.pid"]
+110
View File
@@ -0,0 +1,110 @@
FROM php:7.4-%%VARIANT%%
# docker-entrypoint.sh dependencies
RUN apk add --no-cache \
bash \
tzdata
# Install dependencies
RUN set -ex; \
\
apk add --no-cache --virtual .build-deps \
bzip2-dev \
freetype-dev \
libjpeg-turbo-dev \
libpng-dev \
libwebp-dev \
libxpm-dev \
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 \
; \
\
runDeps="$( \
scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/lib/php/extensions \
| tr ',' '\n' \
| sort -u \
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
)"; \
apk add --virtual .phpmyadmin-phpexts-rundeps $runDeps; \
apk del --no-network .build-deps
# set recommended PHP.ini settings
# see https://secure.php.net/manual/en/opcache.installation.php
RUN set -ex; \
\
{ \
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 %%VERSION%%
ENV SHA256 %%SHA256%%
ENV URL https://files.phpmyadmin.net/phpMyAdmin/${VERSION}/phpMyAdmin-${VERSION}-all-languages.tar.xz
LABEL org.opencontainers.image.title="Official phpMyAdmin Docker image" \
org.opencontainers.image.description="Run phpMyAdmin with Alpine, Apache and PHP FPM." \
org.opencontainers.image.authors="The phpMyAdmin Team <developers@phpmyadmin.net>" \
org.opencontainers.image.vendor="phpMyAdmin" \
org.opencontainers.image.documentation="https://github.com/phpmyadmin/docker#readme" \
org.opencontainers.image.licenses="GPL-2.0-only" \
org.opencontainers.image.version="${VERSION}" \
org.opencontainers.image.url="https://github.com/phpmyadmin/docker#readme" \
org.opencontainers.image.source="https://github.com/phpmyadmin/docker.git"
# Download tarball, verify it using gpg and extract
RUN set -ex; \
apk add --no-cache --virtual .fetch-deps \
gnupg \
; \
\
export GNUPGHOME="$(mktemp -d)"; \
export GPGKEY="3D06A59ECE730EB71B511C17CE752F178259BD92"; \
curl -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 pgp.mit.edu --recv-keys "$GPGKEY" \
|| gpg --batch --keyserver keyserver.pgp.com --recv-keys "$GPGKEY"; \
gpg --batch --verify phpMyAdmin.tar.xz.asc phpMyAdmin.tar.xz; \
tar -xf phpMyAdmin.tar.xz -C /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; \
apk del --no-network .fetch-deps
# Copy configuration
COPY config.inc.php /etc/phpmyadmin/config.inc.php
# Copy main script
COPY docker-entrypoint.sh /docker-entrypoint.sh
ENTRYPOINT [ "/docker-entrypoint.sh" ]
CMD ["%%CMD%%"]
+121
View File
@@ -0,0 +1,121 @@
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 \
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 set -ex; \
\
{ \
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 %%VERSION%%
ENV SHA256 %%SHA256%%
ENV URL https://files.phpmyadmin.net/phpMyAdmin/${VERSION}/phpMyAdmin-${VERSION}-all-languages.tar.xz
LABEL org.opencontainers.image.title="Official phpMyAdmin Docker image" \
org.opencontainers.image.description="Run phpMyAdmin with Alpine, Apache and PHP FPM." \
org.opencontainers.image.authors="The phpMyAdmin Team <developers@phpmyadmin.net>" \
org.opencontainers.image.vendor="phpMyAdmin" \
org.opencontainers.image.documentation="https://github.com/phpmyadmin/docker#readme" \
org.opencontainers.image.licenses="GPL-2.0-only" \
org.opencontainers.image.version="${VERSION}" \
org.opencontainers.image.url="https://github.com/phpmyadmin/docker#readme" \
org.opencontainers.image.source="https://github.com/phpmyadmin/docker.git"
# Download tarball, verify it using gpg and extract
RUN set -ex; \
\
savedAptMark="$(apt-mark showmanual)"; \
\
apt-get update; \
apt-get install -y --no-install-recommends \
gnupg \
dirmngr \
; \
\
export GNUPGHOME="$(mktemp -d)"; \
export GPGKEY="3D06A59ECE730EB71B511C17CE752F178259BD92"; \
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 pgp.mit.edu --recv-keys "$GPGKEY" \
|| gpg --batch --keyserver keyserver.pgp.com --recv-keys "$GPGKEY"; \
gpg --batch --verify phpMyAdmin.tar.xz.asc phpMyAdmin.tar.xz; \
tar -xf phpMyAdmin.tar.xz -C /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; \
\
apt-mark auto '.*' > /dev/null; \
apt-mark manual $savedAptMark; \
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
rm -rf /var/lib/apt/lists/*
# Copy configuration
COPY config.inc.php /etc/phpmyadmin/config.inc.php
# Copy main script
COPY docker-entrypoint.sh /docker-entrypoint.sh
ENTRYPOINT [ "/docker-entrypoint.sh" ]
CMD ["%%CMD%%"]
+14 -6
View File
@@ -1,18 +1,26 @@
DOCKER_REPO = phpmyadmin/phpmyadmin
DOCKER_REPO = 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
build:
docker build -t ${DOCKER_REPO}:testing .
build: build-apache build-fpm build-fpm-alpine
build_nc:
docker build --no-cache=true -t ${DOCKER_REPO}:testing .
build-apache:
docker build ${DOCKER_FLAGS} -t ${DOCKER_REPO}:testing apache
build-fpm:
docker build ${DOCKER_FLAGS} -t ${DOCKER_REPO}:testing-fpm fpm
build-fpm-alpine:
docker build ${DOCKER_FLAGS} -t ${DOCKER_REPO}:testing-fpm-alpine fpm-alpine
run:
docker-compose -f docker-compose.testing.yml up -d
run-tests:
docker-compose exec phpmyadmin /test-docker.sh phpmyadmin_testing 80 phpmyadmin_testing_db
logs:
docker-compose -f docker-compose.testing.yml logs
+60 -22
View File
@@ -1,12 +1,21 @@
# 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]
[![Docker Stars](https://img.shields.io/docker/stars/phpmyadmin/phpmyadmin.svg)][hub]
[![Docker Layers](https://images.microbadger.com/badges/image/phpmyadmin/phpmyadmin.svg)](https://microbadger.com/images/phpmyadmin/phpmyadmin "Get your own image badge on microbadger.com")
[![Docker Version](https://images.microbadger.com/badges/version/phpmyadmin/phpmyadmin.svg)](https://microbadger.com/images/phpmyadmin/phpmyadmin "Get your own version badge on microbadger.com")
[![Build Status Travis](https://travis-ci.org/phpmyadmin/docker.svg?branch=master)](https://travis-ci.org/phpmyadmin/docker)
[![amd64 build status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/multiarch/job/amd64/job/phpmyadmin.svg?label=amd64)](https://doi-janky.infosiftr.net/job/multiarch/job/amd64/job/phpmyadmin)
[![arm32v5 build status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/multiarch/job/arm32v5/job/phpmyadmin.svg?label=arm32v5)](https://doi-janky.infosiftr.net/job/multiarch/job/arm32v5/job/phpmyadmin)
[![arm32v6 build status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/multiarch/job/arm32v6/job/phpmyadmin.svg?label=arm32v6)](https://doi-janky.infosiftr.net/job/multiarch/job/arm32v6/job/phpmyadmin)
[![arm32v7 build status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/multiarch/job/arm32v7/job/phpmyadmin.svg?label=arm32v7)](https://doi-janky.infosiftr.net/job/multiarch/job/arm32v7/job/phpmyadmin)
[![arm64v8 build status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/multiarch/job/arm64v8/job/phpmyadmin.svg?label=arm64v8)](https://doi-janky.infosiftr.net/job/multiarch/job/arm64v8/job/phpmyadmin)
[![i386 build status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/multiarch/job/i386/job/phpmyadmin.svg?label=i386)](https://doi-janky.infosiftr.net/job/multiarch/job/i386/job/phpmyadmin)
[![mips64le build status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/multiarch/job/mips64le/job/phpmyadmin.svg?label=mips64le)](https://doi-janky.infosiftr.net/job/multiarch/job/mips64le/job/phpmyadmin)
[![ppc64le build status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/multiarch/job/ppc64le/job/phpmyadmin.svg?label=ppc64le)](https://doi-janky.infosiftr.net/job/multiarch/job/ppc64le/job/phpmyadmin)
[![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 following examples will bring you phpMyAdmin on `http://localhost:8080`
@@ -22,16 +31,27 @@ 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.6` - latest stable release from the 4.6 branch
* `4.7` - latest stable release from the 4.7 branch
* `edge` - bleeding edge docker image (contains stable phpMyAdmin, but the Docker image changes might not yet be fully tested)
* `edge-4.7` - bleeding edge docker image + latest snapshots from 4.7 branch
* `edge-4.8` - bleeding edge docker image + latest snapshots from 4.8 branch (currently master)
* `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`
A complete list of tags is [available at Docker Hub](https://hub.docker.com/_/phpmyadmin?tab=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
@@ -39,7 +59,7 @@ First you need to run MySQL or MariaDB server in Docker, and this image need
link a running mysql instance container:
```
docker run --name myadmin -d --link mysql_db_server:db -p 8080:80 phpmyadmin/phpmyadmin
docker run --name myadmin -d --link mysql_db_server:db -p 8080:80 phpmyadmin
```
## Usage with external server
@@ -48,7 +68,7 @@ You can specify MySQL host in the `PMA_HOST` environment variable. You can also
use `PMA_PORT` to specify port of the server in case it's not the default one:
```
docker run --name myadmin -d -e PMA_HOST=dbhost -p 8080:80 phpmyadmin/phpmyadmin
docker run --name myadmin -d -e PMA_HOST=dbhost -p 8080:80 phpmyadmin
```
## Usage with arbitrary server
@@ -56,7 +76,7 @@ docker run --name myadmin -d -e PMA_HOST=dbhost -p 8080:80 phpmyadmin/phpmyadmin
You can use arbitrary servers by adding ENV variable `PMA_ARBITRARY=1` to the startup command:
```
docker run --name myadmin -d -e PMA_ARBITRARY=1 -p 8080:80 phpmyadmin/phpmyadmin
docker run --name myadmin -d -e PMA_ARBITRARY=1 -p 8080:80 phpmyadmin
```
## Usage with docker-compose and arbitrary server
@@ -82,16 +102,16 @@ 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
```
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
```
See the following links for config file information.
@@ -113,9 +133,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 (format as `[0-9+](K,M,G)` default value is 2048K, this will change ``upload_max_filesize`` and ``post_max_size`` values)
* ``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
```
#### 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/
[hub]: https://hub.docker.com/_/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
+121
View File
@@ -0,0 +1,121 @@
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 \
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 set -ex; \
\
{ \
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 5.0.4
ENV SHA256 1578c1a08e594da4f4f62e676ccbdbd17784c3de769b094ba42c35bf05c057db
ENV URL https://files.phpmyadmin.net/phpMyAdmin/${VERSION}/phpMyAdmin-${VERSION}-all-languages.tar.xz
LABEL org.opencontainers.image.title="Official phpMyAdmin Docker image" \
org.opencontainers.image.description="Run phpMyAdmin with Alpine, Apache and PHP FPM." \
org.opencontainers.image.authors="The phpMyAdmin Team <developers@phpmyadmin.net>" \
org.opencontainers.image.vendor="phpMyAdmin" \
org.opencontainers.image.documentation="https://github.com/phpmyadmin/docker#readme" \
org.opencontainers.image.licenses="GPL-2.0-only" \
org.opencontainers.image.version="${VERSION}" \
org.opencontainers.image.url="https://github.com/phpmyadmin/docker#readme" \
org.opencontainers.image.source="https://github.com/phpmyadmin/docker.git"
# Download tarball, verify it using gpg and extract
RUN set -ex; \
\
savedAptMark="$(apt-mark showmanual)"; \
\
apt-get update; \
apt-get install -y --no-install-recommends \
gnupg \
dirmngr \
; \
\
export GNUPGHOME="$(mktemp -d)"; \
export GPGKEY="3D06A59ECE730EB71B511C17CE752F178259BD92"; \
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 pgp.mit.edu --recv-keys "$GPGKEY" \
|| gpg --batch --keyserver keyserver.pgp.com --recv-keys "$GPGKEY"; \
gpg --batch --verify phpMyAdmin.tar.xz.asc phpMyAdmin.tar.xz; \
tar -xf phpMyAdmin.tar.xz -C /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; \
\
apt-mark auto '.*' > /dev/null; \
apt-mark manual $savedAptMark; \
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
rm -rf /var/lib/apt/lists/*
# Copy configuration
COPY config.inc.php /etc/phpmyadmin/config.inc.php
# Copy main script
COPY docker-entrypoint.sh /docker-entrypoint.sh
ENTRYPOINT [ "/docker-entrypoint.sh" ]
CMD ["apache2-foreground"]
+55
View File
@@ -0,0 +1,55 @@
#!/bin/bash
if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
if [ ! -f /etc/phpmyadmin/config.secret.inc.php ]; then
cat > /etc/phpmyadmin/config.secret.inc.php <<EOT
<?php
\$cfg['blowfish_secret'] = '$(tr -dc 'a-zA-Z0-9~!@#$%^&*_()+}{?></";.,[]=-' < /dev/urandom | fold -w 32 | head -n 1)';
EOT
fi
if [ ! -f /etc/phpmyadmin/config.user.inc.php ]; then
touch /etc/phpmyadmin/config.user.inc.php
fi
fi
if [ ! -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
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 "$@"
+137
View File
@@ -0,0 +1,137 @@
<?php
require('/etc/phpmyadmin/config.secret.inc.php');
/* Ensure we got the environment */
$vars = array(
'PMA_ARBITRARY',
'PMA_HOST',
'PMA_HOSTS',
'PMA_VERBOSE',
'PMA_VERBOSES',
'PMA_PORT',
'PMA_PORTS',
'PMA_SOCKET',
'PMA_SOCKETS',
'PMA_USER',
'PMA_PASSWORD',
'PMA_ABSOLUTE_URI',
'PMA_CONTROLHOST',
'PMA_CONTROLPORT',
'PMA_PMADB',
'PMA_CONTROLUSER',
'PMA_CONTROLPASS',
'PMA_QUERYHISTORYDB'
);
foreach ($vars as $var) {
$env = getenv($var);
if (!isset($_ENV[$var]) && $env !== false) {
$_ENV[$var] = $env;
}
}
if (isset($_ENV['PMA_QUERYHISTORYDB'])) {
$cfg['QueryHistoryDB'] = boolval($_ENV['PMA_QUERYHISTORYDB']);
}
/* Arbitrary server connection */
if (isset($_ENV['PMA_ARBITRARY']) && $_ENV['PMA_ARBITRARY'] === '1') {
$cfg['AllowArbitraryServer'] = true;
}
/* Play nice behind reverse proxys */
if (isset($_ENV['PMA_ABSOLUTE_URI'])) {
$cfg['PmaAbsoluteUri'] = trim($_ENV['PMA_ABSOLUTE_URI']);
}
/* Figure out hosts */
/* Fallback to default linked */
$hosts = array('db');
/* Set by environment */
if (!empty($_ENV['PMA_HOST'])) {
$hosts = array($_ENV['PMA_HOST']);
$verbose = array($_ENV['PMA_VERBOSE']);
$ports = array($_ENV['PMA_PORT']);
} elseif (!empty($_ENV['PMA_HOSTS'])) {
$hosts = array_map('trim', explode(',', $_ENV['PMA_HOSTS']));
$verbose = array_map('trim', explode(',', $_ENV['PMA_VERBOSES']));
$ports = array_map('trim', explode(',', $_ENV['PMA_PORTS']));
}
if (!empty($_ENV['PMA_SOCKET'])) {
$sockets = array($_ENV['PMA_SOCKET']);
} elseif (!empty($_ENV['PMA_SOCKETS'])) {
$sockets = explode(',', $_ENV['PMA_SOCKETS']);
}
/* Server settings */
for ($i = 1; isset($hosts[$i - 1]); $i++) {
$cfg['Servers'][$i]['host'] = $hosts[$i - 1];
if (isset($verbose[$i - 1])) {
$cfg['Servers'][$i]['verbose'] = $verbose[$i - 1];
}
if (isset($ports[$i - 1])) {
$cfg['Servers'][$i]['port'] = $ports[$i - 1];
}
if (isset($_ENV['PMA_USER'])) {
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = $_ENV['PMA_USER'];
$cfg['Servers'][$i]['password'] = isset($_ENV['PMA_PASSWORD']) ? $_ENV['PMA_PASSWORD'] : '';
} else {
$cfg['Servers'][$i]['auth_type'] = 'cookie';
}
if (isset($_ENV['PMA_PMADB'])) {
$cfg['Servers'][$i]['pmadb'] = $_ENV['PMA_PMADB'];
$cfg['Servers'][$i]['relation'] = 'pma__relation';
$cfg['Servers'][$i]['table_info'] = 'pma__table_info';
$cfg['Servers'][$i]['table_coords'] = 'pma__table_coords';
$cfg['Servers'][$i]['pdf_pages'] = 'pma__pdf_pages';
$cfg['Servers'][$i]['column_info'] = 'pma__column_info';
$cfg['Servers'][$i]['bookmarktable'] = 'pma__bookmark';
$cfg['Servers'][$i]['history'] = 'pma__history';
$cfg['Servers'][$i]['recent'] = 'pma__recent';
$cfg['Servers'][$i]['favorite'] = 'pma__favorite';
$cfg['Servers'][$i]['table_uiprefs'] = 'pma__table_uiprefs';
$cfg['Servers'][$i]['tracking'] = 'pma__tracking';
$cfg['Servers'][$i]['userconfig'] = 'pma__userconfig';
$cfg['Servers'][$i]['users'] = 'pma__users';
$cfg['Servers'][$i]['usergroups'] = 'pma__usergroups';
$cfg['Servers'][$i]['navigationhiding'] = 'pma__navigationhiding';
$cfg['Servers'][$i]['savedsearches'] = 'pma__savedsearches';
$cfg['Servers'][$i]['central_columns'] = 'pma__central_columns';
$cfg['Servers'][$i]['designer_settings'] = 'pma__designer_settings';
$cfg['Servers'][$i]['export_templates'] = 'pma__export_templates';
}
if (isset($_ENV['PMA_CONTROLHOST'])) {
$cfg['Servers'][$i]['controlhost'] = $_ENV['PMA_CONTROLHOST'];
}
if (isset($_ENV['PMA_CONTROLPORT'])) {
$cfg['Servers'][$i]['controlport'] = $_ENV['PMA_CONTROLPORT'];
}
if (isset($_ENV['PMA_CONTROLUSER'])) {
$cfg['Servers'][$i]['controluser'] = $_ENV['PMA_CONTROLUSER'];
}
if (isset($_ENV['PMA_CONTROLPASS'])) {
$cfg['Servers'][$i]['controlpass'] = $_ENV['PMA_CONTROLPASS'];
}
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['AllowNoPassword'] = true;
}
for ($i = 1; isset($sockets[$i - 1]); $i++) {
$cfg['Servers'][$i]['socket'] = $sockets[$i - 1];
$cfg['Servers'][$i]['host'] = 'localhost';
}
/*
* Revert back to last configured server to make
* it easier in config.user.inc.php
*/
$i--;
/* Uploads setup */
$cfg['UploadDir'] = '';
$cfg['SaveDir'] = '';
/* Include User Defined Settings Hook */
if (file_exists('/etc/phpmyadmin/config.user.inc.php')) {
include('/etc/phpmyadmin/config.user.inc.php');
}
+11 -5
View File
@@ -1,13 +1,15 @@
version: '2'
version: '3.1'
services:
db_server:
image: ${DB}
container_name: phpmyadmin_testing_mariadb
image: ${DB:-mariadb:10.3}
container_name: phpmyadmin_testing_db
environment:
- MYSQL_ROOT_PASSWORD=test123
- 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:
@@ -15,10 +17,14 @@ services:
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=test123
- TESTSUITE_PASSWORD=${TESTSUITE_PASSWORD:-my-secret-pw}
depends_on:
- db_server
+1 -1
View File
@@ -1,5 +1,5 @@
phpmyadmin:
image: phpmyadmin/phpmyadmin
image: phpmyadmin
container_name: phpmyadmin
environment:
- PMA_ARBITRARY=1
+55
View File
@@ -0,0 +1,55 @@
#!/bin/bash
if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
if [ ! -f /etc/phpmyadmin/config.secret.inc.php ]; then
cat > /etc/phpmyadmin/config.secret.inc.php <<EOT
<?php
\$cfg['blowfish_secret'] = '$(tr -dc 'a-zA-Z0-9~!@#$%^&*_()+}{?></";.,[]=-' < /dev/urandom | fold -w 32 | head -n 1)';
EOT
fi
if [ ! -f /etc/phpmyadmin/config.user.inc.php ]; then
touch /etc/phpmyadmin/config.user.inc.php
fi
fi
if [ ! -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
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 "$@"
-131
View File
@@ -1,131 +0,0 @@
worker_processes 4;
daemon off;
pid /nginx.pid;
error_log /var/log/nginx-error.log;
events {
worker_connections 1024;
}
http {
types {
text/html html htm shtml;
text/css css;
text/xml xml;
image/gif gif;
image/jpeg jpeg jpg;
application/javascript js;
application/atom+xml atom;
application/rss+xml rss;
}
default_type application/octet-stream;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
client_body_timeout 12;
client_header_timeout 12;
keepalive_timeout 15;
send_timeout 10;
server_tokens off;
client_body_buffer_size 512K;
client_body_temp_path /var/nginx/client_body_temp;
client_header_buffer_size 16k;
client_max_body_size 512M;
large_client_header_buffers 4 8k;
gzip on;
gzip_comp_level 2;
gzip_min_length 1000;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain application/x-javascript text/xml text/css application/xml;
access_log off;
server {
listen 80 default_server;
server_name _;
root /var/www/html;
index index.php index.html index.htm;
charset utf-8;
if ($request_method !~ ^(GET|HEAD|POST)$ ) {
return 405;
}
location / {
try_files $uri $uri/ =404;
}
location ~* .(jpg|jpeg|png|gif|ico|css|js)$ {
expires 365d;
}
location ~ \.php$ {
fastcgi_intercept_errors on;
fastcgi_pass 127.0.0.1:9000;
# regex to split $uri to $fastcgi_script_name and $fastcgi_path
fastcgi_split_path_info ^(.+\.php)(/.+)$;
# Check that the PHP script exists before passing it
try_files $fastcgi_script_name =404;
# Bypass the fact that try_files resets $fastcgi_path_info
# see: https://trac.nginx.org/nginx/ticket/321
set $path_info $fastcgi_path_info;
fastcgi_param PATH_INFO $path_info;
fastcgi_read_timeout 1200;
fastcgi_buffering off;
fastcgi_buffers 16 16k;
fastcgi_buffer_size 32k;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param REQUEST_SCHEME $scheme;
fastcgi_param HTTPS $https if_not_empty;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param REDIRECT_STATUS 200;
}
location ~ /\. {
deny all;
}
location ~ /(libraries|templates) {
deny all;
}
}
}
-12
View File
@@ -1,12 +0,0 @@
[program:nginx]
command=nginx -c /etc/nginx.conf
autostart=true
autorestart=true
priority=2
startretries=3
stopwaitsecs=10
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
-12
View File
@@ -1,12 +0,0 @@
[program:php-fpm]
command=php-fpm --nodaemonize --fpm-config /usr/local/etc/php-fpm.conf
autostart=true
autorestart=true
priority=1
startretries=3
stopwaitsecs=10
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
+110
View File
@@ -0,0 +1,110 @@
FROM php:7.4-fpm-alpine
# docker-entrypoint.sh dependencies
RUN apk add --no-cache \
bash \
tzdata
# Install dependencies
RUN set -ex; \
\
apk add --no-cache --virtual .build-deps \
bzip2-dev \
freetype-dev \
libjpeg-turbo-dev \
libpng-dev \
libwebp-dev \
libxpm-dev \
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 \
; \
\
runDeps="$( \
scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/lib/php/extensions \
| tr ',' '\n' \
| sort -u \
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
)"; \
apk add --virtual .phpmyadmin-phpexts-rundeps $runDeps; \
apk del --no-network .build-deps
# set recommended PHP.ini settings
# see https://secure.php.net/manual/en/opcache.installation.php
RUN set -ex; \
\
{ \
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 5.0.4
ENV SHA256 1578c1a08e594da4f4f62e676ccbdbd17784c3de769b094ba42c35bf05c057db
ENV URL https://files.phpmyadmin.net/phpMyAdmin/${VERSION}/phpMyAdmin-${VERSION}-all-languages.tar.xz
LABEL org.opencontainers.image.title="Official phpMyAdmin Docker image" \
org.opencontainers.image.description="Run phpMyAdmin with Alpine, Apache and PHP FPM." \
org.opencontainers.image.authors="The phpMyAdmin Team <developers@phpmyadmin.net>" \
org.opencontainers.image.vendor="phpMyAdmin" \
org.opencontainers.image.documentation="https://github.com/phpmyadmin/docker#readme" \
org.opencontainers.image.licenses="GPL-2.0-only" \
org.opencontainers.image.version="${VERSION}" \
org.opencontainers.image.url="https://github.com/phpmyadmin/docker#readme" \
org.opencontainers.image.source="https://github.com/phpmyadmin/docker.git"
# Download tarball, verify it using gpg and extract
RUN set -ex; \
apk add --no-cache --virtual .fetch-deps \
gnupg \
; \
\
export GNUPGHOME="$(mktemp -d)"; \
export GPGKEY="3D06A59ECE730EB71B511C17CE752F178259BD92"; \
curl -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 pgp.mit.edu --recv-keys "$GPGKEY" \
|| gpg --batch --keyserver keyserver.pgp.com --recv-keys "$GPGKEY"; \
gpg --batch --verify phpMyAdmin.tar.xz.asc phpMyAdmin.tar.xz; \
tar -xf phpMyAdmin.tar.xz -C /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; \
apk del --no-network .fetch-deps
# Copy configuration
COPY config.inc.php /etc/phpmyadmin/config.inc.php
# Copy main script
COPY docker-entrypoint.sh /docker-entrypoint.sh
ENTRYPOINT [ "/docker-entrypoint.sh" ]
CMD ["php-fpm"]
+137
View File
@@ -0,0 +1,137 @@
<?php
require('/etc/phpmyadmin/config.secret.inc.php');
/* Ensure we got the environment */
$vars = array(
'PMA_ARBITRARY',
'PMA_HOST',
'PMA_HOSTS',
'PMA_VERBOSE',
'PMA_VERBOSES',
'PMA_PORT',
'PMA_PORTS',
'PMA_SOCKET',
'PMA_SOCKETS',
'PMA_USER',
'PMA_PASSWORD',
'PMA_ABSOLUTE_URI',
'PMA_CONTROLHOST',
'PMA_CONTROLPORT',
'PMA_PMADB',
'PMA_CONTROLUSER',
'PMA_CONTROLPASS',
'PMA_QUERYHISTORYDB'
);
foreach ($vars as $var) {
$env = getenv($var);
if (!isset($_ENV[$var]) && $env !== false) {
$_ENV[$var] = $env;
}
}
if (isset($_ENV['PMA_QUERYHISTORYDB'])) {
$cfg['QueryHistoryDB'] = boolval($_ENV['PMA_QUERYHISTORYDB']);
}
/* Arbitrary server connection */
if (isset($_ENV['PMA_ARBITRARY']) && $_ENV['PMA_ARBITRARY'] === '1') {
$cfg['AllowArbitraryServer'] = true;
}
/* Play nice behind reverse proxys */
if (isset($_ENV['PMA_ABSOLUTE_URI'])) {
$cfg['PmaAbsoluteUri'] = trim($_ENV['PMA_ABSOLUTE_URI']);
}
/* Figure out hosts */
/* Fallback to default linked */
$hosts = array('db');
/* Set by environment */
if (!empty($_ENV['PMA_HOST'])) {
$hosts = array($_ENV['PMA_HOST']);
$verbose = array($_ENV['PMA_VERBOSE']);
$ports = array($_ENV['PMA_PORT']);
} elseif (!empty($_ENV['PMA_HOSTS'])) {
$hosts = array_map('trim', explode(',', $_ENV['PMA_HOSTS']));
$verbose = array_map('trim', explode(',', $_ENV['PMA_VERBOSES']));
$ports = array_map('trim', explode(',', $_ENV['PMA_PORTS']));
}
if (!empty($_ENV['PMA_SOCKET'])) {
$sockets = array($_ENV['PMA_SOCKET']);
} elseif (!empty($_ENV['PMA_SOCKETS'])) {
$sockets = explode(',', $_ENV['PMA_SOCKETS']);
}
/* Server settings */
for ($i = 1; isset($hosts[$i - 1]); $i++) {
$cfg['Servers'][$i]['host'] = $hosts[$i - 1];
if (isset($verbose[$i - 1])) {
$cfg['Servers'][$i]['verbose'] = $verbose[$i - 1];
}
if (isset($ports[$i - 1])) {
$cfg['Servers'][$i]['port'] = $ports[$i - 1];
}
if (isset($_ENV['PMA_USER'])) {
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = $_ENV['PMA_USER'];
$cfg['Servers'][$i]['password'] = isset($_ENV['PMA_PASSWORD']) ? $_ENV['PMA_PASSWORD'] : '';
} else {
$cfg['Servers'][$i]['auth_type'] = 'cookie';
}
if (isset($_ENV['PMA_PMADB'])) {
$cfg['Servers'][$i]['pmadb'] = $_ENV['PMA_PMADB'];
$cfg['Servers'][$i]['relation'] = 'pma__relation';
$cfg['Servers'][$i]['table_info'] = 'pma__table_info';
$cfg['Servers'][$i]['table_coords'] = 'pma__table_coords';
$cfg['Servers'][$i]['pdf_pages'] = 'pma__pdf_pages';
$cfg['Servers'][$i]['column_info'] = 'pma__column_info';
$cfg['Servers'][$i]['bookmarktable'] = 'pma__bookmark';
$cfg['Servers'][$i]['history'] = 'pma__history';
$cfg['Servers'][$i]['recent'] = 'pma__recent';
$cfg['Servers'][$i]['favorite'] = 'pma__favorite';
$cfg['Servers'][$i]['table_uiprefs'] = 'pma__table_uiprefs';
$cfg['Servers'][$i]['tracking'] = 'pma__tracking';
$cfg['Servers'][$i]['userconfig'] = 'pma__userconfig';
$cfg['Servers'][$i]['users'] = 'pma__users';
$cfg['Servers'][$i]['usergroups'] = 'pma__usergroups';
$cfg['Servers'][$i]['navigationhiding'] = 'pma__navigationhiding';
$cfg['Servers'][$i]['savedsearches'] = 'pma__savedsearches';
$cfg['Servers'][$i]['central_columns'] = 'pma__central_columns';
$cfg['Servers'][$i]['designer_settings'] = 'pma__designer_settings';
$cfg['Servers'][$i]['export_templates'] = 'pma__export_templates';
}
if (isset($_ENV['PMA_CONTROLHOST'])) {
$cfg['Servers'][$i]['controlhost'] = $_ENV['PMA_CONTROLHOST'];
}
if (isset($_ENV['PMA_CONTROLPORT'])) {
$cfg['Servers'][$i]['controlport'] = $_ENV['PMA_CONTROLPORT'];
}
if (isset($_ENV['PMA_CONTROLUSER'])) {
$cfg['Servers'][$i]['controluser'] = $_ENV['PMA_CONTROLUSER'];
}
if (isset($_ENV['PMA_CONTROLPASS'])) {
$cfg['Servers'][$i]['controlpass'] = $_ENV['PMA_CONTROLPASS'];
}
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['AllowNoPassword'] = true;
}
for ($i = 1; isset($sockets[$i - 1]); $i++) {
$cfg['Servers'][$i]['socket'] = $sockets[$i - 1];
$cfg['Servers'][$i]['host'] = 'localhost';
}
/*
* Revert back to last configured server to make
* it easier in config.user.inc.php
*/
$i--;
/* Uploads setup */
$cfg['UploadDir'] = '';
$cfg['SaveDir'] = '';
/* Include User Defined Settings Hook */
if (file_exists('/etc/phpmyadmin/config.user.inc.php')) {
include('/etc/phpmyadmin/config.user.inc.php');
}
+55
View File
@@ -0,0 +1,55 @@
#!/bin/bash
if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
if [ ! -f /etc/phpmyadmin/config.secret.inc.php ]; then
cat > /etc/phpmyadmin/config.secret.inc.php <<EOT
<?php
\$cfg['blowfish_secret'] = '$(tr -dc 'a-zA-Z0-9~!@#$%^&*_()+}{?></";.,[]=-' < /dev/urandom | fold -w 32 | head -n 1)';
EOT
fi
if [ ! -f /etc/phpmyadmin/config.user.inc.php ]; then
touch /etc/phpmyadmin/config.user.inc.php
fi
fi
if [ ! -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
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 "$@"
+121
View File
@@ -0,0 +1,121 @@
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 \
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 set -ex; \
\
{ \
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 5.0.4
ENV SHA256 1578c1a08e594da4f4f62e676ccbdbd17784c3de769b094ba42c35bf05c057db
ENV URL https://files.phpmyadmin.net/phpMyAdmin/${VERSION}/phpMyAdmin-${VERSION}-all-languages.tar.xz
LABEL org.opencontainers.image.title="Official phpMyAdmin Docker image" \
org.opencontainers.image.description="Run phpMyAdmin with Alpine, Apache and PHP FPM." \
org.opencontainers.image.authors="The phpMyAdmin Team <developers@phpmyadmin.net>" \
org.opencontainers.image.vendor="phpMyAdmin" \
org.opencontainers.image.documentation="https://github.com/phpmyadmin/docker#readme" \
org.opencontainers.image.licenses="GPL-2.0-only" \
org.opencontainers.image.version="${VERSION}" \
org.opencontainers.image.url="https://github.com/phpmyadmin/docker#readme" \
org.opencontainers.image.source="https://github.com/phpmyadmin/docker.git"
# Download tarball, verify it using gpg and extract
RUN set -ex; \
\
savedAptMark="$(apt-mark showmanual)"; \
\
apt-get update; \
apt-get install -y --no-install-recommends \
gnupg \
dirmngr \
; \
\
export GNUPGHOME="$(mktemp -d)"; \
export GPGKEY="3D06A59ECE730EB71B511C17CE752F178259BD92"; \
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 pgp.mit.edu --recv-keys "$GPGKEY" \
|| gpg --batch --keyserver keyserver.pgp.com --recv-keys "$GPGKEY"; \
gpg --batch --verify phpMyAdmin.tar.xz.asc phpMyAdmin.tar.xz; \
tar -xf phpMyAdmin.tar.xz -C /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; \
\
apt-mark auto '.*' > /dev/null; \
apt-mark manual $savedAptMark; \
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
rm -rf /var/lib/apt/lists/*
# Copy configuration
COPY config.inc.php /etc/phpmyadmin/config.inc.php
# Copy main script
COPY docker-entrypoint.sh /docker-entrypoint.sh
ENTRYPOINT [ "/docker-entrypoint.sh" ]
CMD ["php-fpm"]
+137
View File
@@ -0,0 +1,137 @@
<?php
require('/etc/phpmyadmin/config.secret.inc.php');
/* Ensure we got the environment */
$vars = array(
'PMA_ARBITRARY',
'PMA_HOST',
'PMA_HOSTS',
'PMA_VERBOSE',
'PMA_VERBOSES',
'PMA_PORT',
'PMA_PORTS',
'PMA_SOCKET',
'PMA_SOCKETS',
'PMA_USER',
'PMA_PASSWORD',
'PMA_ABSOLUTE_URI',
'PMA_CONTROLHOST',
'PMA_CONTROLPORT',
'PMA_PMADB',
'PMA_CONTROLUSER',
'PMA_CONTROLPASS',
'PMA_QUERYHISTORYDB'
);
foreach ($vars as $var) {
$env = getenv($var);
if (!isset($_ENV[$var]) && $env !== false) {
$_ENV[$var] = $env;
}
}
if (isset($_ENV['PMA_QUERYHISTORYDB'])) {
$cfg['QueryHistoryDB'] = boolval($_ENV['PMA_QUERYHISTORYDB']);
}
/* Arbitrary server connection */
if (isset($_ENV['PMA_ARBITRARY']) && $_ENV['PMA_ARBITRARY'] === '1') {
$cfg['AllowArbitraryServer'] = true;
}
/* Play nice behind reverse proxys */
if (isset($_ENV['PMA_ABSOLUTE_URI'])) {
$cfg['PmaAbsoluteUri'] = trim($_ENV['PMA_ABSOLUTE_URI']);
}
/* Figure out hosts */
/* Fallback to default linked */
$hosts = array('db');
/* Set by environment */
if (!empty($_ENV['PMA_HOST'])) {
$hosts = array($_ENV['PMA_HOST']);
$verbose = array($_ENV['PMA_VERBOSE']);
$ports = array($_ENV['PMA_PORT']);
} elseif (!empty($_ENV['PMA_HOSTS'])) {
$hosts = array_map('trim', explode(',', $_ENV['PMA_HOSTS']));
$verbose = array_map('trim', explode(',', $_ENV['PMA_VERBOSES']));
$ports = array_map('trim', explode(',', $_ENV['PMA_PORTS']));
}
if (!empty($_ENV['PMA_SOCKET'])) {
$sockets = array($_ENV['PMA_SOCKET']);
} elseif (!empty($_ENV['PMA_SOCKETS'])) {
$sockets = explode(',', $_ENV['PMA_SOCKETS']);
}
/* Server settings */
for ($i = 1; isset($hosts[$i - 1]); $i++) {
$cfg['Servers'][$i]['host'] = $hosts[$i - 1];
if (isset($verbose[$i - 1])) {
$cfg['Servers'][$i]['verbose'] = $verbose[$i - 1];
}
if (isset($ports[$i - 1])) {
$cfg['Servers'][$i]['port'] = $ports[$i - 1];
}
if (isset($_ENV['PMA_USER'])) {
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = $_ENV['PMA_USER'];
$cfg['Servers'][$i]['password'] = isset($_ENV['PMA_PASSWORD']) ? $_ENV['PMA_PASSWORD'] : '';
} else {
$cfg['Servers'][$i]['auth_type'] = 'cookie';
}
if (isset($_ENV['PMA_PMADB'])) {
$cfg['Servers'][$i]['pmadb'] = $_ENV['PMA_PMADB'];
$cfg['Servers'][$i]['relation'] = 'pma__relation';
$cfg['Servers'][$i]['table_info'] = 'pma__table_info';
$cfg['Servers'][$i]['table_coords'] = 'pma__table_coords';
$cfg['Servers'][$i]['pdf_pages'] = 'pma__pdf_pages';
$cfg['Servers'][$i]['column_info'] = 'pma__column_info';
$cfg['Servers'][$i]['bookmarktable'] = 'pma__bookmark';
$cfg['Servers'][$i]['history'] = 'pma__history';
$cfg['Servers'][$i]['recent'] = 'pma__recent';
$cfg['Servers'][$i]['favorite'] = 'pma__favorite';
$cfg['Servers'][$i]['table_uiprefs'] = 'pma__table_uiprefs';
$cfg['Servers'][$i]['tracking'] = 'pma__tracking';
$cfg['Servers'][$i]['userconfig'] = 'pma__userconfig';
$cfg['Servers'][$i]['users'] = 'pma__users';
$cfg['Servers'][$i]['usergroups'] = 'pma__usergroups';
$cfg['Servers'][$i]['navigationhiding'] = 'pma__navigationhiding';
$cfg['Servers'][$i]['savedsearches'] = 'pma__savedsearches';
$cfg['Servers'][$i]['central_columns'] = 'pma__central_columns';
$cfg['Servers'][$i]['designer_settings'] = 'pma__designer_settings';
$cfg['Servers'][$i]['export_templates'] = 'pma__export_templates';
}
if (isset($_ENV['PMA_CONTROLHOST'])) {
$cfg['Servers'][$i]['controlhost'] = $_ENV['PMA_CONTROLHOST'];
}
if (isset($_ENV['PMA_CONTROLPORT'])) {
$cfg['Servers'][$i]['controlport'] = $_ENV['PMA_CONTROLPORT'];
}
if (isset($_ENV['PMA_CONTROLUSER'])) {
$cfg['Servers'][$i]['controluser'] = $_ENV['PMA_CONTROLUSER'];
}
if (isset($_ENV['PMA_CONTROLPASS'])) {
$cfg['Servers'][$i]['controlpass'] = $_ENV['PMA_CONTROLPASS'];
}
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['AllowNoPassword'] = true;
}
for ($i = 1; isset($sockets[$i - 1]); $i++) {
$cfg['Servers'][$i]['socket'] = $sockets[$i - 1];
$cfg['Servers'][$i]['host'] = 'localhost';
}
/*
* Revert back to last configured server to make
* it easier in config.user.inc.php
*/
$i--;
/* Uploads setup */
$cfg['UploadDir'] = '';
$cfg['SaveDir'] = '';
/* Include User Defined Settings Hook */
if (file_exists('/etc/phpmyadmin/config.user.inc.php')) {
include('/etc/phpmyadmin/config.user.inc.php');
}
+55
View File
@@ -0,0 +1,55 @@
#!/bin/bash
if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
if [ ! -f /etc/phpmyadmin/config.secret.inc.php ]; then
cat > /etc/phpmyadmin/config.secret.inc.php <<EOT
<?php
\$cfg['blowfish_secret'] = '$(tr -dc 'a-zA-Z0-9~!@#$%^&*_()+}{?></";.,[]=-' < /dev/urandom | fold -w 32 | head -n 1)';
EOT
fi
if [ ! -f /etc/phpmyadmin/config.user.inc.php ]; then
touch /etc/phpmyadmin/config.user.inc.php
fi
fi
if [ ! -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
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 "$@"
+96
View File
@@ -0,0 +1,96 @@
#!/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;
}
')
)
}
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 }}"'
) )"
}
if ! command -v bashbrew --version &> /dev/null
then
echo "bashbrew could not be found"
echo "You can download it from Jenkins at https://github.com/docker-library/bashbrew#installing"
exit 1
fi
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> (@ibennetch),
William Desportes <williamdes@wdes.fr> (@williamdes)
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="$(curl -fsSL 'https://www.phpmyadmin.net/home_page/version.json' | jq -r '.version')"
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")"
variantArches="${parentRepoToArches[$variantParent]}"
cat <<-EOE
Tags: $(join ', ' "${variantAliases[@]}")
Architectures: $(join ', ' $variantArches)
GitCommit: $commit
Directory: $variant
EOE
done
Executable
+4
View File
@@ -0,0 +1,4 @@
#!/bin/sh
# This file is used by docker hub to build the image
docker build -t $IMAGE_NAME .
-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
-50
View File
@@ -1,50 +0,0 @@
#!/bin/sh
if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ] || [ "$1" == supervisord ] ; then
if [ "$(id -u)" = '0' ]; then
case "$1" in
apache2*)
user="${APACHE_RUN_USER:-www-data}"
group="${APACHE_RUN_GROUP:-www-data}"
;;
*) # php-fpm
user='www-data'
group='www-data'
;;
esac
else
user="$(id -u)"
group="$(id -g)"
fi
chown www-data:www-data /sessions /var/nginx/client_body_temp
if ! [ -e index.php -a -e db_designer.php ]; then
echo >&2 "phpMyAdmin not found in $PWD - copying now..."
if [ "$(ls -A)" ]; then
echo >&2 "WARNING: $PWD is not empty - press Ctrl+C now if this is an error!"
( set -x; ls -A; sleep 10 )
fi
tar --create \
--file - \
--one-file-system \
--directory /usr/src/phpmyadmin \
--owner "$user" --group "$group" \
. | tar --extract --file -
echo >&2 "Complete! phpMyAdmin has been successfully copied to $PWD"
mkdir -p tmp; \
chmod -R 777 tmp; \
fi
if [ ! -f /etc/phpmyadmin/config.secret.inc.php ]; then
cat > /etc/phpmyadmin/config.secret.inc.php <<EOT
<?php
\$cfg['blowfish_secret'] = '$(tr -dc 'a-zA-Z0-9~!@#$%^&*_()+}{?></";.,[]=-' < /dev/urandom | fold -w 32 | head -n 1)';
EOT
fi
if [ ! -f /etc/phpmyadmin/config.user.inc.php ]; then
touch /etc/phpmyadmin/config.user.inc.php
fi
fi
exec "$@"
+12 -5
View File
@@ -1,10 +1,17 @@
# Testing image for phpMyAdmin
FROM phpmyadmin/phpmyadmin
FROM phpmyadmin
# Install test dependencies
RUN apk add --no-cache curl py2-pip
RUN pip install mechanize html5lib
RUN set -ex; \
\
apt-get update; \
apt-get install -y --no-install-recommends \
curl \
python-pip \
; \
pip install setuptools wheel; \
pip install mechanize html5lib pytest; \
rm -rf /var/lib/apt/lists/*
COPY test.ini /etc/supervisor.d/
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")
+32 -28
View File
@@ -1,26 +1,27 @@
#!/usr/bin/env python
#!/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')
+38 -43
View File
@@ -19,74 +19,69 @@ PHPMYADMIN_HOSTNAME=${TESTSUITE_HOSTNAME:=localhost}
PHPMYADMIN_PORT=${TESTSUITE_PORT:=80}
PHPMYADMIN_URL=http://$PHPMYADMIN_HOSTNAME:$PORT/
# Set database environment
PHPMYADMIN_DB_HOSTNAME=${PMA_HOST:=localhost}
PHPMYADMIN_DB_PORT=${PMA_PORT:=3306}
# Color text output
GREEN="\033[0;32m"
RED="\033[0;31m"
NC="\033[0m" # No Color
ret=0
# Check if script is running inside container
if [ -f /.dockerenv ] ; then
echo "Tests running inside container..."
# Set database environment
PHPMYADMIN_DB_HOSTNAME=${PMA_HOST:=localhost}
PHPMYADMIN_DB_PORT=${PMA_PORT:=3306}
PHPMYADMIN_DB_URL=http://$PHPMYADMIN_DB_HOSTNAME:$PHPMYADMIN_DB_PORT/
# Find test script
if [ -f ./phpmyadmin_test.py ] ; then
FILENAME=./phpmyadmin_test.py
else
FILENAME=./testing/phpmyadmin_test.py
fi
# Check if script is running inside container
if ! [ -f /.dockerenv ] ; then
echo "Tests running outside container..."
COMMAND_HOST="docker exec ${NAME}"
docker ps -a
# Wait for database to start
TIMEOUT=0
while ! curl "$PHPMYADMIN_DB_URL" &>/dev/null; do
while [ $(docker logs db_server 2>&1 | fgrep -c "mysqld: ready for connections.") -le 0 ] ; do
echo "Waiting for ${PHPMYADMIN_DB_HOSTNAME} database start..."
sleep 10
TIMEOUT=$((TIMEOUT + 1))
if [ $TIMEOUT -gt 3 ] ; then
echo "Failed to connect ${PHPMYADMIN_DB_HOSTNAME} database!"
echo "Result of ${PHPMYADMIN_DB_HOSTNAME} tests: ${RED}FAILED${NC}"
ret=1
docker logs ${NAME}
exit 1
fi
done
# Wait for container to start
TIMEOUT=0
while [ $(docker logs ${NAME} 2>&1 | fgrep -c "Command line: 'apache2 -D FOREGROUND'") -le 0 ] ; do
echo "Waiting for PHPMyAdmin start..."
sleep 1
TIMEOUT=$((TIMEOUT + 1))
if [ $TIMEOUT -gt 10 ] ; then
echo "Failed to connect PHPMyAdmin!"
echo "Result of ${PHPMYADMIN_DB_HOSTNAME} tests: ${RED}FAILED${NC}"
docker logs ${NAME}
exit 1
fi
done
else
echo "Tests running outside container..."
docker ps -a
COMMAND_HOST="docker exec ${NAME}"
echo "Tests running inside container..."
FILENAME=/phpmyadmin_test.py
fi
# Wait for container to start
TIMEOUT=0
while ! $COMMAND_HOST ps aux | grep -q nginx ; do
echo "Waiting for PHPMyAdmin start..."
sleep 1
TIMEOUT=$((TIMEOUT + 1))
if [ $TIMEOUT -gt 10 ] ; then
echo "Failed to connect PHPMyAdmin!"
echo "Result of ${PHPMYADMIN_DB_HOSTNAME} tests: ${RED}FAILED${NC}"
ret=1
exit 1
fi
done
# Perform tests
if [ $ret -eq 0 ] ; then
if [ -f /phpmyadmin_test.py ] ; then
FILENAME=/phpmyadmin_test.py
elif [ -f ./phpmyadmin_test.py ] ; then
FILENAME=./phpmyadmin_test.py
else
FILENAME=./testing/phpmyadmin_test.py
fi
python $FILENAME --url "$PHPMYADMIN_URL" --username root --password $TESTSUITE_PASSWORD $SERVER
ret=$?
fi
ret=0
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
$COMMAND_HOST cat /var/log/php-fpm.log
$COMMAND_HOST cat /var/log/nginx-error.log
$COMMAND_HOST cat /var/log/supervisord.log
${COMMAND_HOST} ps faux
echo "Result of ${PHPMYADMIN_DB_HOSTNAME} tests: ${RED}FAILED${NC}"
exit $ret
fi
-32
View File
@@ -1,32 +0,0 @@
#!/bin/sh
# Helper script to wait for testing inside container completes
# Needs running docker-compose container based on docker-compose.testing.yml
GREEN="\033[0;32m"
RED="\033[0;31m"
NC="\033[0m" # No Color
TIMEOUT=0
sleep 5
while [ `docker-compose -f docker-compose.testing.yml logs phpmyadmin | grep -c 'Result of db_server tests'` -lt 1 ] ; do
sleep 1
TIMEOUT=$(($TIMEOUT + 1))
if [ $TIMEOUT -gt 20 ] ; then
docker-compose -f docker-compose.testing.yml logs phpmyadmin
echo "${RED}Timeout!${NC}"
exit 1
fi
done
if [ `docker-compose -f docker-compose.testing.yml logs phpmyadmin | grep -c 'Result of db_server tests.*SUCCESS'` -lt 1 ] ; then
docker-compose -f docker-compose.testing.yml logs phpmyadmin
echo "${RED}Failed${NC}"
exit 2
fi
docker-compose -f docker-compose.testing.yml logs phpmyadmin
echo "${GREEN}Success${NC}"
exit 0
Executable
+38
View File
@@ -0,0 +1,38 @@
#!/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'
[fpm-alpine]='php-fpm'
)
declare -A base=(
[apache]='debian'
[fpm]='debian'
[fpm-alpine]='alpine'
)
latest="$(curl -fsSL 'https://www.phpmyadmin.net/home_page/version.json' | jq -r '.version')"
sha256="$(curl -fsSL "https://files.phpmyadmin.net/phpMyAdmin/$latest/phpMyAdmin-$latest-all-languages.tar.xz.sha256" | cut -f1 -d ' ' | tr -cd 'a-f0-9' | cut -c 1-64)"
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"
sed -ri -e '
s/%%VERSION%%/'"$latest"'/;
s/%%SHA256%%/'"$sha256"'/;
s/%%VARIANT%%/'"$variant"'/;
s/%%CMD%%/'"${cmd[$variant]}"'/;
' "$variant/Dockerfile"
done