mirror of
https://github.com/phpmyadmin/docker.git
synced 2026-08-24 10:13:22 -05:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c850d7ece9 | ||
|
|
8917fb7bc2 | ||
|
|
31f2bdd82c | ||
|
|
6d26530177 | ||
|
|
5d4b4dec94 | ||
|
|
4f88748138 | ||
|
|
b295aa6bf7 | ||
|
|
dd2ca51984 | ||
|
|
568e58cc53 | ||
|
|
60e766aa9e | ||
|
|
05d5c516d3 | ||
|
|
2576eb2c26 | ||
|
|
bf6422b6a6 | ||
|
|
8edcc52dfb | ||
|
|
ed101c2f39 | ||
|
|
fb5222a52c | ||
|
|
d147a455af | ||
|
|
4e2998a2c5 | ||
|
|
44ab81b7cf | ||
|
|
4b236d823a | ||
|
|
1eede2e6b4 | ||
|
|
7cd2b5b46f | ||
|
|
62b73c11a9 | ||
|
|
a309c96f6a | ||
|
|
78f64ee5ce | ||
|
|
2313c19aed | ||
|
|
7d8a3e5717 | ||
|
|
b696c1f43d | ||
|
|
53a793568a | ||
|
|
43888414d6 | ||
|
|
0343ca5338 | ||
|
|
9d1872d753 | ||
|
|
5f2beb027a | ||
|
|
0bd0e9a958 | ||
|
|
8dfcf48b25 | ||
|
|
e9d1da4ebc | ||
|
|
f522725291 | ||
|
|
a68a25c673 | ||
|
|
21dbdb8968 | ||
|
|
ff0e3c994a | ||
|
|
24d76d8e35 | ||
|
|
d3281e86e1 | ||
|
|
6167470118 | ||
|
|
304a628535 | ||
|
|
342c5fb3fc | ||
|
|
c5174eeef9 | ||
|
|
909eab579e | ||
|
|
168df32465 | ||
|
|
41ef7ee430 | ||
|
|
33fc40f4a3 | ||
|
|
219e173c5e | ||
|
|
f30ef539da | ||
|
|
036fd21c08 | ||
|
|
7d35294fc5 | ||
|
|
ca4e508924 | ||
|
|
effe2b1e80 | ||
|
|
e670276b37 | ||
|
|
78e3cb7aba | ||
|
|
a114733200 | ||
|
|
967db65940 | ||
|
|
921f2867f7 | ||
|
|
df7df179f2 | ||
|
|
0e87cd4731 | ||
|
|
d3d7a78dae | ||
|
|
c775ef93dc | ||
|
|
d2f01baf40 | ||
|
|
56806ecbc7 | ||
|
|
662b82d27e | ||
|
|
fa5fb6c985 | ||
|
|
b1e2062fb4 | ||
|
|
f01eddea45 | ||
|
|
7899e91e35 | ||
|
|
7af014ffdf | ||
|
|
0512d0c6b3 | ||
|
|
17003ccf85 | ||
|
|
d5a587d00d | ||
|
|
b2409f5930 | ||
|
|
7a1cbfd6a3 | ||
|
|
25dde22ee9 | ||
|
|
f0ebd7aec5 | ||
|
|
98aa7b80c8 | ||
|
|
2d6fd72542 | ||
|
|
c706c520ef | ||
|
|
8269a39bfa | ||
|
|
c625c70fde | ||
|
|
2608fbd118 | ||
|
|
df45b3f76c | ||
|
|
edf7b2a375 | ||
|
|
b369d770dd | ||
|
|
e831e55d59 | ||
|
|
7a5f742d7d | ||
|
|
316a237509 | ||
|
|
44a266c45d | ||
|
|
2fe5947116 | ||
|
|
92a5a76a26 | ||
|
|
5dd9a0f015 | ||
|
|
f18aca104e | ||
|
|
d42e7c8a7d | ||
|
|
ca768f47fc | ||
|
|
c6aee5664c | ||
|
|
93e2be73ec | ||
|
|
85198de04f | ||
|
|
b024df6c3c | ||
|
|
ffedad4cdf | ||
|
|
c5d83d0fba | ||
|
|
d5f2f27d37 | ||
|
|
d53771b561 | ||
|
|
3bd49fb1ef | ||
|
|
d9236dfdad | ||
|
|
5e02108932 | ||
|
|
3a01bacb26 | ||
|
|
c09ec0fda8 | ||
|
|
621e3ad755 | ||
|
|
c03fa82b56 | ||
|
|
f5644c53c8 | ||
|
|
45873ade6a | ||
|
|
7aa164f6e1 | ||
|
|
c086bcea60 | ||
|
|
885eb78b98 | ||
|
|
686bf94364 | ||
|
|
ade6f52350 | ||
|
|
c29aadee1b | ||
|
|
30857caf5c | ||
|
|
2c92dfa55c | ||
|
|
a576282372 | ||
|
|
c4abbbaa35 | ||
|
|
15e82b23d2 | ||
|
|
ff2edd1f87 | ||
|
|
275b59e3dd | ||
|
|
a18b6e3842 | ||
|
|
524e669ce9 | ||
|
|
8884f19c18 | ||
|
|
1cfae7dbf6 | ||
|
|
24fd978c91 | ||
|
|
77d49d4d88 | ||
|
|
76631a48de | ||
|
|
6f28900cf9 | ||
|
|
3febe28134 | ||
|
|
1bcaeb5fec | ||
|
|
1204bcd696 | ||
|
|
447c731aaa | ||
|
|
69a0e832d9 | ||
|
|
0fb67d3437 | ||
|
|
331c3452f4 | ||
|
|
942a0dd5ff | ||
|
|
c76721ba8b | ||
|
|
554e98df45 | ||
|
|
5646cff98e | ||
|
|
382f9b9489 | ||
|
|
70b6297233 | ||
|
|
6314b17ebd | ||
|
|
63fd59434e | ||
|
|
a2782dd8f6 | ||
|
|
61bc237761 | ||
|
|
6736b49f7a | ||
|
|
b5305971ba | ||
|
|
2ebc458766 | ||
|
|
21b0804166 | ||
|
|
b35554203c | ||
|
|
e5a78047b2 | ||
|
|
a7aa88b4c6 | ||
|
|
b45585ea00 | ||
|
|
5d3536c381 | ||
|
|
24679b0c0b | ||
|
|
f5c3a1b628 | ||
|
|
d79872987d | ||
|
|
ed5d9c5fc9 | ||
|
|
446ed9e0d0 | ||
|
|
4ddc41bc29 | ||
|
|
ec28d93349 | ||
|
|
0ac5c9516c | ||
|
|
a1270dc0d5 | ||
|
|
73ea59e04b | ||
|
|
54a5953b37 | ||
|
|
d07907e15d | ||
|
|
e2f38b46ab | ||
|
|
cbcd23494f | ||
|
|
4432177a0a | ||
|
|
e2052a2066 | ||
|
|
6e3955516f | ||
|
|
29d69f34ad | ||
|
|
ddfe8e2b1c | ||
|
|
facd453fc2 | ||
|
|
b4d05f2604 | ||
|
|
ff50a29234 | ||
|
|
e943ff30d0 | ||
|
|
19a74cb25f | ||
|
|
a9cce1d72c | ||
|
|
4bc799bdb4 | ||
|
|
cc3e874181 | ||
|
|
ba761c1841 | ||
|
|
d67fafa56c | ||
|
|
bca3574cf3 | ||
|
|
c5c62ee24b | ||
|
|
78f2603e29 | ||
|
|
0715366ee3 | ||
|
|
a4dc5b36cd | ||
|
|
f626ed635b | ||
|
|
2a761b2a73 | ||
|
|
f544b5ca97 | ||
|
|
d53aadc0bb | ||
|
|
f581555bcf | ||
|
|
5cef68749a | ||
|
|
6c1410cbef | ||
|
|
352e5fe6ed | ||
|
|
c81443abd1 | ||
|
|
7177389b20 | ||
|
|
3142368a07 | ||
|
|
a017968642 | ||
|
|
9b115208c7 | ||
|
|
2e371a1cb5 | ||
|
|
af486daba0 | ||
|
|
a53f732a77 | ||
|
|
50f822a1c9 | ||
|
|
101ce17f0d | ||
|
|
f9c263baf2 | ||
|
|
71bf1edde3 | ||
|
|
29bcc43956 | ||
|
|
379a7df699 | ||
|
|
ab9d56ffc1 | ||
|
|
e3abc1a5bd | ||
|
|
1807d08963 | ||
|
|
a4ddcb67ce | ||
|
|
b2c5075876 | ||
|
|
9ddd36cd25 | ||
|
|
6ab1e50550 | ||
|
|
cd02b8d305 | ||
|
|
465ecb08b3 | ||
|
|
07afa363d7 | ||
|
|
8a3544a20a | ||
|
|
0a9d050db1 | ||
|
|
edce528acc | ||
|
|
7b9abff0ff | ||
|
|
ad4b811c44 | ||
|
|
0fd626c1f6 | ||
|
|
e415b21140 | ||
|
|
d935ec82f8 | ||
|
|
fc12c997ef | ||
|
|
55a4594325 | ||
|
|
90551173a8 | ||
|
|
b3eb5ffd23 | ||
|
|
3554ecfe19 | ||
|
|
000827ba7a | ||
|
|
0ba8cd2bc8 | ||
|
|
f7319feabf | ||
|
|
ab8caa4dd7 | ||
|
|
8c13128da9 | ||
|
|
df1677c26e | ||
|
|
dc56655368 | ||
|
|
8496f8fd25 | ||
|
|
e2a6eb627e | ||
|
|
233e07cd7b | ||
|
|
bae2c00e12 | ||
|
|
8fd34e6581 | ||
|
|
63557d61e9 | ||
|
|
bac44a4dbb | ||
|
|
f5fb1e42f9 | ||
|
|
38e99339ce | ||
|
|
961aa4ce9a | ||
|
|
fa5c90cae4 | ||
|
|
923f581fa9 | ||
|
|
9a78cb3d33 | ||
|
|
23b9a14189 | ||
|
|
341bc4965d | ||
|
|
d6060e96b5 | ||
|
|
454dfd47ed | ||
|
|
47eaf4cb6d | ||
|
|
b80eea10a2 | ||
|
|
f6ae557f95 | ||
|
|
d5895311c0 | ||
|
|
1c0936f359 | ||
|
|
cc72b8a432 | ||
|
|
5acaf20477 | ||
|
|
7f07a54e26 | ||
|
|
4b12fdda7c | ||
|
|
0ffb4af4c4 | ||
|
|
a76914f87d | ||
|
|
0c3251bf9e | ||
|
|
8bec114378 | ||
|
|
d6be2b9f1a | ||
|
|
32d4928e0a | ||
|
|
978bdb4b25 | ||
|
|
5b5edcafb1 | ||
|
|
d784d12452 | ||
|
|
84493eb5e4 | ||
|
|
91b5bd0fcd | ||
|
|
a1c139f901 | ||
|
|
507105ec70 | ||
|
|
feb1c92581 | ||
|
|
d12c0493ee | ||
|
|
00ff178fd1 | ||
|
|
b611c5adde | ||
|
|
1b2ff90941 | ||
|
|
5cb63716a7 | ||
|
|
d70630f09a | ||
|
|
9e0529c6f5 | ||
|
|
e7d5c0f075 | ||
|
|
690acf54dd | ||
|
|
901156a7eb | ||
|
|
ced6ab371a | ||
|
|
9d258fed4f | ||
|
|
e59a8bab47 | ||
|
|
c099349ef3 | ||
|
|
a602d1d4c6 | ||
|
|
8a8e9eee0a | ||
|
|
a5dfdfe993 | ||
|
|
f67529f585 | ||
|
|
e6bc219529 | ||
|
|
ef53180e08 | ||
|
|
4cadf08f00 |
@@ -1,6 +0,0 @@
|
||||
.travis.yml
|
||||
docker-compose.yml
|
||||
docker-compose.testing.yml
|
||||
README.md
|
||||
LICENSE
|
||||
Makefile
|
||||
@@ -0,0 +1 @@
|
||||
*.sql linguist-detectable=false
|
||||
@@ -0,0 +1,23 @@
|
||||
# Configuration for probot-stale - https://github.com/probot/stale
|
||||
|
||||
# Number of days of inactivity before an Issue or Pull Request becomes stale
|
||||
daysUntilStale: 60
|
||||
# Number of days of inactivity before a stale Issue or Pull Request is closed
|
||||
daysUntilClose: 7
|
||||
# Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable
|
||||
exemptLabels:
|
||||
- pinned
|
||||
- security
|
||||
# Label to use when marking as stale
|
||||
staleLabel: wontfix
|
||||
# Comment to post when marking as stale. Set to `false` to disable
|
||||
markComment: >
|
||||
This issue has been automatically marked as stale because it has not had
|
||||
recent activity. It will be closed if no further activity occurs. Thank you
|
||||
for your contributions.
|
||||
# Comment to post when removing the stale label. Set to `false` to disable
|
||||
unmarkComment: false
|
||||
# Comment to post when closing a stale Issue or Pull Request. Set to `false` to disable
|
||||
closeComment: false
|
||||
# Limit to only `issues` or `pulls`
|
||||
only: pulls
|
||||
@@ -1 +1,6 @@
|
||||
config.secret.inc.php
|
||||
__pycache__
|
||||
.pytest_cache
|
||||
.vscode
|
||||
.history
|
||||
.venv
|
||||
+84
-35
@@ -1,41 +1,90 @@
|
||||
sudo: required
|
||||
|
||||
services:
|
||||
- docker
|
||||
|
||||
env:
|
||||
matrix:
|
||||
- DB=mysql:5.7
|
||||
- DB=mariadb:10.0
|
||||
language: python
|
||||
python: 2.7
|
||||
dist: bionic
|
||||
|
||||
stages:
|
||||
- name: "Build images"
|
||||
- name: "Test docker-compose"
|
||||
- name: "Run tests in testing container"
|
||||
|
||||
before_install:
|
||||
- docker run --name db_server -e MYSQL_ROOT_PASSWORD=my-secret-pw -d $DB
|
||||
- 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
|
||||
|
||||
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
|
||||
- docker ps -a
|
||||
- curl http://127.0.0.1:9090/ | grep -q input_password
|
||||
- curl --cookie-jar /tmp/cj --location -d pma_username=root -d pma_password=my-secret-pw -d server=1 http://127.0.0.1:9090/ | grep -r 'db via TCP'
|
||||
# Test for single database using env
|
||||
- docker run --name envadmin -d --link db_server:db2 -e PMA_HOST=db2 -p 6060:80 phpmyadmin/phpmyadmin
|
||||
- docker ps -a
|
||||
- curl http://127.0.0.1:6060/ | grep -q input_password
|
||||
- curl --cookie-jar /tmp/cj --location -d pma_username=root -d pma_password=my-secret-pw -d server=1 http://127.0.0.1:6060/ | grep -r 'db2 via TCP'
|
||||
# Test for arbitrary database
|
||||
- docker run --name arbitraryadmin -d --link db_server:db -e PMA_ARBITRARY=1 -p 7070:80 phpmyadmin/phpmyadmin
|
||||
- docker ps -a
|
||||
- curl http://127.0.0.1:7070/ | grep -q input_password
|
||||
- curl --cookie-jar /tmp/cj --location -d pma_servername=db -d pma_username=root -d pma_password=my-secret-pw -d server=1 http://127.0.0.1:7070/ | grep -r 'db via TCP'
|
||||
# Test docker-compose
|
||||
- docker-compose up -d
|
||||
- docker ps -a
|
||||
- curl http://127.0.0.1:8080/ | grep -q input_password
|
||||
- curl --cookie-jar /tmp/cj --location -d pma_servername=db -d pma_username=root -d pma_password=my-secret-pw -d server=1 http://127.0.0.1:8080/ | grep -r 'db via TCP'
|
||||
- docker-compose stop
|
||||
# Test session survives shutdown
|
||||
- docker-compose up -d
|
||||
- curl --cookie-jar /tmp/cj --location http://127.0.0.1:8080/ | grep -r 'db via TCP'
|
||||
- docker-compose stop
|
||||
install:
|
||||
- pip install mechanize html5lib pytest
|
||||
|
||||
_helpers:
|
||||
- &test-docker-compose
|
||||
stage: "Test docker-compose"
|
||||
script:
|
||||
- docker-compose -f docker-compose.testing.yml up -d db_server
|
||||
- docker-compose -f docker-compose.testing.yml up -d
|
||||
- docker-compose exec phpmyadmin /test-docker.sh phpmyadmin_testing 80 phpmyadmin_testing_db
|
||||
- docker-compose stop
|
||||
- &test-apache-image
|
||||
stage: "Run tests in testing container"
|
||||
script:
|
||||
# Build image
|
||||
- docker build -t phpmyadmin/phpmyadmin apache
|
||||
# Test for single database
|
||||
- docker run --name testadmin -d --link db_server:db -p 9090:80 phpmyadmin/phpmyadmin
|
||||
- ./testing/test-docker.sh testadmin 9090
|
||||
# Test for single database using env
|
||||
- docker run --name envadmin -d --link db_server:db2 -e PMA_HOST=db2 -p 6060:80 phpmyadmin/phpmyadmin
|
||||
- ./testing/test-docker.sh envadmin 6060
|
||||
# Test for arbitrary database
|
||||
- docker run --name arbitraryadmin -d --link db_server:db3 -e PMA_ARBITRARY=1 -p 7070:80 phpmyadmin/phpmyadmin
|
||||
- ./testing/test-docker.sh arbitraryadmin 7070 db3
|
||||
# Test for arbitrary database with user config
|
||||
- docker run --name userconfigadmin -d --link db_server:db3 -v `readlink -f ./testing/config.test.inc.php`:/etc/phpmyadmin/config.user.inc.php -p 7080:80 phpmyadmin/phpmyadmin
|
||||
- ./testing/test-docker.sh userconfigadmin 7080 db3
|
||||
- &test-docker-compose-db
|
||||
stage: "Test docker-compose"
|
||||
script:
|
||||
- docker-compose -f docker-compose.yml -f docker-compose.db.yml up -d
|
||||
- ./testing/test-docker.sh phpmyadmin 8080 db_server
|
||||
- docker-compose stop
|
||||
- &build-image
|
||||
stage: "Build images"
|
||||
before_install: skip
|
||||
install: skip
|
||||
|
||||
jobs:
|
||||
include:
|
||||
- <<: *test-docker-compose
|
||||
name: "Run and stop container using testing docker-compose file for MariaDB"
|
||||
env: DB=mariadb:latest
|
||||
- <<: *test-docker-compose
|
||||
name: "Run and stop container using testing docker-compose file for MySQL"
|
||||
env: DB=mysql:latest
|
||||
- <<: *test-docker-compose-db
|
||||
name: "Run and stop container using db docker-compose file for MariaDB"
|
||||
env: DB=mariadb:latest
|
||||
- <<: *test-docker-compose-db
|
||||
name: "Run and stop container using db docker-compose file for MySQL"
|
||||
env: DB=mysql:latest
|
||||
- <<: *build-image
|
||||
name: "Apache amd64"
|
||||
arch: amd64
|
||||
script:
|
||||
- docker build -t phpmyadmin/phpmyadmin apache
|
||||
- <<: *build-image
|
||||
name: "fpm amd64"
|
||||
arch: amd64
|
||||
script:
|
||||
- docker build -t phpmyadmin/phpmyadmin fpm
|
||||
- <<: *build-image
|
||||
name: "fpm-alpine amd64"
|
||||
arch: amd64
|
||||
script:
|
||||
- docker build -t phpmyadmin/phpmyadmin fpm-alpine
|
||||
- <<: *test-apache-image
|
||||
name: "Run testing for MariaDB"
|
||||
env: DB=mariadb:latest
|
||||
- <<: *test-apache-image
|
||||
name: "Run testing for MySQL"
|
||||
env: DB=mysql:latest
|
||||
-20
@@ -1,20 +0,0 @@
|
||||
FROM alpine:latest
|
||||
|
||||
RUN apk add --no-cache php5-cli php5-mysqli php5-ctype php5-xml php5-gd php5-zlib php5-bz2 php5-zip php5-openssl php5-curl php5-opcache php5-json curl
|
||||
|
||||
RUN curl --location https://www.phpmyadmin.net/downloads/phpMyAdmin-latest-all-languages.tar.gz | tar xzf - \
|
||||
&& mv phpMyAdmin* /www \
|
||||
&& rm -rf /www/js/jquery/src/ /www/examples /www/po/
|
||||
|
||||
COPY config.inc.php /www/
|
||||
COPY run.sh /run.sh
|
||||
RUN chmod u+rwx /run.sh
|
||||
|
||||
VOLUME /sessions
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
ENV PHP_UPLOAD_MAX_FILESIZE=64M \
|
||||
PHP_MAX_INPUT_VARS=2000
|
||||
|
||||
ENTRYPOINT [ "/run.sh" ]
|
||||
@@ -0,0 +1,98 @@
|
||||
FROM php:7.4-%%VARIANT%%
|
||||
|
||||
# docker-entrypoint.sh dependencies
|
||||
RUN apk add --no-cache \
|
||||
bash
|
||||
|
||||
# Install dependencies
|
||||
RUN set -ex; \
|
||||
\
|
||||
apk add --no-cache --virtual .build-deps \
|
||||
bzip2-dev \
|
||||
freetype-dev \
|
||||
libjpeg-turbo-dev \
|
||||
libpng-dev \
|
||||
libwebp-dev \
|
||||
libxpm-dev \
|
||||
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 .build-deps
|
||||
|
||||
# set recommended PHP.ini settings
|
||||
# see https://secure.php.net/manual/en/opcache.installation.php
|
||||
RUN { \
|
||||
echo 'opcache.memory_consumption=128'; \
|
||||
echo 'opcache.interned_strings_buffer=8'; \
|
||||
echo 'opcache.max_accelerated_files=4000'; \
|
||||
echo 'opcache.revalidate_freq=2'; \
|
||||
echo 'opcache.fast_shutdown=1'; \
|
||||
} > $PHP_INI_DIR/conf.d/opcache-recommended.ini; \
|
||||
\
|
||||
{ \
|
||||
echo 'session.cookie_httponly = 1'; \
|
||||
echo 'session.use_strict_mode = 1'; \
|
||||
} > $PHP_INI_DIR/conf.d/session-strict.ini; \
|
||||
\
|
||||
{ \
|
||||
echo 'allow_url_fopen = Off'; \
|
||||
echo 'max_execution_time = 600'; \
|
||||
echo 'memory_limit = 512M'; \
|
||||
} > $PHP_INI_DIR/conf.d/phpmyadmin-misc.ini
|
||||
|
||||
# Calculate download URL
|
||||
ENV VERSION %%VERSION%%
|
||||
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 config.inc.php /etc/phpmyadmin/config.inc.php
|
||||
|
||||
# Copy main script
|
||||
COPY docker-entrypoint.sh /docker-entrypoint.sh
|
||||
|
||||
ENTRYPOINT [ "/docker-entrypoint.sh" ]
|
||||
CMD ["%%CMD%%"]
|
||||
@@ -0,0 +1,106 @@
|
||||
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 { \
|
||||
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 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; \
|
||||
fetchDeps=" \
|
||||
gnupg \
|
||||
dirmngr \
|
||||
"; \
|
||||
apt-get update; \
|
||||
apt-get install -y --no-install-recommends $fetchDeps; \
|
||||
\
|
||||
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; \
|
||||
\
|
||||
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $fetchDeps; \
|
||||
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%%"]
|
||||
@@ -1,18 +1,26 @@
|
||||
DOCKER_REPO = phpmyadmin/phpmyadmin
|
||||
|
||||
.PHONY: all build build_nc run logs clean stop rm prune
|
||||
.PHONY: all build run logs clean stop rm prune
|
||||
|
||||
all: build run logs
|
||||
|
||||
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
|
||||
|
||||
|
||||
@@ -1,15 +1,50 @@
|
||||
# Official phpMyAdmin Docker image
|
||||
|
||||
Run phpMyAdmin with Alpine and PHP built in web server.
|
||||
Run phpMyAdmin with Alpine, Apache and PHP FPM.
|
||||
|
||||
[](https://travis-ci.org/phpmyadmin/docker)
|
||||
[][hub]
|
||||
[][hub]
|
||||
[](https://microbadger.com/images/phpmyadmin/phpmyadmin "Get your own image badge on microbadger.com")
|
||||
[](https://microbadger.com/images/phpmyadmin/phpmyadmin "Get your own version badge on microbadger.com")
|
||||
|
||||
|
||||
All following examples will bring you phpMyAdmin on `http://localhost:8080`
|
||||
where you can enjoy your happy MySQL administration.
|
||||
|
||||
## Credentials
|
||||
|
||||
phpMyAdmin does use MySQL server credential, please check the corresponding
|
||||
server image for information how it is setup.
|
||||
|
||||
The official MySQL and MariaDB use following environment variables to define these:
|
||||
|
||||
* `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.
|
||||
|
||||
## Supported Docker hub tags
|
||||
|
||||
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
|
||||
* `edge`, `edge-fpm`, `edge-fpm-alpine`, a development version build from the daily snapshot
|
||||
|
||||
A complete list of tags is [available at Docker Hub](https://hub.docker.com/r/phpmyadmin/phpmyadmin/tags)
|
||||
|
||||
## Image variants
|
||||
|
||||
We provide three variations:
|
||||
|
||||
* "apache" includes a full Apache webserver with PHP and includes everything needed to work out of the box.
|
||||
This is the default when only a version number is requested.
|
||||
* "fpm" only starts a PHP FPM container. Use this variant if you already have a seperate webserver.
|
||||
This includes more tools and is therefore a larger image than the "fpm-alpine" variation.
|
||||
* "fpm-alpine" has a very small footprint. It is based on Alpine Linux and only starts a PHP FPM process.
|
||||
Use this variant if you already have a seperate webserver. If you need more tools that are not available on Alpine Linux, use the fpm image instead.
|
||||
|
||||
## Usage with linked server
|
||||
|
||||
@@ -34,7 +69,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 --link mysql_db_server:db -p 8080:80 -e PMA_ARBITRARY=1 phpmyadmin/phpmyadmin
|
||||
docker run --name myadmin -d -e PMA_ARBITRARY=1 -p 8080:80 phpmyadmin/phpmyadmin
|
||||
```
|
||||
|
||||
## Usage with docker-compose and arbitrary server
|
||||
@@ -48,16 +83,70 @@ Using the docker-compose.yml from https://github.com/phpmyadmin/docker
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
## 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
|
||||
|
||||
```
|
||||
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
|
||||
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
|
||||
```
|
||||
|
||||
See the following links for config file information.
|
||||
https://docs.phpmyadmin.net/en/latest/config.html#config
|
||||
https://docs.phpmyadmin.net/en/latest/setup.html
|
||||
|
||||
## Usage behind reverse proxys
|
||||
|
||||
Set the variable ``PMA_ABSOLUTE_URI`` to the fully-qualified path (``https://pma.example.net/``) where the reverse proxy makes phpMyAdmin available.
|
||||
|
||||
## Environment variables summary
|
||||
|
||||
* ``PMA_ARBITRARY`` - when set to 1 connection to the arbitrary server will be allowed
|
||||
* ``PMA_HOST`` - define address/host name of the MySQL server
|
||||
* ``PMA_VERBOSE`` - define verbose name of the MySQL server
|
||||
* ``PMA_PORT`` - define port of the MySQL server
|
||||
* ``PMA_HOSTS`` - define comma separated list of address/host names of the MySQL servers
|
||||
* ``PMA_VERBOSES`` - define comma separated list of verbose names of the MySQL servers
|
||||
* ``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
|
||||
* ``PHP_UPLOAD_MAX_FILESIZE`` - define upload_max_filesize and post_max_size PHP settings
|
||||
* ``PHP_MAX_INPUT_VARS`` - define max_input_vars PHP setting
|
||||
* ``PMA_ABSOLUTE_URI`` - define user-facing URI
|
||||
* ``HIDE_PHP_VERSION`` - if defined, will hide the php version (`expose_php = Off`). Set to any value (such as HIDE_PHP_VERSION=true).
|
||||
* ``UPLOAD_LIMIT`` - if set, will override the default value for apache and php-fpm (default value is 2048 kb)
|
||||
* ``PMA_CONFIG_BASE64`` - if set, will override the default config.inc.php with the base64 decoded contents of the variable
|
||||
* ``PMA_USER_CONFIG_BASE64`` - if set, will override the default config.user.inc.php with the base64 decoded contents of the variable
|
||||
|
||||
For more detailed documentation see http://docs.phpmyadmin.net/en/latest/setup.html#installing-using-docker
|
||||
For usage with Docker secrets, appending ``_FILE`` to the ``PMA_PASSWORD`` environment variable is allowed (it overrides ``PMA_PASSWORD`` if it is set):
|
||||
```
|
||||
docker run --name myadmin -d -e PMA_PASSWORD_FILE=/run/secrets/db_password.txt -p 8080:80 phpmyadmin/phpmyadmin
|
||||
```
|
||||
|
||||
#### Variables that can be read from a file using ``_FILE``
|
||||
- PMA_PASSWORD
|
||||
- MYSQL_ROOT_PASSWORD
|
||||
- MYSQL_PASSWORD
|
||||
- PMA_HOSTS
|
||||
- PMA_HOST
|
||||
|
||||
For more detailed documentation see https://docs.phpmyadmin.net/en/latest/setup.html#installing-using-docker
|
||||
|
||||
[hub]: https://hub.docker.com/r/phpmyadmin/phpmyadmin/
|
||||
|
||||
Please report any issues with the Docker container to https://github.com/phpmyadmin/docker/issues
|
||||
|
||||
Please report any issues with phpMyAdmin to https://github.com/phpmyadmin/phpmyadmin/issues
|
||||
|
||||
@@ -0,0 +1,106 @@
|
||||
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 { \
|
||||
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.1
|
||||
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; \
|
||||
fetchDeps=" \
|
||||
gnupg \
|
||||
dirmngr \
|
||||
"; \
|
||||
apt-get update; \
|
||||
apt-get install -y --no-install-recommends $fetchDeps; \
|
||||
\
|
||||
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; \
|
||||
\
|
||||
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $fetchDeps; \
|
||||
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"]
|
||||
@@ -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');
|
||||
}
|
||||
Executable
+90
@@ -0,0 +1,90 @@
|
||||
#!/bin/bash
|
||||
if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
|
||||
if [ "$(id -u)" = '0' ]; then
|
||||
case "$1" in
|
||||
apache2*)
|
||||
user="${APACHE_RUN_USER:-www-data}"
|
||||
group="${APACHE_RUN_GROUP:-www-data}"
|
||||
;;
|
||||
*) # php-fpm
|
||||
user='www-data'
|
||||
group='www-data'
|
||||
;;
|
||||
esac
|
||||
else
|
||||
user="$(id -u)"
|
||||
group="$(id -g)"
|
||||
fi
|
||||
|
||||
# Custom folders for sessions
|
||||
chown ${user}:${group} /sessions /var/nginx/client_body_temp
|
||||
|
||||
if ! [ -e index.php -a -e url.php ]; then
|
||||
echo >&2 "phpMyAdmin not found in $PWD - copying now..."
|
||||
if [ "$(ls -A)" ]; then
|
||||
echo >&2 "WARNING: $PWD is not empty - press Ctrl+C now if this is an error!"
|
||||
( set -x; ls -A; sleep 10 )
|
||||
fi
|
||||
tar --create \
|
||||
--file - \
|
||||
--one-file-system \
|
||||
--directory /usr/src/phpmyadmin \
|
||||
--owner "$user" --group "$group" \
|
||||
. | tar --extract --file -
|
||||
echo >&2 "Complete! phpMyAdmin has been successfully copied to $PWD"
|
||||
mkdir -p tmp; \
|
||||
chmod -R 777 tmp; \
|
||||
fi
|
||||
|
||||
if [ ! -f /etc/phpmyadmin/config.secret.inc.php ]; then
|
||||
cat > /etc/phpmyadmin/config.secret.inc.php <<EOT
|
||||
<?php
|
||||
\$cfg['blowfish_secret'] = '$(tr -dc 'a-zA-Z0-9~!@#$%^&*_()+}{?></";.,[]=-' < /dev/urandom | fold -w 32 | head -n 1)';
|
||||
EOT
|
||||
fi
|
||||
|
||||
if [ ! -f /etc/phpmyadmin/config.user.inc.php ]; then
|
||||
touch /etc/phpmyadmin/config.user.inc.php
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -z "${HIDE_PHP_VERSION}" ]; then
|
||||
echo "PHP version is now hidden."
|
||||
echo -e 'expose_php = Off\n' > $PHP_INI_DIR/conf.d/phpmyadmin-hide-php-version.ini
|
||||
fi
|
||||
|
||||
UPLOAD_LIMIT_INI_FILE="$PHP_INI_DIR/conf.d/phpmyadmin-upload-limit.ini"
|
||||
if [ ! -z "${UPLOAD_LIMIT}" ]; then
|
||||
echo "Adding the custom upload limit."
|
||||
echo -e "upload_max_filesize = $UPLOAD_LIMIT\npost_max_size = $UPLOAD_LIMIT\n" > $UPLOAD_LIMIT_INI_FILE
|
||||
fi
|
||||
|
||||
if [ ! -z "${PMA_CONFIG_BASE64}" ]; then
|
||||
echo "Adding the custom config.inc.php from base64."
|
||||
echo "${PMA_CONFIG_BASE64}" | base64 -d > /etc/phpmyadmin/config.inc.php
|
||||
fi
|
||||
|
||||
if [ ! -z "${PMA_USER_CONFIG_BASE64}" ]; then
|
||||
echo "Adding the custom config.user.inc.php from base64."
|
||||
echo "${PMA_USER_CONFIG_BASE64}" | base64 -d > /etc/phpmyadmin/config.user.inc.php
|
||||
fi
|
||||
|
||||
function get_docker_secret() {
|
||||
local env_var="${1}"
|
||||
local env_var_file="${env_var}_FILE"
|
||||
|
||||
# Check if the variable with name $env_var_file (which is $PMA_PASSWORD_FILE for example)
|
||||
# is not empty and export $PMA_PASSWORD as the password in the Docker secrets file
|
||||
|
||||
if [[ -n "${!env_var_file}" ]]; then
|
||||
export "${env_var}"="$(cat "${!env_var_file}")"
|
||||
fi
|
||||
}
|
||||
|
||||
get_docker_secret PMA_PASSWORD
|
||||
get_docker_secret MYSQL_ROOT_PASSWORD
|
||||
get_docker_secret MYSQL_PASSWORD
|
||||
get_docker_secret PMA_HOSTS
|
||||
get_docker_secret PMA_HOST
|
||||
|
||||
exec "$@"
|
||||
+88
-8
@@ -1,27 +1,48 @@
|
||||
<?php
|
||||
|
||||
require('./config.secret.inc.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) {
|
||||
if (!isset($_ENV[$var]) && getenv($var)) {
|
||||
$_ENV[$var] = getenv($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 */
|
||||
@@ -30,28 +51,87 @@ $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 = explode(',', $_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($_ENV['PMA_PORT'])) {
|
||||
$cfg['Servers'][$i]['port'] = $_ENV['PMA_PORT'];
|
||||
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'] : null;
|
||||
$cfg['Servers'][$i]['password'] = isset($_ENV['PMA_PASSWORD']) ? $_ENV['PMA_PASSWORD'] : '';
|
||||
} else {
|
||||
$cfg['Servers'][$i]['auth_type'] = 'cookie';
|
||||
}
|
||||
$cfg['Servers'][$i]['connect_type'] = 'tcp';
|
||||
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');
|
||||
}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
phpmyadmin:
|
||||
external_links:
|
||||
- db_server:db
|
||||
@@ -1,8 +1,30 @@
|
||||
phpmyadmin:
|
||||
image: phpmyadmin/phpmyadmin:testing
|
||||
container_name: myadmin
|
||||
version: '3.1'
|
||||
|
||||
services:
|
||||
db_server:
|
||||
image: ${DB:-mariadb:10.3}
|
||||
container_name: phpmyadmin_testing_db
|
||||
environment:
|
||||
- PMA_ARBITRARY=1
|
||||
restart: always
|
||||
- MYSQL_ROOT_PASSWORD=${TESTSUITE_PASSWORD:-my-secret-pw}
|
||||
volumes:
|
||||
- ./testing/testing.cnf:/etc/mysql/conf.d/testing.cnf:ro
|
||||
tmpfs:
|
||||
- /var/lib/mysql:rw,noexec,nosuid,size=300m
|
||||
|
||||
phpmyadmin:
|
||||
build:
|
||||
context: testing/
|
||||
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
|
||||
- 8090:80
|
||||
environment:
|
||||
- PMA_ARBITRARY=1
|
||||
- TESTSUITE_PASSWORD=${TESTSUITE_PASSWORD:-my-secret-pw}
|
||||
depends_on:
|
||||
- db_server
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
phpmyadmin:
|
||||
image: phpmyadmin/phpmyadmin
|
||||
container_name: myadmin
|
||||
container_name: phpmyadmin
|
||||
environment:
|
||||
- PMA_ARBITRARY=1
|
||||
restart: always
|
||||
|
||||
Executable
+90
@@ -0,0 +1,90 @@
|
||||
#!/bin/bash
|
||||
if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
|
||||
if [ "$(id -u)" = '0' ]; then
|
||||
case "$1" in
|
||||
apache2*)
|
||||
user="${APACHE_RUN_USER:-www-data}"
|
||||
group="${APACHE_RUN_GROUP:-www-data}"
|
||||
;;
|
||||
*) # php-fpm
|
||||
user='www-data'
|
||||
group='www-data'
|
||||
;;
|
||||
esac
|
||||
else
|
||||
user="$(id -u)"
|
||||
group="$(id -g)"
|
||||
fi
|
||||
|
||||
# Custom folders for sessions
|
||||
chown ${user}:${group} /sessions /var/nginx/client_body_temp
|
||||
|
||||
if ! [ -e index.php -a -e url.php ]; then
|
||||
echo >&2 "phpMyAdmin not found in $PWD - copying now..."
|
||||
if [ "$(ls -A)" ]; then
|
||||
echo >&2 "WARNING: $PWD is not empty - press Ctrl+C now if this is an error!"
|
||||
( set -x; ls -A; sleep 10 )
|
||||
fi
|
||||
tar --create \
|
||||
--file - \
|
||||
--one-file-system \
|
||||
--directory /usr/src/phpmyadmin \
|
||||
--owner "$user" --group "$group" \
|
||||
. | tar --extract --file -
|
||||
echo >&2 "Complete! phpMyAdmin has been successfully copied to $PWD"
|
||||
mkdir -p tmp; \
|
||||
chmod -R 777 tmp; \
|
||||
fi
|
||||
|
||||
if [ ! -f /etc/phpmyadmin/config.secret.inc.php ]; then
|
||||
cat > /etc/phpmyadmin/config.secret.inc.php <<EOT
|
||||
<?php
|
||||
\$cfg['blowfish_secret'] = '$(tr -dc 'a-zA-Z0-9~!@#$%^&*_()+}{?></";.,[]=-' < /dev/urandom | fold -w 32 | head -n 1)';
|
||||
EOT
|
||||
fi
|
||||
|
||||
if [ ! -f /etc/phpmyadmin/config.user.inc.php ]; then
|
||||
touch /etc/phpmyadmin/config.user.inc.php
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -z "${HIDE_PHP_VERSION}" ]; then
|
||||
echo "PHP version is now hidden."
|
||||
echo -e 'expose_php = Off\n' > $PHP_INI_DIR/conf.d/phpmyadmin-hide-php-version.ini
|
||||
fi
|
||||
|
||||
UPLOAD_LIMIT_INI_FILE="$PHP_INI_DIR/conf.d/phpmyadmin-upload-limit.ini"
|
||||
if [ ! -z "${UPLOAD_LIMIT}" ]; then
|
||||
echo "Adding the custom upload limit."
|
||||
echo -e "upload_max_filesize = $UPLOAD_LIMIT\npost_max_size = $UPLOAD_LIMIT\n" > $UPLOAD_LIMIT_INI_FILE
|
||||
fi
|
||||
|
||||
if [ ! -z "${PMA_CONFIG_BASE64}" ]; then
|
||||
echo "Adding the custom config.inc.php from base64."
|
||||
echo "${PMA_CONFIG_BASE64}" | base64 -d > /etc/phpmyadmin/config.inc.php
|
||||
fi
|
||||
|
||||
if [ ! -z "${PMA_USER_CONFIG_BASE64}" ]; then
|
||||
echo "Adding the custom config.user.inc.php from base64."
|
||||
echo "${PMA_USER_CONFIG_BASE64}" | base64 -d > /etc/phpmyadmin/config.user.inc.php
|
||||
fi
|
||||
|
||||
function get_docker_secret() {
|
||||
local env_var="${1}"
|
||||
local env_var_file="${env_var}_FILE"
|
||||
|
||||
# Check if the variable with name $env_var_file (which is $PMA_PASSWORD_FILE for example)
|
||||
# is not empty and export $PMA_PASSWORD as the password in the Docker secrets file
|
||||
|
||||
if [[ -n "${!env_var_file}" ]]; then
|
||||
export "${env_var}"="$(cat "${!env_var_file}")"
|
||||
fi
|
||||
}
|
||||
|
||||
get_docker_secret PMA_PASSWORD
|
||||
get_docker_secret MYSQL_ROOT_PASSWORD
|
||||
get_docker_secret MYSQL_PASSWORD
|
||||
get_docker_secret PMA_HOSTS
|
||||
get_docker_secret PMA_HOST
|
||||
|
||||
exec "$@"
|
||||
@@ -0,0 +1,98 @@
|
||||
FROM php:7.4-fpm-alpine
|
||||
|
||||
# docker-entrypoint.sh dependencies
|
||||
RUN apk add --no-cache \
|
||||
bash
|
||||
|
||||
# Install dependencies
|
||||
RUN set -ex; \
|
||||
\
|
||||
apk add --no-cache --virtual .build-deps \
|
||||
bzip2-dev \
|
||||
freetype-dev \
|
||||
libjpeg-turbo-dev \
|
||||
libpng-dev \
|
||||
libwebp-dev \
|
||||
libxpm-dev \
|
||||
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 .build-deps
|
||||
|
||||
# set recommended PHP.ini settings
|
||||
# see https://secure.php.net/manual/en/opcache.installation.php
|
||||
RUN { \
|
||||
echo 'opcache.memory_consumption=128'; \
|
||||
echo 'opcache.interned_strings_buffer=8'; \
|
||||
echo 'opcache.max_accelerated_files=4000'; \
|
||||
echo 'opcache.revalidate_freq=2'; \
|
||||
echo 'opcache.fast_shutdown=1'; \
|
||||
} > $PHP_INI_DIR/conf.d/opcache-recommended.ini; \
|
||||
\
|
||||
{ \
|
||||
echo 'session.cookie_httponly = 1'; \
|
||||
echo 'session.use_strict_mode = 1'; \
|
||||
} > $PHP_INI_DIR/conf.d/session-strict.ini; \
|
||||
\
|
||||
{ \
|
||||
echo 'allow_url_fopen = Off'; \
|
||||
echo 'max_execution_time = 600'; \
|
||||
echo 'memory_limit = 512M'; \
|
||||
} > $PHP_INI_DIR/conf.d/phpmyadmin-misc.ini
|
||||
|
||||
# Calculate download URL
|
||||
ENV VERSION 5.0.1
|
||||
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 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"]
|
||||
@@ -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');
|
||||
}
|
||||
Executable
+90
@@ -0,0 +1,90 @@
|
||||
#!/bin/bash
|
||||
if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
|
||||
if [ "$(id -u)" = '0' ]; then
|
||||
case "$1" in
|
||||
apache2*)
|
||||
user="${APACHE_RUN_USER:-www-data}"
|
||||
group="${APACHE_RUN_GROUP:-www-data}"
|
||||
;;
|
||||
*) # php-fpm
|
||||
user='www-data'
|
||||
group='www-data'
|
||||
;;
|
||||
esac
|
||||
else
|
||||
user="$(id -u)"
|
||||
group="$(id -g)"
|
||||
fi
|
||||
|
||||
# Custom folders for sessions
|
||||
chown ${user}:${group} /sessions /var/nginx/client_body_temp
|
||||
|
||||
if ! [ -e index.php -a -e url.php ]; then
|
||||
echo >&2 "phpMyAdmin not found in $PWD - copying now..."
|
||||
if [ "$(ls -A)" ]; then
|
||||
echo >&2 "WARNING: $PWD is not empty - press Ctrl+C now if this is an error!"
|
||||
( set -x; ls -A; sleep 10 )
|
||||
fi
|
||||
tar --create \
|
||||
--file - \
|
||||
--one-file-system \
|
||||
--directory /usr/src/phpmyadmin \
|
||||
--owner "$user" --group "$group" \
|
||||
. | tar --extract --file -
|
||||
echo >&2 "Complete! phpMyAdmin has been successfully copied to $PWD"
|
||||
mkdir -p tmp; \
|
||||
chmod -R 777 tmp; \
|
||||
fi
|
||||
|
||||
if [ ! -f /etc/phpmyadmin/config.secret.inc.php ]; then
|
||||
cat > /etc/phpmyadmin/config.secret.inc.php <<EOT
|
||||
<?php
|
||||
\$cfg['blowfish_secret'] = '$(tr -dc 'a-zA-Z0-9~!@#$%^&*_()+}{?></";.,[]=-' < /dev/urandom | fold -w 32 | head -n 1)';
|
||||
EOT
|
||||
fi
|
||||
|
||||
if [ ! -f /etc/phpmyadmin/config.user.inc.php ]; then
|
||||
touch /etc/phpmyadmin/config.user.inc.php
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -z "${HIDE_PHP_VERSION}" ]; then
|
||||
echo "PHP version is now hidden."
|
||||
echo -e 'expose_php = Off\n' > $PHP_INI_DIR/conf.d/phpmyadmin-hide-php-version.ini
|
||||
fi
|
||||
|
||||
UPLOAD_LIMIT_INI_FILE="$PHP_INI_DIR/conf.d/phpmyadmin-upload-limit.ini"
|
||||
if [ ! -z "${UPLOAD_LIMIT}" ]; then
|
||||
echo "Adding the custom upload limit."
|
||||
echo -e "upload_max_filesize = $UPLOAD_LIMIT\npost_max_size = $UPLOAD_LIMIT\n" > $UPLOAD_LIMIT_INI_FILE
|
||||
fi
|
||||
|
||||
if [ ! -z "${PMA_CONFIG_BASE64}" ]; then
|
||||
echo "Adding the custom config.inc.php from base64."
|
||||
echo "${PMA_CONFIG_BASE64}" | base64 -d > /etc/phpmyadmin/config.inc.php
|
||||
fi
|
||||
|
||||
if [ ! -z "${PMA_USER_CONFIG_BASE64}" ]; then
|
||||
echo "Adding the custom config.user.inc.php from base64."
|
||||
echo "${PMA_USER_CONFIG_BASE64}" | base64 -d > /etc/phpmyadmin/config.user.inc.php
|
||||
fi
|
||||
|
||||
function get_docker_secret() {
|
||||
local env_var="${1}"
|
||||
local env_var_file="${env_var}_FILE"
|
||||
|
||||
# Check if the variable with name $env_var_file (which is $PMA_PASSWORD_FILE for example)
|
||||
# is not empty and export $PMA_PASSWORD as the password in the Docker secrets file
|
||||
|
||||
if [[ -n "${!env_var_file}" ]]; then
|
||||
export "${env_var}"="$(cat "${!env_var_file}")"
|
||||
fi
|
||||
}
|
||||
|
||||
get_docker_secret PMA_PASSWORD
|
||||
get_docker_secret MYSQL_ROOT_PASSWORD
|
||||
get_docker_secret MYSQL_PASSWORD
|
||||
get_docker_secret PMA_HOSTS
|
||||
get_docker_secret PMA_HOST
|
||||
|
||||
exec "$@"
|
||||
+106
@@ -0,0 +1,106 @@
|
||||
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 { \
|
||||
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.1
|
||||
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; \
|
||||
fetchDeps=" \
|
||||
gnupg \
|
||||
dirmngr \
|
||||
"; \
|
||||
apt-get update; \
|
||||
apt-get install -y --no-install-recommends $fetchDeps; \
|
||||
\
|
||||
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; \
|
||||
\
|
||||
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $fetchDeps; \
|
||||
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"]
|
||||
@@ -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');
|
||||
}
|
||||
Executable
+90
@@ -0,0 +1,90 @@
|
||||
#!/bin/bash
|
||||
if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
|
||||
if [ "$(id -u)" = '0' ]; then
|
||||
case "$1" in
|
||||
apache2*)
|
||||
user="${APACHE_RUN_USER:-www-data}"
|
||||
group="${APACHE_RUN_GROUP:-www-data}"
|
||||
;;
|
||||
*) # php-fpm
|
||||
user='www-data'
|
||||
group='www-data'
|
||||
;;
|
||||
esac
|
||||
else
|
||||
user="$(id -u)"
|
||||
group="$(id -g)"
|
||||
fi
|
||||
|
||||
# Custom folders for sessions
|
||||
chown ${user}:${group} /sessions /var/nginx/client_body_temp
|
||||
|
||||
if ! [ -e index.php -a -e url.php ]; then
|
||||
echo >&2 "phpMyAdmin not found in $PWD - copying now..."
|
||||
if [ "$(ls -A)" ]; then
|
||||
echo >&2 "WARNING: $PWD is not empty - press Ctrl+C now if this is an error!"
|
||||
( set -x; ls -A; sleep 10 )
|
||||
fi
|
||||
tar --create \
|
||||
--file - \
|
||||
--one-file-system \
|
||||
--directory /usr/src/phpmyadmin \
|
||||
--owner "$user" --group "$group" \
|
||||
. | tar --extract --file -
|
||||
echo >&2 "Complete! phpMyAdmin has been successfully copied to $PWD"
|
||||
mkdir -p tmp; \
|
||||
chmod -R 777 tmp; \
|
||||
fi
|
||||
|
||||
if [ ! -f /etc/phpmyadmin/config.secret.inc.php ]; then
|
||||
cat > /etc/phpmyadmin/config.secret.inc.php <<EOT
|
||||
<?php
|
||||
\$cfg['blowfish_secret'] = '$(tr -dc 'a-zA-Z0-9~!@#$%^&*_()+}{?></";.,[]=-' < /dev/urandom | fold -w 32 | head -n 1)';
|
||||
EOT
|
||||
fi
|
||||
|
||||
if [ ! -f /etc/phpmyadmin/config.user.inc.php ]; then
|
||||
touch /etc/phpmyadmin/config.user.inc.php
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -z "${HIDE_PHP_VERSION}" ]; then
|
||||
echo "PHP version is now hidden."
|
||||
echo -e 'expose_php = Off\n' > $PHP_INI_DIR/conf.d/phpmyadmin-hide-php-version.ini
|
||||
fi
|
||||
|
||||
UPLOAD_LIMIT_INI_FILE="$PHP_INI_DIR/conf.d/phpmyadmin-upload-limit.ini"
|
||||
if [ ! -z "${UPLOAD_LIMIT}" ]; then
|
||||
echo "Adding the custom upload limit."
|
||||
echo -e "upload_max_filesize = $UPLOAD_LIMIT\npost_max_size = $UPLOAD_LIMIT\n" > $UPLOAD_LIMIT_INI_FILE
|
||||
fi
|
||||
|
||||
if [ ! -z "${PMA_CONFIG_BASE64}" ]; then
|
||||
echo "Adding the custom config.inc.php from base64."
|
||||
echo "${PMA_CONFIG_BASE64}" | base64 -d > /etc/phpmyadmin/config.inc.php
|
||||
fi
|
||||
|
||||
if [ ! -z "${PMA_USER_CONFIG_BASE64}" ]; then
|
||||
echo "Adding the custom config.user.inc.php from base64."
|
||||
echo "${PMA_USER_CONFIG_BASE64}" | base64 -d > /etc/phpmyadmin/config.user.inc.php
|
||||
fi
|
||||
|
||||
function get_docker_secret() {
|
||||
local env_var="${1}"
|
||||
local env_var_file="${env_var}_FILE"
|
||||
|
||||
# Check if the variable with name $env_var_file (which is $PMA_PASSWORD_FILE for example)
|
||||
# is not empty and export $PMA_PASSWORD as the password in the Docker secrets file
|
||||
|
||||
if [[ -n "${!env_var_file}" ]]; then
|
||||
export "${env_var}"="$(cat "${!env_var_file}")"
|
||||
fi
|
||||
}
|
||||
|
||||
get_docker_secret PMA_PASSWORD
|
||||
get_docker_secret MYSQL_ROOT_PASSWORD
|
||||
get_docker_secret MYSQL_PASSWORD
|
||||
get_docker_secret PMA_HOSTS
|
||||
get_docker_secret PMA_HOST
|
||||
|
||||
exec "$@"
|
||||
Executable
+97
@@ -0,0 +1,97 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
self="$(basename "$BASH_SOURCE")"
|
||||
cd "$(dirname "$(readlink -f "$BASH_SOURCE")")"
|
||||
|
||||
# Get the most recent commit which modified any of "$@".
|
||||
fileCommit() {
|
||||
git log -1 --format='format:%H' HEAD -- "$@"
|
||||
}
|
||||
|
||||
# Get the most recent commit which modified "$1/Dockerfile" or any file that
|
||||
# the Dockerfile copies into the rootfs (with COPY).
|
||||
dockerfileCommit() {
|
||||
local dir="$1"; shift
|
||||
(
|
||||
cd "$dir";
|
||||
fileCommit Dockerfile \
|
||||
$(git show HEAD:./Dockerfile | awk '
|
||||
toupper($1) == "COPY" {
|
||||
for (i = 2; i < NF; i++)
|
||||
print $i;
|
||||
}
|
||||
')
|
||||
)
|
||||
}
|
||||
|
||||
# depends on docker library
|
||||
#getArches() {
|
||||
# local repo="$1"; shift
|
||||
# local officialImagesUrl='https://github.com/docker-library/official-images/raw/master/library/'
|
||||
#
|
||||
# eval "declare -g -A parentRepoToArches=( $(
|
||||
# find -name 'Dockerfile' -exec awk '
|
||||
# toupper($1) == "FROM" && $2 !~ /^('"$repo"'|scratch|microsoft\/[^:]+)(:|$)/ {
|
||||
# print "'"$officialImagesUrl"'" $2
|
||||
# }
|
||||
# ' '{}' + \
|
||||
# | sort -u \
|
||||
# | xargs bashbrew cat --format '[{{ .RepoName }}:{{ .TagName }}]="{{ join " " .TagEntry.Architectures }}"'
|
||||
# ) )"
|
||||
#}
|
||||
#getArches 'phpmyadmin'
|
||||
|
||||
# Header.
|
||||
cat <<-EOH
|
||||
# This file is generated via https://github.com/phpmyadmin/docker/blob/$(fileCommit "$self")/$self
|
||||
Maintainers: Isaac Bennetch <bennetch@gmail.com>
|
||||
Michal Čihař <michal@cihar.com>
|
||||
GitRepo: https://github.com/phpmyadmin/docker.git
|
||||
EOH
|
||||
|
||||
# prints "$2$1$3$1...$N"
|
||||
join() {
|
||||
local sep="$1"; shift
|
||||
local out; printf -v out "${sep//%/%%}%s" "$@"
|
||||
echo "${out#$sep}"
|
||||
}
|
||||
|
||||
latest="$(
|
||||
git ls-remote --tags https://github.com/phpmyadmin/phpmyadmin.git \
|
||||
| cut -d/ -f3 \
|
||||
| grep -vE -- '-rc|-b' \
|
||||
| sort -V \
|
||||
| tail -1
|
||||
)"
|
||||
|
||||
for variant in apache fpm fpm-alpine; do
|
||||
commit="$(dockerfileCommit "$variant")"
|
||||
fullversion="$(git show "$commit":"$variant/Dockerfile" | awk '$1 == "ENV" && $2 == "VERSION" { print $3; exit }')"
|
||||
|
||||
versionAliases=( "$fullversion" "${fullversion%.*}" "${fullversion%.*.*}" )
|
||||
if [ "$fullversion" = "$latest" ]; then
|
||||
versionAliases+=( "latest" )
|
||||
fi
|
||||
|
||||
variantAliases=( "${versionAliases[@]/%/-$variant}" )
|
||||
variantAliases=( "${variantAliases[@]//latest-}" )
|
||||
|
||||
if [ "$variant" = "apache" ]; then
|
||||
variantAliases+=( "${versionAliases[@]}" )
|
||||
fi
|
||||
|
||||
variantParent="$(awk 'toupper($1) == "FROM" { print $2 }' "$variant/Dockerfile")"
|
||||
|
||||
# depends on docker library
|
||||
#variantArches="${parentRepoToArches[$variantParent]}"
|
||||
variantArches="amd64 arm32v7 arm64v8 i386 ppc64le"
|
||||
|
||||
cat <<-EOE
|
||||
|
||||
Tags: $(join ', ' "${variantAliases[@]}")
|
||||
Architectures: $(join ', ' $variantArches)
|
||||
GitCommit: $commit
|
||||
Directory: $variant
|
||||
EOE
|
||||
done
|
||||
@@ -1,15 +0,0 @@
|
||||
#!/bin/sh
|
||||
set -x
|
||||
|
||||
if [ ! -f /www/config.secret.inc.php ] ; then
|
||||
cat > /www/config.secret.inc.php <<EOT
|
||||
<?php
|
||||
\$cfg['blowfish_secret'] = '`cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1`';
|
||||
EOT
|
||||
fi
|
||||
|
||||
exec php -S 0.0.0.0:80 -t /www/ \
|
||||
-d upload_max_filesize=$PHP_UPLOAD_MAX_FILESIZE \
|
||||
-d post_max_size=$PHP_UPLOAD_MAX_FILESIZE \
|
||||
-d max_input_vars=$PHP_MAX_INPUT_VARS \
|
||||
-d session.save_path=/sessions
|
||||
@@ -0,0 +1,17 @@
|
||||
# Testing image for phpMyAdmin
|
||||
|
||||
FROM phpmyadmin/phpmyadmin
|
||||
|
||||
# Install test dependencies
|
||||
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 phpmyadmin_test.py test-docker.sh world.sql conftest.py /
|
||||
@@ -0,0 +1,2 @@
|
||||
<?php
|
||||
$cfg['AllowArbitraryServer'] = true;
|
||||
@@ -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")
|
||||
Executable
+77
@@ -0,0 +1,77 @@
|
||||
#!/usr/bin/env python2
|
||||
import argparse
|
||||
import os
|
||||
import subprocess
|
||||
import re
|
||||
import sys
|
||||
|
||||
import mechanize
|
||||
import tempfile
|
||||
import pytest
|
||||
|
||||
|
||||
def do_test_content(match, content):
|
||||
assert(match in content)
|
||||
|
||||
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:
|
||||
path = os.path.dirname(os.path.realpath(__file__))
|
||||
sqlfile = path + '/world.sql'
|
||||
br = mechanize.Browser()
|
||||
|
||||
# Ignore robots.txt
|
||||
br.set_handle_robots(False)
|
||||
|
||||
# Login page
|
||||
br.open(url)
|
||||
|
||||
# Fill login form
|
||||
br.select_form('login_form')
|
||||
br['pma_username'] = username
|
||||
br['pma_password'] = password
|
||||
if server is not None:
|
||||
br['pma_servername'] = server
|
||||
|
||||
# Login and check if loggged in
|
||||
response = br.submit()
|
||||
do_test_content('Server version', response.read())
|
||||
|
||||
# Open server import
|
||||
response = br.follow_link(text_regex=re.compile('Import'))
|
||||
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()
|
||||
do_test_content('5326 queries executed', response.read())
|
||||
|
||||
|
||||
def docker_secret(env_name):
|
||||
dir_path = os.path.dirname(os.path.realpath(__file__))
|
||||
secret_file = tempfile.mkstemp()
|
||||
|
||||
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]}
|
||||
|
||||
# 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')
|
||||
Executable
+89
@@ -0,0 +1,89 @@
|
||||
#!/bin/sh
|
||||
|
||||
NAME="$1"
|
||||
|
||||
if [ -n "$2" ] ; then
|
||||
PORT="$2"
|
||||
TESTSUITE_PORT=$2
|
||||
fi
|
||||
|
||||
if [ -n "$3" ] ; then
|
||||
SERVER="--server $3"
|
||||
PMA_HOST=$3
|
||||
else
|
||||
SERVER=''
|
||||
fi
|
||||
|
||||
# Set PHPMyAdmin environment
|
||||
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
|
||||
|
||||
|
||||
# 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 [ $(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}"
|
||||
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 inside container..."
|
||||
FILENAME=/phpmyadmin_test.py
|
||||
fi
|
||||
|
||||
# Perform tests
|
||||
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
|
||||
${COMMAND_HOST} ps faux
|
||||
echo "Result of ${PHPMYADMIN_DB_HOSTNAME} tests: ${RED}FAILED${NC}"
|
||||
exit $ret
|
||||
fi
|
||||
|
||||
echo "Result of ${PHPMYADMIN_DB_HOSTNAME} tests: ${GREEN}SUCCESS${NC}"
|
||||
@@ -0,0 +1,11 @@
|
||||
[program:test-mariadb]
|
||||
command=/test-docker.sh test 80 mariadb
|
||||
autostart=true
|
||||
autorestart=false
|
||||
priority=3
|
||||
startretries=1
|
||||
stopwaitsecs=20
|
||||
stdout_logfile=/dev/stdout
|
||||
stdout_logfile_maxbytes=0
|
||||
stderr_logfile=/dev/stderr
|
||||
stderr_logfile_maxbytes=0
|
||||
@@ -0,0 +1,11 @@
|
||||
[program:test-mysql]
|
||||
command=/test-docker.sh test 80 db_server
|
||||
autostart=true
|
||||
autorestart=false
|
||||
priority=3
|
||||
startretries=1
|
||||
stopwaitsecs=20
|
||||
stdout_logfile=/dev/stdout
|
||||
stdout_logfile_maxbytes=0
|
||||
stderr_logfile=/dev/stderr
|
||||
stderr_logfile_maxbytes=0
|
||||
@@ -0,0 +1,2 @@
|
||||
[mysqld]
|
||||
default_authentication_plugin = mysql_native_password
|
||||
+5395
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,36 @@
|
||||
#!/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')"
|
||||
|
||||
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/%%VARIANT%%/'"$variant"'/;
|
||||
s/%%CMD%%/'"${cmd[$variant]}"'/;
|
||||
' "$variant/Dockerfile"
|
||||
done
|
||||
Reference in New Issue
Block a user