mirror of
https://github.com/phpmyadmin/docker.git
synced 2026-08-24 10:13:22 -05:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5a80b52270 | ||
|
|
4bce58ddab | ||
|
|
fc38d23ff1 | ||
|
|
739bbbbe8c | ||
|
|
6bfaf085b4 | ||
|
|
04b3786429 | ||
|
|
5e91d468ca | ||
|
|
0c64340e5d | ||
|
|
24c2f1f855 | ||
|
|
6515c2bd9c | ||
|
|
7d51494097 | ||
|
|
188a0e3542 | ||
|
|
5d89c078f2 | ||
|
|
216be795f7 | ||
|
|
5043535036 | ||
|
|
22f2d4a373 | ||
|
|
ab37078704 | ||
|
|
9fca4e0022 | ||
|
|
240506356c | ||
|
|
04de4ca2ba | ||
|
|
ea2d5dc8fd | ||
|
|
bb0fd043c3 | ||
|
|
812039a7de | ||
|
|
577a94fda6 | ||
|
|
ec0d6a5c3a | ||
|
|
788475217f | ||
|
|
2b712de361 | ||
|
|
9c06d07727 | ||
|
|
a0e0282c91 | ||
|
|
e1fe998378 | ||
|
|
12b0f347cb | ||
|
|
f79c7073ab | ||
|
|
0109a4fbdd | ||
|
|
a0e2d0f499 | ||
|
|
4cbf9ef735 | ||
|
|
6a4843e99d | ||
|
|
998a6d85ab | ||
|
|
8831312555 | ||
|
|
928a52ebcb | ||
|
|
752da8f2d9 | ||
|
|
88b594a77f | ||
|
|
2d6be82ec6 | ||
|
|
e3f29d8d2e | ||
|
|
2335c3151b | ||
|
|
6a687794c6 | ||
|
|
6d69b7796b | ||
|
|
6070d87f73 | ||
|
|
50b7203dbf | ||
|
|
aa656af9c5 | ||
|
|
79a51154c1 | ||
|
|
215f36692f | ||
|
|
3e0bcce10e | ||
|
|
272944cc5a | ||
|
|
6517adbfe3 | ||
|
|
30db079919 | ||
|
|
da4b8f273a | ||
|
|
692333aa2d | ||
|
|
8674356a6d | ||
|
|
a5b42082a8 | ||
|
|
3c0561bd6e | ||
|
|
636af2024a | ||
|
|
1c138c510c | ||
|
|
813fcf8410 | ||
|
|
d10b78cde4 | ||
|
|
644a36f7a0 | ||
|
|
2d43a62d20 | ||
|
|
328b498f51 | ||
|
|
b3cb5de98e | ||
|
|
87e2c6a325 | ||
|
|
87bbb8dd8f | ||
|
|
ab6a09ad9f | ||
|
|
37b7cff908 | ||
|
|
adf9118a38 | ||
|
|
a6c091bd8c | ||
|
|
d455a71d95 | ||
|
|
948bf2d147 | ||
|
|
e1da7554b4 | ||
|
|
a31c702cd5 | ||
|
|
7432be89e0 | ||
|
|
67f9b75357 | ||
|
|
9a7991c3f2 | ||
|
|
271a3e6a3e | ||
|
|
6d73dc8728 | ||
|
|
e68cbb87af | ||
|
|
5ee9a9ced5 | ||
|
|
2cb9a6214e | ||
|
|
4a5875f495 | ||
|
|
5239485cfc | ||
|
|
f650628a76 | ||
|
|
dbfffe50c7 | ||
|
|
fb5c1a2104 | ||
|
|
7967e63883 | ||
|
|
0730e5188e | ||
|
|
47a3db45ad | ||
|
|
f8edb1ca87 | ||
|
|
a03d55e76a | ||
|
|
0006406e35 | ||
|
|
7f5a48b7c3 | ||
|
|
bb70a46858 | ||
|
|
88f6d787d0 | ||
|
|
a1772debe4 | ||
|
|
b0305371a4 | ||
|
|
1241428f99 | ||
|
|
fa108dc809 | ||
|
|
d1f327e462 | ||
|
|
c59f287b98 | ||
|
|
a5fd64c9fb | ||
|
|
e6f53b6f8e | ||
|
|
71d54acc93 | ||
|
|
c3e03b7429 | ||
|
|
83bd66d27f | ||
|
|
1effd43182 | ||
|
|
908e79d246 | ||
|
|
010de91f3c | ||
|
|
7e5dd3b39d | ||
|
|
9b09f1ae4c | ||
|
|
80ce7025ac | ||
|
|
0c1b04d2fc | ||
|
|
031d27ad30 | ||
|
|
905cae841e | ||
|
|
0ed2e6651b | ||
|
|
df4d08c1a8 | ||
|
|
0c9a5f06d5 | ||
|
|
918d2639a9 | ||
|
|
3f1f550631 | ||
|
|
9b6fb4229f | ||
|
|
8b33eefd53 | ||
|
|
095161cdb1 | ||
|
|
b936b8ebd1 | ||
|
|
5ab888d0d4 | ||
|
|
fee52fdd0b | ||
|
|
3c16423f78 | ||
|
|
0b7054a449 | ||
|
|
6718899e83 | ||
|
|
aa6481613d | ||
|
|
0f9d9d2630 | ||
|
|
336ba22d89 | ||
|
|
545fcca480 | ||
|
|
3c859c0511 | ||
|
|
347512bfc4 | ||
|
|
d621982217 | ||
|
|
cc19f8ada1 | ||
|
|
c0cd783445 | ||
|
|
326191915b | ||
|
|
cddd8dda1b | ||
|
|
a9851bbd0c | ||
|
|
b057ee3d89 | ||
|
|
90bc75ac92 | ||
|
|
026ddf5c11 | ||
|
|
2b79d71002 | ||
|
|
4dd05de348 | ||
|
|
7c28533a32 | ||
|
|
056d2b51fd | ||
|
|
030928a01e | ||
|
|
a73a82a790 | ||
|
|
0f4250dc7f | ||
|
|
17b7a91289 | ||
|
|
886f7ae6e3 | ||
|
|
1655371fb0 | ||
|
|
60c187d10d | ||
|
|
3dafd123f8 | ||
|
|
e8ade8e3b1 | ||
|
|
12e6fdf738 | ||
|
|
935605b8d0 | ||
|
|
4482d47ca7 | ||
|
|
3d8c2ba403 | ||
|
|
e09f731a32 | ||
|
|
d383a98040 | ||
|
|
bd7de17631 | ||
|
|
49a7e0fba7 | ||
|
|
b0beabb4ed | ||
|
|
1a7be47268 | ||
|
|
8dc7e66dec | ||
|
|
d6ab5de683 | ||
|
|
e1bfab5583 | ||
|
|
3ba3be3492 | ||
|
|
4537d1869c | ||
|
|
d7b3994b3a | ||
|
|
d91c4ba999 | ||
|
|
56fbf97a95 | ||
|
|
71627ad719 | ||
|
|
568e5ed308 | ||
|
|
a4dd0817f0 | ||
|
|
508c9b991c | ||
|
|
5d45c24548 | ||
|
|
4e6ed4b275 | ||
|
|
d0f71fbf3b | ||
|
|
a66e868fd0 | ||
|
|
9322b7afdf | ||
|
|
0225133981 | ||
|
|
d6da7ca981 | ||
|
|
76b8d29695 | ||
|
|
00ad857703 | ||
|
|
b2edf5d8fd | ||
|
|
4b1fe4dc6f | ||
|
|
a2b0f3a5c0 | ||
|
|
a3a4c4e0fd | ||
|
|
06cc93a972 | ||
|
|
7f5e91546b | ||
|
|
7e3ee4e83c | ||
|
|
1465223b65 | ||
|
|
a8ab7d86e7 | ||
|
|
5e1ea11678 | ||
|
|
497becb0f2 | ||
|
|
ba8ecc42f1 | ||
|
|
3b0375d811 | ||
|
|
4f54fc3b46 | ||
|
|
af6cdca3b6 | ||
|
|
785cd48c48 | ||
|
|
301a7c4d18 | ||
|
|
ad9f085601 | ||
|
|
ff56a56a29 | ||
|
|
e3b575ca8e | ||
|
|
b9da1f2c54 | ||
|
|
d00506237d | ||
|
|
39cec98bb5 | ||
|
|
300ade5226 | ||
|
|
76651f53b3 | ||
|
|
9d66e78f8a | ||
|
|
85a642d7b3 | ||
|
|
6e3aeb3adf | ||
|
|
c0b2ac28f9 | ||
|
|
52d6fe4caf | ||
|
|
f464cf5a67 | ||
|
|
d1f2dea243 | ||
|
|
27f6f7e5ae | ||
|
|
490df186e5 | ||
|
|
d826f3a721 | ||
|
|
12d40a0300 | ||
|
|
48f16c0dde | ||
|
|
0dbbe66eb3 | ||
|
|
4d5c71ca6e | ||
|
|
459489d8c1 | ||
|
|
ac3c819a69 | ||
|
|
34c0696109 | ||
|
|
3a9dc863e2 | ||
|
|
6c9a35dc6e | ||
|
|
26be7daa0c | ||
|
|
6b63869f1c | ||
|
|
a4071cd297 | ||
|
|
e05baec603 | ||
|
|
6cd68f9647 | ||
|
|
48f555eb3d | ||
|
|
8c9962be4f | ||
|
|
30fea9d2f4 | ||
|
|
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 | ||
|
|
e713caa214 | ||
|
|
cce91f08d4 | ||
|
|
9d0dec3d2e | ||
|
|
563bcafcec | ||
|
|
0bc8b4025b | ||
|
|
812590e038 | ||
|
|
7d6f729bc6 | ||
|
|
593d7f5f96 |
@@ -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,51 @@
|
||||
name: GitHub CI
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
schedule:
|
||||
- cron: 0 0 * * 0
|
||||
|
||||
defaults:
|
||||
run:
|
||||
shell: 'bash -Eeuo pipefail -x {0}'
|
||||
|
||||
jobs:
|
||||
|
||||
generate-jobs:
|
||||
name: Generate Jobs
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
strategy: ${{ steps.generate-jobs.outputs.strategy }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: docker-library/bashbrew@v0.1.12
|
||||
- id: generate-jobs
|
||||
name: Generate Jobs
|
||||
run: |
|
||||
strategy="$(GITHUB_REPOSITORY=phpmyadmin "$BASHBREW_SCRIPTS/github-actions/generate.sh")"
|
||||
echo "strategy=$strategy" >> "$GITHUB_OUTPUT"
|
||||
jq . <<<"$strategy" # sanity check / debugging aid
|
||||
|
||||
test:
|
||||
needs: generate-jobs
|
||||
strategy: ${{ fromJson(needs.generate-jobs.outputs.strategy) }}
|
||||
name: ${{ matrix.name }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Prepare Environment
|
||||
run: ${{ matrix.runs.prepare }}
|
||||
- name: Pull Dependencies
|
||||
run: ${{ matrix.runs.pull }}
|
||||
- name: Build ${{ matrix.name }}
|
||||
run: ${{ matrix.runs.build }}
|
||||
- name: History ${{ matrix.name }}
|
||||
run: ${{ matrix.runs.history }}
|
||||
- name: Test ${{ matrix.name }}
|
||||
run: ${{ matrix.runs.test }}
|
||||
- name: '"docker images"'
|
||||
run: ${{ matrix.runs.images }}
|
||||
@@ -0,0 +1,73 @@
|
||||
name: Internal test suite
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
|
||||
jobs:
|
||||
test-apache-container:
|
||||
name: Test (${{ matrix.configuration }}) on database ${{ matrix.database-image }}
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
database-image: [
|
||||
"mariadb:10.6",
|
||||
"mariadb:10.11",
|
||||
"mariadb:11.4",
|
||||
"mariadb:latest",
|
||||
"mysql:5.7",
|
||||
"mysql:8.4",
|
||||
"mysql:latest"
|
||||
]
|
||||
configuration: [
|
||||
"default",
|
||||
"one-host",
|
||||
"one-socket-host",
|
||||
"config-mount-dir",
|
||||
"fs-import-export",
|
||||
"different-apache-port",
|
||||
"run-as-www-data"
|
||||
]
|
||||
include:
|
||||
- {
|
||||
database-image: "mariadb:10.6",
|
||||
configuration: "one-ssl-host"
|
||||
}
|
||||
- {
|
||||
database-image: "mariadb:10.11",
|
||||
configuration: "one-ssl-host"
|
||||
}
|
||||
- {
|
||||
database-image: "mariadb:11.4",
|
||||
configuration: "one-ssl-host"
|
||||
}
|
||||
- {
|
||||
database-image: "mariadb:latest",
|
||||
configuration: "one-ssl-host"
|
||||
}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Generate the testing keys
|
||||
if: ${{ contains(matrix.configuration, 'one-ssl-host') }}
|
||||
run: ./testing/generate-keys.sh
|
||||
- name: Switch to MySQL compatible ENVs
|
||||
if: ${{ contains(matrix.database-image, 'mysql') }}
|
||||
working-directory: ./testing/docker-compose/
|
||||
run: sed -i 's/MARIADB_ROOT_PASSWORD/MYSQL_ROOT_PASSWORD/' ./docker-compose.testing-${{ matrix.configuration }}.yml
|
||||
- name: Switch to MySQL compatible healthcheck
|
||||
if: ${{ contains(matrix.database-image, 'mysql') }}
|
||||
working-directory: ./testing/docker-compose/
|
||||
run: sed -i 's/mariadb-admin/mysqladmin/' ./docker-compose.testing-${{ matrix.configuration }}.yml
|
||||
- name: Build images
|
||||
working-directory: ./testing/
|
||||
run: docker compose -f ./docker-compose/docker-compose.testing-${{ matrix.configuration }}.yml build
|
||||
- name: Run ${{ matrix.configuration }} tests
|
||||
working-directory: ./testing/
|
||||
run: docker compose -f ./docker-compose/docker-compose.testing-${{ matrix.configuration }}.yml up --build --abort-on-container-exit --exit-code-from=sut
|
||||
env:
|
||||
DB: ${{ matrix.database-image }}
|
||||
@@ -1 +1,7 @@
|
||||
config.secret.inc.php
|
||||
__pycache__
|
||||
.pytest_cache
|
||||
.vscode
|
||||
.history
|
||||
.venv
|
||||
testing/*.pem
|
||||
|
||||
-41
@@ -1,41 +0,0 @@
|
||||
sudo: required
|
||||
|
||||
services:
|
||||
- docker
|
||||
|
||||
env:
|
||||
matrix:
|
||||
- DB=mysql:5.7
|
||||
- DB=mariadb:10.0
|
||||
|
||||
before_install:
|
||||
- docker run --name db_server -e MYSQL_ROOT_PASSWORD=my-secret-pw -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
|
||||
+102
@@ -0,0 +1,102 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||
|
||||
## [5.2.3.1] - 2025-10-08
|
||||
|
||||
- Remove leftover uploadprogress.tar.gz download after installation (#465)
|
||||
|
||||
## [5.2.3] - 2025-10-08
|
||||
|
||||
- Update to PHP 8.3
|
||||
- Enable the `uploadprogress` extension
|
||||
|
||||
## [5.2.2] - 2025-01-21
|
||||
|
||||
- Add `TZ` env var to change PHP `date.timezone` (#133)
|
||||
- Update to PHP 8.2 (#411)
|
||||
- Add back a `/sessions` volume for sessions persistence (#399)
|
||||
- Support adding custom configurations in `/etc/phpmyadmin/conf.d` (#401)
|
||||
- Fix for Debian 12 issue (#416) that caused libraries for extensions to be uninstalled
|
||||
- Add extension `bcmath` for 2nd factor authentication (#415)
|
||||
- Refactor `update.sh` (#408)
|
||||
- Enable remoteip mod for Apache (#434)
|
||||
- Add support for `PMA_SSL` and `PMA_SSLS` to enable SSL connection (#441)
|
||||
- Fixed looping through `$sockets` using the same index variable `$i` interferes with the last server id (#186)
|
||||
- Add support for `PMA_SSL_VERIFY` and `PMA_SSL_VERIFIES` (#448)
|
||||
- Add support for `PMA_SSL_CA` and `PMA_SSL_CAS` (#448)
|
||||
- Add support for `PMA_SSL_CERT` and `PMA_SSL_CERTS` (#448)
|
||||
- Add support for `PMA_SSL_KEY` and `PMA_SSL_KEYS` (#448)
|
||||
- Also add `PMA_SSL_DIR` to define the dir where SSL files are generated for `_BASE64` prefixed variables
|
||||
- Support `PMA_SSL_CA_BASE64` and `PMA_SSL_CAS_BASE64` as variables that contain the file contents (#448)
|
||||
- Support `PMA_SSL_KEY_BASE64` and `PMA_SSL_KEYS_BASE64` as variables that contain the file contents (#448)
|
||||
- Support `PMA_SSL_CERT_BASE64` and `PMA_SSL_CERTS_BASE64` as variables that contain the file contents (#448)
|
||||
|
||||
## [5.2.1] - 2023-02-08
|
||||
|
||||
- Move docker-compose test files into a folder
|
||||
- Fix the section about E2E tests in `README.md`
|
||||
- Support docker secrets from file for `PMA_USER` (#372)
|
||||
- Support docker secrets from file for `PMA_CONTROLUSER` (#372)
|
||||
- Support docker secrets from file for `PMA_CONTROLHOST` (#372)
|
||||
- Allow a different Apache port with `APACHE_PORT` (#340)
|
||||
- Add support for ENVs `PMA_UPLOADDIR` and `PMA_SAVEDIR` (#384)
|
||||
- Fixed a bug with `APACHE_PORT` ENV on container restart (#381)
|
||||
- Update to PHP 8.1 (#393)
|
||||
- Add support for ENV `TZ`
|
||||
|
||||
## [5.1.4] - 2022-05-11
|
||||
|
||||
- Fix incorrect image tag name in `README.md`
|
||||
|
||||
## [5.1.2] - 2022-01-22
|
||||
|
||||
- Fix GPG keyservers in Dockerfiles
|
||||
- Remove microbadger badges, it closed
|
||||
- Improve the README file
|
||||
- Fix add back composer.json and remove non needed source files (#345)
|
||||
- Update to PHP 8.0 (#325)
|
||||
|
||||
## [5.1.1] - 2021-06-04
|
||||
|
||||
- Improve documentation
|
||||
|
||||
## [5.1.0] - 2021-02-24
|
||||
|
||||
- Set ini setting `max_input_vars = 10000`
|
||||
- Add support for ENV `PMA_QUERYHISTORYMAX`
|
||||
- Add support for ENV `MAX_EXECUTION_TIME`
|
||||
- Add support for ENV `MEMORY_LIMIT`
|
||||
- Move to GitHub actions
|
||||
- Re-work the test system
|
||||
- Support docker secrets from file for `PMA_CONTROLPASS`
|
||||
- Generate phpmyadmin-misc.ini from ENVs
|
||||
|
||||
## [4.9.{6,7}] - 2020-10-{10,16} and [5.0.{3,4}] - 2020-10-{10,16}
|
||||
|
||||
- Add `tzdata` package
|
||||
- Extract downloaded files directly to web root `/var/www/html/` (#277)
|
||||
- Add SHA checksum when downloading a version
|
||||
- Improved `UPLOAD_LIMIT` documentation
|
||||
- Update documentation from `phpmyadmin/phpmyadmin` to `phpmyadmin`
|
||||
- `phpmyadmin` is now the official image in the Docker official library
|
||||
|
||||
## [5.0.2] - 2020-03-21
|
||||
|
||||
- Add org.opencontainers.image.* labels
|
||||
- Apply some feedback from docker-library team to Dockerfiles
|
||||
|
||||
## [4.9.3] - 2020-01-02 and [5.0.0] - 2019-12-26
|
||||
|
||||
- Add support for ENV `HIDE_PHP_VERSION` to set ini setting `expose_php = Off`
|
||||
- Add support for ENV `UPLOAD_LIMIT` to set `upload_max_filesize` and `post_max_size` ini settings
|
||||
- Add support for ENVs `PMA_CONFIG_BASE64` and `PMA_USER_CONFIG_BASE64` (#192)
|
||||
- Support docker secrets from files for `PMA_PASSWORD`, `MYSQL_ROOT_PASSWORD` and `MYSQL_PASSWORD`
|
||||
- Support docker secrets from files for `PMA_HOSTS` and `PMA_HOST`
|
||||
|
||||
## [4.9.2-2] - 2020-12-20
|
||||
|
||||
- Update to PHP 7.4 (#257)
|
||||
- Drop ini setting `opcache.enable_cli=1`
|
||||
-21
@@ -1,21 +0,0 @@
|
||||
# Switch back to stable once 3.4 is out
|
||||
FROM alpine:edge
|
||||
|
||||
RUN apk add --no-cache php5-cli php5-mysqli php5-ctype php5-xml php5-gd php5-zlib php5-openssl php5-curl php5-opcache php5-json php5-mcrypt 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,145 @@
|
||||
FROM php:%%PHP_VERSION%%-%%VARIANT%%
|
||||
|
||||
ENV UPLOAD_PROGRESS_EXT_URL="https://github.com/php/pecl-php-uploadprogress/archive/refs/tags/uploadprogress-2.0.2.tar.gz"
|
||||
ENV UPLOAD_PROGRESS_SHA256="fe3f6cdfcedad563c970c4fd1cda31e422cfc0df5cc9a217d8c80ed3c8d137f5"
|
||||
|
||||
# install and docker-entrypoint.sh dependencies
|
||||
RUN apk add --no-cache \
|
||||
bash \
|
||||
tzdata \
|
||||
gnupg
|
||||
|
||||
# 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 \
|
||||
; \
|
||||
\
|
||||
mkdir -p /usr/src/php/ext/uploadprogress; \
|
||||
curl -fsSL -o /usr/src/php/ext/uploadprogress.tar.gz "$UPLOAD_PROGRESS_EXT_URL"; \
|
||||
echo "$UPLOAD_PROGRESS_SHA256 /usr/src/php/ext/uploadprogress.tar.gz" | sha256sum -c -; \
|
||||
tar -xf /usr/src/php/ext/uploadprogress.tar.gz -C /usr/src/php/ext/uploadprogress --strip-components=1; \
|
||||
\
|
||||
docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp --with-xpm; \
|
||||
docker-php-ext-install -j "$(nproc)" \
|
||||
bz2 \
|
||||
gd \
|
||||
mysqli \
|
||||
opcache \
|
||||
zip \
|
||||
bcmath \
|
||||
uploadprogress \
|
||||
; \
|
||||
\
|
||||
rm -r /usr/src/php/ext/uploadprogress /usr/src/php/ext/uploadprogress.tar.gz; \
|
||||
\
|
||||
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 --no-network --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
|
||||
ENV PMA_SSL_DIR=/etc/phpmyadmin/ssl
|
||||
ENV MAX_EXECUTION_TIME=600
|
||||
ENV MEMORY_LIMIT=512M
|
||||
ENV UPLOAD_LIMIT=2048K
|
||||
ENV TZ=UTC
|
||||
ENV SESSION_SAVE_PATH=/sessions
|
||||
RUN set -ex; \
|
||||
mkdir $SESSION_SAVE_PATH; \
|
||||
mkdir -p $PMA_SSL_DIR; \
|
||||
chmod 1777 $SESSION_SAVE_PATH; \
|
||||
chmod 755 $PMA_SSL_DIR; \
|
||||
chown www-data:www-data /etc/phpmyadmin; \
|
||||
chown www-data:www-data $PMA_SSL_DIR; \
|
||||
chown www-data:www-data $SESSION_SAVE_PATH; \
|
||||
\
|
||||
{ \
|
||||
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=${MAX_EXECUTION_TIME}'; \
|
||||
echo 'max_input_vars=10000'; \
|
||||
echo 'memory_limit=${MEMORY_LIMIT}'; \
|
||||
echo 'post_max_size=${UPLOAD_LIMIT}'; \
|
||||
echo 'upload_max_filesize=${UPLOAD_LIMIT}'; \
|
||||
echo 'date.timezone=${TZ}'; \
|
||||
echo 'session.save_path=${SESSION_SAVE_PATH}'; \
|
||||
} > $PHP_INI_DIR/conf.d/phpmyadmin-misc.ini
|
||||
|
||||
USER www-data:www-data
|
||||
|
||||
# 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; \
|
||||
\
|
||||
export GNUPGHOME="$(mktemp -d)"; \
|
||||
export GPGKEY="%%GPG_KEY%%"; \
|
||||
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 keyserver.ubuntu.com --recv-keys "$GPGKEY" \
|
||||
|| gpg --batch --keyserver pgp.mit.edu --recv-keys "$GPGKEY" \
|
||||
|| gpg --batch --keyserver keyserver.pgp.com --recv-keys "$GPGKEY" \
|
||||
|| gpg --batch --keyserver keys.openpgp.org --recv-keys "$GPGKEY"; \
|
||||
gpg --batch --verify phpMyAdmin.tar.xz.asc phpMyAdmin.tar.xz; \
|
||||
tar -xf phpMyAdmin.tar.xz -C /var/www/html --strip-components=1; \
|
||||
mkdir -p /var/www/html/tmp; \
|
||||
gpgconf --kill all; \
|
||||
rm -r "$GNUPGHOME" phpMyAdmin.tar.xz phpMyAdmin.tar.xz.asc; \
|
||||
rm -r -v /var/www/html/setup/ /var/www/html/examples/ /var/www/html/js/src/ /var/www/html/babel.config.json /var/www/html/doc/html/_sources/ /var/www/html/RELEASE-DATE-$VERSION /var/www/html/CONTRIBUTING.md; \
|
||||
grep -q -F "'configFile' => ROOT_PATH . 'config.inc.php'," /var/www/html/libraries/vendor_config.php; \
|
||||
sed -i "s@'configFile' => .*@'configFile' => '/etc/phpmyadmin/config.inc.php',@" /var/www/html/libraries/vendor_config.php; \
|
||||
grep -q -F "'configFile' => '/etc/phpmyadmin/config.inc.php'," /var/www/html/libraries/vendor_config.php; \
|
||||
php -l /var/www/html/libraries/vendor_config.php; \
|
||||
find /var/www/html -type d -exec chmod 555 {} \;; \
|
||||
find /var/www/html -type f -exec chmod 444 {} \;; \
|
||||
chmod 1777 /var/www/html/tmp;
|
||||
|
||||
# Copy configuration
|
||||
COPY --chown=www-data:www-data config.inc.php /etc/phpmyadmin/config.inc.php
|
||||
COPY --chown=www-data:www-data helpers.php /etc/phpmyadmin/helpers.php
|
||||
|
||||
# Copy main script
|
||||
COPY docker-entrypoint.sh /docker-entrypoint.sh
|
||||
|
||||
USER root
|
||||
ENTRYPOINT [ "/docker-entrypoint.sh" ]
|
||||
CMD ["%%CMD%%"]
|
||||
@@ -0,0 +1,159 @@
|
||||
FROM php:%%PHP_VERSION%%-%%VARIANT%%
|
||||
|
||||
ENV UPLOAD_PROGRESS_EXT_URL="https://github.com/php/pecl-php-uploadprogress/archive/refs/tags/uploadprogress-2.0.2.tar.gz"
|
||||
ENV UPLOAD_PROGRESS_SHA256="fe3f6cdfcedad563c970c4fd1cda31e422cfc0df5cc9a217d8c80ed3c8d137f5"
|
||||
|
||||
# Install dependencies
|
||||
RUN set -ex; \
|
||||
\
|
||||
apt-get update; \
|
||||
apt-get install -y --no-install-recommends \
|
||||
gnupg \
|
||||
dirmngr \
|
||||
; \
|
||||
\
|
||||
savedAptMark="$(apt-mark showmanual)"; \
|
||||
\
|
||||
apt-get install -y --no-install-recommends \
|
||||
libbz2-dev \
|
||||
libfreetype6-dev \
|
||||
libjpeg-dev \
|
||||
libpng-dev \
|
||||
libwebp-dev \
|
||||
libxpm-dev \
|
||||
libzip-dev \
|
||||
; \
|
||||
\
|
||||
mkdir -p /usr/src/php/ext/uploadprogress; \
|
||||
curl -fsSL -o /usr/src/php/ext/uploadprogress.tar.gz "$UPLOAD_PROGRESS_EXT_URL"; \
|
||||
echo "$UPLOAD_PROGRESS_SHA256 /usr/src/php/ext/uploadprogress.tar.gz" | sha256sum -c -; \
|
||||
tar -xf /usr/src/php/ext/uploadprogress.tar.gz -C /usr/src/php/ext/uploadprogress --strip-components=1; \
|
||||
\
|
||||
docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp --with-xpm; \
|
||||
docker-php-ext-install -j "$(nproc)" \
|
||||
bz2 \
|
||||
gd \
|
||||
mysqli \
|
||||
opcache \
|
||||
zip \
|
||||
bcmath \
|
||||
uploadprogress \
|
||||
; \
|
||||
\
|
||||
rm -r /usr/src/php/ext/uploadprogress /usr/src/php/ext/uploadprogress.tar.gz; \
|
||||
\
|
||||
apt-mark auto '.*' > /dev/null; \
|
||||
apt-mark manual $savedAptMark; \
|
||||
extdir="$(php -r 'echo ini_get("extension_dir");')"; \
|
||||
ldd "$extdir"/*.so \
|
||||
| awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); print so }' \
|
||||
| sort -u \
|
||||
| xargs -r dpkg-query -S \
|
||||
| cut -d: -f1 \
|
||||
| sort -u \
|
||||
| xargs -rt apt-mark manual; \
|
||||
\
|
||||
# start: Apache specific build
|
||||
a2enmod remoteip; \
|
||||
# end: Apache specific build
|
||||
\
|
||||
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
|
||||
rm -rf /var/lib/apt/lists/*; \
|
||||
ldd "$extdir"/*.so | grep -qzv "=> not found" || (echo "Sanity check failed: missing libraries:"; ldd "$extdir"/*.so | grep " => not found"; exit 1); \
|
||||
ldd "$extdir"/*.so | grep -q "libzip.so.* => .*/libzip.so.*" || (echo "Sanity check failed: libzip.so is not referenced"; ldd "$extdir"/*.so; exit 1); \
|
||||
err="$(php --version 3>&1 1>&2 2>&3)"; \
|
||||
[ -z "$err" ] || (echo "Sanity check failed: php returned errors; $err"; exit 1;);
|
||||
|
||||
# set recommended PHP.ini settings
|
||||
# see https://secure.php.net/manual/en/opcache.installation.php
|
||||
ENV PMA_SSL_DIR=/etc/phpmyadmin/ssl
|
||||
ENV MAX_EXECUTION_TIME=600
|
||||
ENV MEMORY_LIMIT=512M
|
||||
ENV UPLOAD_LIMIT=2048K
|
||||
ENV TZ=UTC
|
||||
ENV SESSION_SAVE_PATH=/sessions
|
||||
RUN set -ex; \
|
||||
mkdir $SESSION_SAVE_PATH; \
|
||||
mkdir -p $PMA_SSL_DIR; \
|
||||
chmod 1777 $SESSION_SAVE_PATH; \
|
||||
chmod 755 $PMA_SSL_DIR; \
|
||||
chown www-data:www-data /etc/phpmyadmin; \
|
||||
chown www-data:www-data $PMA_SSL_DIR; \
|
||||
chown www-data:www-data $SESSION_SAVE_PATH; \
|
||||
\
|
||||
{ \
|
||||
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=${MAX_EXECUTION_TIME}'; \
|
||||
echo 'max_input_vars=10000'; \
|
||||
echo 'memory_limit=${MEMORY_LIMIT}'; \
|
||||
echo 'post_max_size=${UPLOAD_LIMIT}'; \
|
||||
echo 'upload_max_filesize=${UPLOAD_LIMIT}'; \
|
||||
echo 'date.timezone=${TZ}'; \
|
||||
echo 'session.save_path=${SESSION_SAVE_PATH}'; \
|
||||
} > $PHP_INI_DIR/conf.d/phpmyadmin-misc.ini
|
||||
|
||||
USER www-data:www-data
|
||||
|
||||
# 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; \
|
||||
export GNUPGHOME="$(mktemp -d)"; \
|
||||
export GPGKEY="%%GPG_KEY%%"; \
|
||||
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 keyserver.ubuntu.com --recv-keys "$GPGKEY" \
|
||||
|| gpg --batch --keyserver pgp.mit.edu --recv-keys "$GPGKEY" \
|
||||
|| gpg --batch --keyserver keyserver.pgp.com --recv-keys "$GPGKEY" \
|
||||
|| gpg --batch --keyserver keys.openpgp.org --recv-keys "$GPGKEY"; \
|
||||
gpg --batch --verify phpMyAdmin.tar.xz.asc phpMyAdmin.tar.xz; \
|
||||
tar -xf phpMyAdmin.tar.xz -C /var/www/html --strip-components=1; \
|
||||
mkdir -p /var/www/html/tmp; \
|
||||
gpgconf --kill all; \
|
||||
rm -r "$GNUPGHOME" phpMyAdmin.tar.xz phpMyAdmin.tar.xz.asc; \
|
||||
rm -r -v /var/www/html/setup/ /var/www/html/examples/ /var/www/html/js/src/ /var/www/html/babel.config.json /var/www/html/doc/html/_sources/ /var/www/html/RELEASE-DATE-$VERSION /var/www/html/CONTRIBUTING.md; \
|
||||
grep -q -F "'configFile' => ROOT_PATH . 'config.inc.php'," /var/www/html/libraries/vendor_config.php; \
|
||||
sed -i "s@'configFile' => .*@'configFile' => '/etc/phpmyadmin/config.inc.php',@" /var/www/html/libraries/vendor_config.php; \
|
||||
grep -q -F "'configFile' => '/etc/phpmyadmin/config.inc.php'," /var/www/html/libraries/vendor_config.php; \
|
||||
php -l /var/www/html/libraries/vendor_config.php; \
|
||||
find /var/www/html -type d -exec chmod 555 {} \;; \
|
||||
find /var/www/html -type f -exec chmod 444 {} \;; \
|
||||
chmod 1777 /var/www/html/tmp;
|
||||
|
||||
# Copy configuration
|
||||
COPY --chown=www-data:www-data config.inc.php /etc/phpmyadmin/config.inc.php
|
||||
COPY --chown=www-data:www-data helpers.php /etc/phpmyadmin/helpers.php
|
||||
|
||||
# Copy main script
|
||||
COPY docker-entrypoint.sh /docker-entrypoint.sh
|
||||
|
||||
USER root
|
||||
ENTRYPOINT [ "/docker-entrypoint.sh" ]
|
||||
CMD ["%%CMD%%"]
|
||||
@@ -1,28 +1,39 @@
|
||||
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
|
||||
docker compose -f ./testing/docker-compose/docker-compose.testing-default.yml up -d
|
||||
|
||||
testing-%:
|
||||
docker compose -p "phpmyadmin_$@" -f ./testing/docker-compose/docker-compose.$@.yml up --build --abort-on-container-exit --exit-code-from=sut
|
||||
docker compose -p "phpmyadmin_$@" -f ./testing/docker-compose/docker-compose.$@.yml down
|
||||
|
||||
run-tests: testing-default testing-one-host testing-one-socket-host testing-config-mount-dir testing-fs-import-export testing-different-apache-port testing-run-as-www-data testing-one-ssl-host
|
||||
|
||||
logs:
|
||||
docker-compose -f docker-compose.testing.yml logs
|
||||
docker compose -f ./testing/docker-compose/docker-compose.testing-default.yml logs
|
||||
|
||||
clean: stop rm prune
|
||||
|
||||
stop:
|
||||
docker-compose -f docker-compose.testing.yml stop
|
||||
docker compose -f ./testing/docker-compose/docker-compose.testing-default.yml stop
|
||||
|
||||
rm:
|
||||
docker-compose -f docker-compose.testing.yml rm
|
||||
docker compose -f ./testing/docker-compose/docker-compose.testing-default.yml rm
|
||||
|
||||
prune:
|
||||
docker rm `docker ps -q -a --filter status=exited`
|
||||
|
||||
@@ -1,67 +1,267 @@
|
||||
# Official phpMyAdmin Docker image
|
||||
|
||||
Run phpMyAdmin with Alpine and PHP built in web server.
|
||||
Note that since phpMyAdmin has been accepted in to the [official DockerHub repository](https://hub.docker.com/_/phpmyadmin), you can use
|
||||
either that or this older [phpMyAdmin repository](https://hub.docker.com/r/phpmyadmin/phpmyadmin/) for your Docker installation. This
|
||||
is maintained as a courtesy to users who have not migrated.
|
||||
|
||||
[](https://travis-ci.org/phpmyadmin/docker)
|
||||
[][hub]
|
||||
[][hub]
|
||||
Run phpMyAdmin with Alpine, Apache and PHP FPM.
|
||||
|
||||
[](https://github.com/phpmyadmin/docker/actions?query=workflow%3A%22GitHub+CI%22)
|
||||
[](https://doi-janky.infosiftr.net/job/update.sh/job/phpmyadmin/)
|
||||
[](https://doi-janky.infosiftr.net/job/multiarch/job/amd64/job/phpmyadmin)
|
||||
[](https://doi-janky.infosiftr.net/job/multiarch/job/arm32v5/job/phpmyadmin)
|
||||
[](https://doi-janky.infosiftr.net/job/multiarch/job/arm32v6/job/phpmyadmin)
|
||||
[](https://doi-janky.infosiftr.net/job/multiarch/job/arm32v7/job/phpmyadmin)
|
||||
[](https://doi-janky.infosiftr.net/job/multiarch/job/arm64v8/job/phpmyadmin)
|
||||
[](https://doi-janky.infosiftr.net/job/multiarch/job/i386/job/phpmyadmin)
|
||||
[](https://doi-janky.infosiftr.net/job/multiarch/job/mips64le/job/phpmyadmin)
|
||||
[](https://doi-janky.infosiftr.net/job/multiarch/job/ppc64le/job/phpmyadmin)
|
||||
[](https://doi-janky.infosiftr.net/job/multiarch/job/s390x/job/phpmyadmin)
|
||||
[][hub]
|
||||
[][hub]
|
||||
|
||||
All following examples will bring you phpMyAdmin on `http://localhost:8080`
|
||||
All of the following examples will bring you phpMyAdmin on `http://localhost:8080`
|
||||
where you can enjoy your happy MySQL administration.
|
||||
|
||||
## Credentials
|
||||
|
||||
phpMyAdmin connects using your MySQL server credentials. Please check your corresponding
|
||||
database server image for information on the default username and password or how to specify your own custom credentials during installation.
|
||||
|
||||
The official MySQL and MariaDB images use the 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-fpm-alpine`. Note that, on rare occasion, there may be an intermediary "docker-only" release, such as 4.9.2-1
|
||||
|
||||
A complete list of tags is [available at Docker Hub](https://hub.docker.com/_/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 separate 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 separate webserver. If you need more tools that are not available on Alpine Linux, use the fpm image instead.
|
||||
|
||||
## Usage with linked server
|
||||
|
||||
First you need to run MySQL or MariaDB server in Docker, and this image need
|
||||
link a running mysql instance container:
|
||||
First you need to run a MySQL or MariaDB server in Docker, and the phpMyAdmin image needs to be
|
||||
linked to the running database container:
|
||||
|
||||
```
|
||||
docker run --name myadmin -d --link mysql_db_server:db -p 8080:80 phpmyadmin/phpmyadmin
|
||||
```sh
|
||||
docker run --name phpmyadmin -d --link mysql_db_server:db -p 8080:80 phpmyadmin:latest
|
||||
```
|
||||
|
||||
## Usage with external server
|
||||
|
||||
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:
|
||||
You can specify a MySQL host in the `PMA_HOST` environment variable. You can also
|
||||
use `PMA_PORT` to specify the 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
|
||||
```sh
|
||||
docker run --name phpmyadmin -d -e PMA_HOST=dbhost -p 8080:80 phpmyadmin:latest
|
||||
```
|
||||
|
||||
## Usage with arbitrary server
|
||||
|
||||
You can use arbitrary servers by adding ENV variable `PMA_ARBITRARY=1` to the startup command:
|
||||
You can use arbitrary servers by adding the environment 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
|
||||
```sh
|
||||
docker run --name phpmyadmin -d -e PMA_ARBITRARY=1 -p 8080:80 phpmyadmin:latest
|
||||
```
|
||||
|
||||
## Usage with docker-compose and arbitrary server
|
||||
## Usage with docker compose and an arbitrary server
|
||||
|
||||
This will run phpMyAdmin with arbitrary server - allowing you to specify MySQL/MariaDB
|
||||
server on login page.
|
||||
This will run phpMyAdmin with the arbitrary server option - allowing you to specify any MySQL/MariaDB
|
||||
server on the login page.
|
||||
|
||||
Using the docker-compose.yml from https://github.com/phpmyadmin/docker
|
||||
```yaml
|
||||
version: '3.1'
|
||||
|
||||
```
|
||||
docker-compose up -d
|
||||
services:
|
||||
db:
|
||||
image: mariadb:10.11
|
||||
restart: always
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: notSecureChangeMe
|
||||
|
||||
phpmyadmin:
|
||||
image: phpmyadmin
|
||||
restart: always
|
||||
ports:
|
||||
- 8080:80
|
||||
environment:
|
||||
- PMA_ARBITRARY=1
|
||||
```
|
||||
|
||||
## Usage behind reverse proxys
|
||||
## 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:
|
||||
|
||||
```sh
|
||||
-v /some/local/directory/config.user.inc.php:/etc/phpmyadmin/config.user.inc.php
|
||||
```
|
||||
|
||||
On the `docker run` line like this:
|
||||
|
||||
```sh
|
||||
docker run --name phpmyadmin -d --link mysql_db_server:db -p 8080:80 -v /some/local/directory/config.user.inc.php:/etc/phpmyadmin/config.user.inc.php phpmyadmin:latest
|
||||
```
|
||||
|
||||
Be sure to have `<?php` as your first line of the configuration file or the contents will not be detected as PHP code.
|
||||
|
||||
Example:
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
$cfg['ShowPhpInfo'] = true; // Adds a link to phpinfo() on the home page
|
||||
```
|
||||
|
||||
See the following links for config file information:
|
||||
|
||||
- https://docs.phpmyadmin.net/en/latest/config.html#config
|
||||
- https://docs.phpmyadmin.net/en/latest/setup.html
|
||||
|
||||
## Adding custom configuration in `/etc/phpmyadmin/conf.d`
|
||||
|
||||
you can also consider storing your custom configuration files in the folder `/etc/phpmyadmin/conf.d`, which is very suitable for managing multiple phpMyAdmin configuration files for different hosts,Then you can create `server-1.php`, `server-2.php`, or any file name you want, and store them in the conf.d directory mounted on the host.
|
||||
|
||||
On the `docker run` line like this:
|
||||
|
||||
```sh
|
||||
docker run --name phpmyadmin -d --link mysql_db_server:db -p 8080:80 -v /some/local/directory/conf.d:/etc/phpmyadmin/conf.d:ro phpmyadmin:latest
|
||||
```
|
||||
|
||||
## Usage behind a reverse proxy
|
||||
|
||||
Set the variable ``PMA_ABSOLUTE_URI`` to the fully-qualified path (``https://pma.example.net/``) where the reverse proxy makes phpMyAdmin available.
|
||||
|
||||
## Sessions persistence
|
||||
|
||||
In order to keep your sessions active between container updates you will need to mount the `/sessions` folder.
|
||||
|
||||
```sh
|
||||
-v /some/local/directory/sessions:/sessions:rw
|
||||
```
|
||||
|
||||
## Connect to the database over SSL
|
||||
|
||||
Set the variable ``PMA_SSL`` to `1` to enable SSL usage from phpMyAdmin to the MySQL server.
|
||||
The default value is `0`.
|
||||
The variable ``PMA_SSLS`` can be used as a comma seperated sequence of `0` and `1` where multiple hosts are mentioned.
|
||||
Values order must follow the ``PMA_HOSTS`` and will be computed accordingly.
|
||||
|
||||
```sh
|
||||
docker run --name phpmyadmin -d -e PMA_HOSTS=sslhost -e PMA_SSL=1 -p 8080:80 phpmyadmin:latest
|
||||
```
|
||||
|
||||
```sh
|
||||
docker run --name phpmyadmin -d -e PMA_HOSTS='sslhost,nosslhost' -e PMA_SSLS='1,0' -p 8080:80 phpmyadmin:latest
|
||||
```
|
||||
|
||||
## 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_PORT`` - define port of the MySQL server
|
||||
* ``PMA_HOSTS`` - define comma separated list of address/host names of the MySQL servers
|
||||
* ``PMA_USER`` and ``PMA_PASSWORD`` - define username to use for config authentication method
|
||||
* ``PMA_ABSOLUTE_URI`` - define user-facing URI
|
||||
* ``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_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_SOCKET`` - define socket file for the MySQL connection
|
||||
- ``PMA_SOCKETS`` - define comma separated list of socket files for the MySQL connections
|
||||
- ``PMA_SSL_DIR`` - define the path used for SSL files generated from environement variables, default value is `/etc/phpmyadmin/ssl`
|
||||
- ``PMA_SSL`` - when set to 1, defines SSL usage for the MySQL connection
|
||||
- ``PMA_SSLS`` - comma separated list of `0` and `1` defining SSL usage for the corresponding MySQL connections
|
||||
- ``PMA_SSL_VERIFY`` - when set to 1, enables SSL certificate verification for the MySQL connection.
|
||||
- ``PMA_SSL_VERIFIES`` - comma-separated list of `0` and `1` to enable or disable SSL certificate verification for multiple MySQL connections.
|
||||
- ``PMA_SSL_CA`` - in the context of mutual TLS security, allows setting your CA certificate file as a string inside the default `config.inc.php`.
|
||||
- ``PMA_SSL_CAS`` - in the context of mutual TLS security, allows setting multiple CA certificate files as a comma-separated list of strings inside the default `config.inc.php`.
|
||||
- ``PMA_SSL_CERT`` - in the context of mutual TLS security, allows setting your certificate file as a string inside the default `config.inc.php`.
|
||||
- ``PMA_SSL_CERTS`` - in the context of mutual TLS security, allows setting multiple certificate files as a comma-separated list of strings inside the default `config.inc.php`.
|
||||
- ``PMA_SSL_KEY`` - in the context of mutual TLS security, allows setting your private key file as a string inside the default `config.inc.php`.
|
||||
- ``PMA_SSL_KEYS`` - in the context of mutual TLS security, allows setting multiple private key files as a comma-separated list of strings inside the default `config.inc.php`.
|
||||
- ``PMA_USER`` and ``PMA_PASSWORD`` - define username and password to use only with the `config` authentication method
|
||||
- ``PMA_ABSOLUTE_URI`` - the full URL to phpMyAdmin. Sometimes needed when used in a reverse-proxy configuration. Don't set this unless needed. See [documentation](https://docs.phpmyadmin.net/en/latest/config.html#cfg_PmaAbsoluteUri).
|
||||
- ``PMA_CONFIG_BASE64`` - if set, this option will override the default `config.inc.php` with the base64 decoded contents of the variable
|
||||
- ``PMA_USER_CONFIG_BASE64`` - if set, this option will override the default `config.user.inc.php` with the base64 decoded contents of the variable
|
||||
- ``PMA_UPLOADDIR`` - if defined, this option will set the path where files can be saved to be available to import ([$cfg['UploadDir']](https://docs.phpmyadmin.net/en/latest/config.html#cfg_UploadDir))
|
||||
- ``PMA_SAVEDIR`` - if defined, this option will set the path where exported files can be saved ([$cfg['SaveDir']](https://docs.phpmyadmin.net/en/latest/config.html#cfg_SaveDir))
|
||||
- ``PMA_CONTROLHOST`` - when set, this points to an alternate database host used for storing the [phpMyAdmin Configuration Storage database](https://docs.phpmyadmin.net/en/latest/setup.html#phpmyadmin-configuration-storage) database
|
||||
- ``PMA_CONTROLPORT`` - if set, will override the default port (3306) for connecting to the control host for storing the [phpMyAdmin Configuration Storage database](https://docs.phpmyadmin.net/en/latest/setup.html#phpmyadmin-configuration-storage) database
|
||||
- ``PMA_PMADB`` - define the name of the database to be used for the [phpMyAdmin Configuration Storage database](https://docs.phpmyadmin.net/en/latest/setup.html#phpmyadmin-configuration-storage). When not set, the advanced features are not enabled by default: they can still potentially be enabled by the user when logging in with the zero conf (zero configuration) feature. Suggested values: `phpmyadmin` or `pmadb`
|
||||
- ``PMA_CONTROLUSER`` - define the username for phpMyAdmin to use for advanced features (the [controluser](https://docs.phpmyadmin.net/en/latest/config.html#cfg_Servers_controluser))
|
||||
- ``PMA_CONTROLPASS`` - define the password for phpMyAdmin to use with the [controluser](https://docs.phpmyadmin.net/en/latest/config.html#cfg_Servers_controlpass)
|
||||
- ``PMA_QUERYHISTORYDB`` - when set [to true](https://docs.phpmyadmin.net/en/latest/config.html#cfg_QueryHistoryDB), enables storing [SQL history](https://docs.phpmyadmin.net/en/latest/config.html#cfg_Servers_history) to the [phpMyAdmin Configuration Storage database](https://docs.phpmyadmin.net/en/latest/setup.html#phpmyadmin-configuration-storage). When [false](https://docs.phpmyadmin.net/en/latest/config.html#cfg_QueryHistoryDB), history is stored in the browser and is cleared when logging out
|
||||
- ``PMA_QUERYHISTORYMAX`` - when set to an integer, controls the number of history items. See [documentation](https://docs.phpmyadmin.net/en/latest/config.html#cfg_QueryHistoryMax). Defaults to `25`.
|
||||
- ``MAX_EXECUTION_TIME`` - if set, will override the maximum execution time in seconds (default 600) for phpMyAdmin ([$cfg['ExecTimeLimit']](https://docs.phpmyadmin.net/en/latest/config.html#cfg_ExecTimeLimit)) and PHP [max_execution_time](https://www.php.net/manual/en/info.configuration.php#ini.max-execution-time) (format as `[0-9+]`)
|
||||
- ``MEMORY_LIMIT`` - if set, will override the memory limit (default 512M) for phpMyAdmin ([$cfg['MemoryLimit']](https://docs.phpmyadmin.net/en/latest/config.html#cfg_MemoryLimit)) and PHP [memory_limit](https://www.php.net/manual/en/ini.core.php#ini.memory-limit) (format as `[0-9+](K,M,G)` where K is for Kilobytes, M for Megabytes, G for Gigabytes and 1K = 1024 bytes)
|
||||
- ``UPLOAD_LIMIT`` - if set, this option will override the default value for apache and php-fpm (format as `[0-9+](K,M,G)` default value is 2048K, this will change ``upload_max_filesize`` and ``post_max_size`` values)
|
||||
- ``TZ`` - if defined, this option will change the default PHP `date.timezone` from `UTC`. See [documentation](https://www.php.net/manual/en/timezones.php) for supported values.
|
||||
- ``HIDE_PHP_VERSION`` - if defined, this option will hide the PHP version (`expose_php = Off`). Set to any value (such as `HIDE_PHP_VERSION=true`).
|
||||
- ``APACHE_PORT`` - if defined, this option will change the default Apache port from `80` in case you want it to run on a different port like an unprivileged port. Set to any port value (such as `APACHE_PORT=8090`)
|
||||
|
||||
For 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):
|
||||
|
||||
[hub]: https://hub.docker.com/r/phpmyadmin/phpmyadmin/
|
||||
```sh
|
||||
docker run --name phpmyadmin -d -e PMA_PASSWORD_FILE=/run/secrets/db_password.txt -p 8080:80 phpmyadmin:latest
|
||||
```
|
||||
|
||||
#### Variables that can store the file contents using ``_BASE64``
|
||||
|
||||
- `PMA_SSL_CA`
|
||||
- `PMA_SSL_CAS`
|
||||
- `PMA_SSL_KEY`
|
||||
- `PMA_SSL_KEYS`
|
||||
- `PMA_SSL_CERT`
|
||||
- `PMA_SSL_CERTS`
|
||||
|
||||
Also includes: `PMA_CONFIG_BASE64` or `PMA_USER_CONFIG_BASE64`.
|
||||
|
||||
For example, the variable would be named `PMA_SSL_CA_BASE64` and the value is the base64 encoded contents of the file.
|
||||
|
||||
#### Variables that can be read from a file using ``_FILE``
|
||||
|
||||
- `MYSQL_ROOT_PASSWORD`
|
||||
- `MYSQL_PASSWORD`
|
||||
- `PMA_USER`
|
||||
- `PMA_PASSWORD`
|
||||
- `PMA_HOSTS`
|
||||
- `PMA_HOST`
|
||||
- `PMA_CONTROLHOST`
|
||||
- `PMA_CONTROLUSER`
|
||||
- `PMA_CONTROLPASS`
|
||||
|
||||
## Run the E2E tests for this docker image
|
||||
|
||||
You can run the E2E test suite on a local test environment.
|
||||
The Requirements are `make`, `docker` and the `docker compose` plugin.
|
||||
|
||||
Clone this repository: `https://github.com/phpmyadmin/docker.git`
|
||||
|
||||
And then run this command to start the test suite:
|
||||
```sh
|
||||
make run-tests
|
||||
```
|
||||
|
||||
For more detailed documentation see https://docs.phpmyadmin.net/en/latest/setup.html#installing-using-docker
|
||||
|
||||
[hub]: https://hub.docker.com/_/phpmyadmin
|
||||
|
||||
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,160 @@
|
||||
# DO NOT EDIT: created by update.sh from Dockerfile-debian.template
|
||||
FROM php:8.3-apache
|
||||
|
||||
ENV UPLOAD_PROGRESS_EXT_URL="https://github.com/php/pecl-php-uploadprogress/archive/refs/tags/uploadprogress-2.0.2.tar.gz"
|
||||
ENV UPLOAD_PROGRESS_SHA256="fe3f6cdfcedad563c970c4fd1cda31e422cfc0df5cc9a217d8c80ed3c8d137f5"
|
||||
|
||||
# Install dependencies
|
||||
RUN set -ex; \
|
||||
\
|
||||
apt-get update; \
|
||||
apt-get install -y --no-install-recommends \
|
||||
gnupg \
|
||||
dirmngr \
|
||||
; \
|
||||
\
|
||||
savedAptMark="$(apt-mark showmanual)"; \
|
||||
\
|
||||
apt-get install -y --no-install-recommends \
|
||||
libbz2-dev \
|
||||
libfreetype6-dev \
|
||||
libjpeg-dev \
|
||||
libpng-dev \
|
||||
libwebp-dev \
|
||||
libxpm-dev \
|
||||
libzip-dev \
|
||||
; \
|
||||
\
|
||||
mkdir -p /usr/src/php/ext/uploadprogress; \
|
||||
curl -fsSL -o /usr/src/php/ext/uploadprogress.tar.gz "$UPLOAD_PROGRESS_EXT_URL"; \
|
||||
echo "$UPLOAD_PROGRESS_SHA256 /usr/src/php/ext/uploadprogress.tar.gz" | sha256sum -c -; \
|
||||
tar -xf /usr/src/php/ext/uploadprogress.tar.gz -C /usr/src/php/ext/uploadprogress --strip-components=1; \
|
||||
\
|
||||
docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp --with-xpm; \
|
||||
docker-php-ext-install -j "$(nproc)" \
|
||||
bz2 \
|
||||
gd \
|
||||
mysqli \
|
||||
opcache \
|
||||
zip \
|
||||
bcmath \
|
||||
uploadprogress \
|
||||
; \
|
||||
\
|
||||
rm -r /usr/src/php/ext/uploadprogress /usr/src/php/ext/uploadprogress.tar.gz; \
|
||||
\
|
||||
apt-mark auto '.*' > /dev/null; \
|
||||
apt-mark manual $savedAptMark; \
|
||||
extdir="$(php -r 'echo ini_get("extension_dir");')"; \
|
||||
ldd "$extdir"/*.so \
|
||||
| awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); print so }' \
|
||||
| sort -u \
|
||||
| xargs -r dpkg-query -S \
|
||||
| cut -d: -f1 \
|
||||
| sort -u \
|
||||
| xargs -rt apt-mark manual; \
|
||||
\
|
||||
# start: Apache specific build
|
||||
a2enmod remoteip; \
|
||||
# end: Apache specific build
|
||||
\
|
||||
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
|
||||
rm -rf /var/lib/apt/lists/*; \
|
||||
ldd "$extdir"/*.so | grep -qzv "=> not found" || (echo "Sanity check failed: missing libraries:"; ldd "$extdir"/*.so | grep " => not found"; exit 1); \
|
||||
ldd "$extdir"/*.so | grep -q "libzip.so.* => .*/libzip.so.*" || (echo "Sanity check failed: libzip.so is not referenced"; ldd "$extdir"/*.so; exit 1); \
|
||||
err="$(php --version 3>&1 1>&2 2>&3)"; \
|
||||
[ -z "$err" ] || (echo "Sanity check failed: php returned errors; $err"; exit 1;);
|
||||
|
||||
# set recommended PHP.ini settings
|
||||
# see https://secure.php.net/manual/en/opcache.installation.php
|
||||
ENV PMA_SSL_DIR=/etc/phpmyadmin/ssl
|
||||
ENV MAX_EXECUTION_TIME=600
|
||||
ENV MEMORY_LIMIT=512M
|
||||
ENV UPLOAD_LIMIT=2048K
|
||||
ENV TZ=UTC
|
||||
ENV SESSION_SAVE_PATH=/sessions
|
||||
RUN set -ex; \
|
||||
mkdir $SESSION_SAVE_PATH; \
|
||||
mkdir -p $PMA_SSL_DIR; \
|
||||
chmod 1777 $SESSION_SAVE_PATH; \
|
||||
chmod 755 $PMA_SSL_DIR; \
|
||||
chown www-data:www-data /etc/phpmyadmin; \
|
||||
chown www-data:www-data $PMA_SSL_DIR; \
|
||||
chown www-data:www-data $SESSION_SAVE_PATH; \
|
||||
\
|
||||
{ \
|
||||
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=${MAX_EXECUTION_TIME}'; \
|
||||
echo 'max_input_vars=10000'; \
|
||||
echo 'memory_limit=${MEMORY_LIMIT}'; \
|
||||
echo 'post_max_size=${UPLOAD_LIMIT}'; \
|
||||
echo 'upload_max_filesize=${UPLOAD_LIMIT}'; \
|
||||
echo 'date.timezone=${TZ}'; \
|
||||
echo 'session.save_path=${SESSION_SAVE_PATH}'; \
|
||||
} > $PHP_INI_DIR/conf.d/phpmyadmin-misc.ini
|
||||
|
||||
USER www-data:www-data
|
||||
|
||||
# Calculate download URL
|
||||
ENV VERSION=5.2.3
|
||||
ENV SHA256=57881348297c4412f86c410547cf76b4d8a236574dd2c6b7d6a2beebe7fc44e3
|
||||
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; \
|
||||
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 keyserver.ubuntu.com --recv-keys "$GPGKEY" \
|
||||
|| gpg --batch --keyserver pgp.mit.edu --recv-keys "$GPGKEY" \
|
||||
|| gpg --batch --keyserver keyserver.pgp.com --recv-keys "$GPGKEY" \
|
||||
|| gpg --batch --keyserver keys.openpgp.org --recv-keys "$GPGKEY"; \
|
||||
gpg --batch --verify phpMyAdmin.tar.xz.asc phpMyAdmin.tar.xz; \
|
||||
tar -xf phpMyAdmin.tar.xz -C /var/www/html --strip-components=1; \
|
||||
mkdir -p /var/www/html/tmp; \
|
||||
gpgconf --kill all; \
|
||||
rm -r "$GNUPGHOME" phpMyAdmin.tar.xz phpMyAdmin.tar.xz.asc; \
|
||||
rm -r -v /var/www/html/setup/ /var/www/html/examples/ /var/www/html/js/src/ /var/www/html/babel.config.json /var/www/html/doc/html/_sources/ /var/www/html/RELEASE-DATE-$VERSION /var/www/html/CONTRIBUTING.md; \
|
||||
grep -q -F "'configFile' => ROOT_PATH . 'config.inc.php'," /var/www/html/libraries/vendor_config.php; \
|
||||
sed -i "s@'configFile' => .*@'configFile' => '/etc/phpmyadmin/config.inc.php',@" /var/www/html/libraries/vendor_config.php; \
|
||||
grep -q -F "'configFile' => '/etc/phpmyadmin/config.inc.php'," /var/www/html/libraries/vendor_config.php; \
|
||||
php -l /var/www/html/libraries/vendor_config.php; \
|
||||
find /var/www/html -type d -exec chmod 555 {} \;; \
|
||||
find /var/www/html -type f -exec chmod 444 {} \;; \
|
||||
chmod 1777 /var/www/html/tmp;
|
||||
|
||||
# Copy configuration
|
||||
COPY --chown=www-data:www-data config.inc.php /etc/phpmyadmin/config.inc.php
|
||||
COPY --chown=www-data:www-data helpers.php /etc/phpmyadmin/helpers.php
|
||||
|
||||
# Copy main script
|
||||
COPY docker-entrypoint.sh /docker-entrypoint.sh
|
||||
|
||||
USER root
|
||||
ENTRYPOINT [ "/docker-entrypoint.sh" ]
|
||||
CMD ["apache2-foreground"]
|
||||
@@ -0,0 +1,246 @@
|
||||
<?php
|
||||
|
||||
require_once '/etc/phpmyadmin/config.secret.inc.php';
|
||||
require_once '/etc/phpmyadmin/helpers.php';
|
||||
|
||||
/* Ensure we got the environment */
|
||||
$vars = [
|
||||
'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',
|
||||
'PMA_QUERYHISTORYMAX',
|
||||
'MAX_EXECUTION_TIME',
|
||||
'MEMORY_LIMIT',
|
||||
'PMA_UPLOADDIR',
|
||||
'PMA_SAVEDIR',
|
||||
'PMA_SSL',
|
||||
'PMA_SSLS',
|
||||
'PMA_SSL_DIR',
|
||||
'PMA_SSL_VERIFY',
|
||||
'PMA_SSL_VERIFIES',
|
||||
'PMA_SSL_CA',
|
||||
'PMA_SSL_CAS',
|
||||
'PMA_SSL_CA_BASE64',
|
||||
'PMA_SSL_CAS_BASE64',
|
||||
'PMA_SSL_KEY',
|
||||
'PMA_SSL_KEYS',
|
||||
'PMA_SSL_KEY_BASE64',
|
||||
'PMA_SSL_KEYS_BASE64',
|
||||
'PMA_SSL_CERT',
|
||||
'PMA_SSL_CERTS',
|
||||
'PMA_SSL_CERT_BASE64',
|
||||
'PMA_SSL_CERTS_BASE64',
|
||||
];
|
||||
|
||||
foreach ($vars as $var) {
|
||||
$env = getenv($var);
|
||||
if (!isset($_ENV[$var]) && $env !== false) {
|
||||
$_ENV[$var] = $env;
|
||||
}
|
||||
}
|
||||
|
||||
if (! defined('PMA_SSL_DIR')) {
|
||||
define('PMA_SSL_DIR', $_ENV['PMA_SSL_DIR'] ?? '/etc/phpmyadmin/ssl');
|
||||
}
|
||||
|
||||
if (isset($_ENV['PMA_QUERYHISTORYDB'])) {
|
||||
$cfg['QueryHistoryDB'] = (bool) $_ENV['PMA_QUERYHISTORYDB'];
|
||||
}
|
||||
|
||||
if (isset($_ENV['PMA_QUERYHISTORYMAX'])) {
|
||||
$cfg['QueryHistoryMax'] = (int) $_ENV['PMA_QUERYHISTORYMAX'];
|
||||
}
|
||||
|
||||
/* 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']);
|
||||
}
|
||||
|
||||
if (isset($_ENV['PMA_SSL_CA_BASE64'])) {
|
||||
$_ENV['PMA_SSL_CA'] = decodeBase64AndSaveFiles($_ENV['PMA_SSL_CA_BASE64'], 'phpmyadmin-ssl-CA', 'pem', PMA_SSL_DIR);
|
||||
}
|
||||
|
||||
/* Decode and save the SSL key from base64 */
|
||||
if (isset($_ENV['PMA_SSL_KEY_BASE64'])) {
|
||||
$_ENV['PMA_SSL_KEY'] = decodeBase64AndSaveFiles($_ENV['PMA_SSL_KEY_BASE64'], 'phpmyadmin-ssl-CERT', 'cert', PMA_SSL_DIR);
|
||||
}
|
||||
|
||||
/* Decode and save the SSL certificate from base64 */
|
||||
if (isset($_ENV['PMA_SSL_CERT_BASE64'])) {
|
||||
$_ENV['PMA_SSL_CERT'] = decodeBase64AndSaveFiles($_ENV['PMA_SSL_CERT_BASE64'], 'phpmyadmin-ssl-CERT', 'cert', PMA_SSL_DIR);
|
||||
}
|
||||
|
||||
/* Decode and save multiple SSL CA certificates from base64 */
|
||||
if (isset($_ENV['PMA_SSL_CAS_BASE64'])) {
|
||||
$_ENV['PMA_SSL_CAS'] = decodeBase64AndSaveFiles($_ENV['PMA_SSL_CAS_BASE64'], 'phpmyadmin-ssl-CA', 'pem', PMA_SSL_DIR);
|
||||
}
|
||||
|
||||
/* Decode and save multiple SSL keys from base64 */
|
||||
if (isset($_ENV['PMA_SSL_KEYS_BASE64'])) {
|
||||
$_ENV['PMA_SSL_KEYS'] = decodeBase64AndSaveFiles($_ENV['PMA_SSL_KEYS_BASE64'], 'phpmyadmin-ssl-CERT', 'cert', PMA_SSL_DIR);
|
||||
}
|
||||
|
||||
/* Decode and save multiple SSL certificates from base64 */
|
||||
if (isset($_ENV['PMA_SSL_CERTS_BASE64'])) {
|
||||
$_ENV['PMA_SSL_CERTS'] = decodeBase64AndSaveFiles($_ENV['PMA_SSL_CERTS_BASE64'], 'phpmyadmin-ssl-KEY', 'key', PMA_SSL_DIR);
|
||||
}
|
||||
|
||||
/* Figure out hosts */
|
||||
|
||||
/* Fallback to default linked */
|
||||
$hosts = ['db'];
|
||||
|
||||
/* Set by environment */
|
||||
if (! empty($_ENV['PMA_HOST'])) {
|
||||
$hosts = [$_ENV['PMA_HOST']];
|
||||
$verbose = [$_ENV['PMA_VERBOSE']];
|
||||
$ports = [$_ENV['PMA_PORT']];
|
||||
$ssls = [$_ENV['PMA_SSL']];
|
||||
$ssl_verifies = [$_ENV['PMA_SSL_VERIFY']];
|
||||
$ssl_cas = [$_ENV['PMA_SSL_CA']];
|
||||
$ssl_keys = [$_ENV['PMA_SSL_KEY']];
|
||||
$ssl_certs = [$_ENV['PMA_SSL_CERT']];
|
||||
} 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']));
|
||||
$ssls = array_map('trim', explode(',', $_ENV['PMA_SSLS']));
|
||||
$ssl_verifies = array_map('trim', explode(',', $_ENV['PMA_SSL_VERIFIES']));
|
||||
$ssl_cas = array_map('trim', explode(',', $_ENV['PMA_SSL_CAS']));
|
||||
$ssl_keys = array_map('trim', explode(',', $_ENV['PMA_SSL_KEYS']));
|
||||
$ssl_certs = array_map('trim', explode(',', $_ENV['PMA_SSL_CERTS']));
|
||||
}
|
||||
|
||||
if (! empty($_ENV['PMA_SOCKET'])) {
|
||||
$sockets = [$_ENV['PMA_SOCKET']];
|
||||
} elseif (! empty($_ENV['PMA_SOCKETS'])) {
|
||||
$sockets = explode(',', $_ENV['PMA_SOCKETS']);
|
||||
}
|
||||
|
||||
/* Server settings */
|
||||
for ($i = 1; isset($hosts[$i - 1]); $i++) {
|
||||
if (isset($ssls[$i - 1]) && $ssls[$i - 1] === '1') {
|
||||
$cfg['Servers'][$i]['ssl'] = $ssls[$i - 1];
|
||||
}
|
||||
if (isset($ssl_verifies[$i - 1]) && $ssl_verifies[$i - 1] === '1') {
|
||||
$cfg['Servers'][$i]['ssl_verify'] = $ssl_verifies[$i - 1];
|
||||
}
|
||||
if (isset($ssl_cas[$i - 1])) {
|
||||
$cfg['Servers'][$i]['ssl_ca'] = $ssl_cas[$i - 1];
|
||||
}
|
||||
if (isset($ssl_keys[$i - 1])) {
|
||||
$cfg['Servers'][$i]['ssl_key'] = $ssl_keys[$i - 1];
|
||||
}
|
||||
if (isset($ssl_certs[$i - 1])) {
|
||||
$cfg['Servers'][$i]['ssl_cert'] = $ssl_certs[$i - 1];
|
||||
}
|
||||
$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;
|
||||
}
|
||||
// Avoid overwriting the last server id $i, use another variable name
|
||||
for ($socketHostId = 1; isset($sockets[$socketHostId - 1]); $socketHostId++) {
|
||||
$cfg['Servers'][$socketHostId]['socket'] = $sockets[$socketHostId - 1];
|
||||
$cfg['Servers'][$socketHostId]['host'] = 'localhost';
|
||||
}
|
||||
/*
|
||||
* Revert back to last configured server to make
|
||||
* it easier in config.user.inc.php
|
||||
*/
|
||||
$i--;
|
||||
|
||||
/* Uploads setup */
|
||||
if (isset($_ENV['PMA_UPLOADDIR'])) {
|
||||
$cfg['UploadDir'] = $_ENV['PMA_UPLOADDIR'];
|
||||
}
|
||||
|
||||
if (isset($_ENV['PMA_SAVEDIR'])) {
|
||||
$cfg['SaveDir'] = $_ENV['PMA_SAVEDIR'];
|
||||
}
|
||||
|
||||
if (isset($_ENV['MAX_EXECUTION_TIME'])) {
|
||||
$cfg['ExecTimeLimit'] = $_ENV['MAX_EXECUTION_TIME'];
|
||||
}
|
||||
|
||||
if (isset($_ENV['MEMORY_LIMIT'])) {
|
||||
$cfg['MemoryLimit'] = $_ENV['MEMORY_LIMIT'];
|
||||
}
|
||||
|
||||
/* Include User Defined Settings Hook */
|
||||
if (file_exists('/etc/phpmyadmin/config.user.inc.php')) {
|
||||
include '/etc/phpmyadmin/config.user.inc.php';
|
||||
}
|
||||
|
||||
/* Support additional configurations */
|
||||
if (is_dir('/etc/phpmyadmin/conf.d/')) {
|
||||
foreach (glob('/etc/phpmyadmin/conf.d/*.php') as $filename) {
|
||||
include $filename;
|
||||
}
|
||||
}
|
||||
Executable
+63
@@ -0,0 +1,63 @@
|
||||
#!/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
|
||||
chgrp www-data /etc/phpmyadmin/config.secret.inc.php
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
# start: Apache specific settings
|
||||
if [ -n "${APACHE_PORT+x}" ]; then
|
||||
echo "Setting apache port to ${APACHE_PORT}."
|
||||
sed -i "/VirtualHost \*:80/c\\<VirtualHost \*:${APACHE_PORT}\>" /etc/apache2/sites-enabled/000-default.conf
|
||||
sed -i "/Listen 80/c\Listen ${APACHE_PORT}" /etc/apache2/ports.conf
|
||||
apachectl configtest
|
||||
fi
|
||||
# end: Apache specific settings
|
||||
|
||||
get_docker_secret() {
|
||||
local env_var="${1}"
|
||||
local env_var_file="${env_var}_FILE"
|
||||
|
||||
# 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_USER
|
||||
get_docker_secret PMA_PASSWORD
|
||||
get_docker_secret MYSQL_ROOT_PASSWORD
|
||||
get_docker_secret MYSQL_PASSWORD
|
||||
get_docker_secret PMA_HOSTS
|
||||
get_docker_secret PMA_HOST
|
||||
get_docker_secret PMA_CONTROLHOST
|
||||
get_docker_secret PMA_CONTROLUSER
|
||||
get_docker_secret PMA_CONTROLPASS
|
||||
|
||||
exec "$@"
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Helper function to decode and save multiple SSL files from base64.
|
||||
*
|
||||
* @param string $base64FilesContents The base64 encoded string containing multiple files separated by commas.
|
||||
* If no commas are present, the entire string is treated as a single file.
|
||||
* @param string $prefix The prefix to use for the generated file names.
|
||||
* @param string $extension The file extension to use for the generated files.
|
||||
* @param string $storageFolder The folder where to store the generated files.
|
||||
*
|
||||
* @return string A comma-separated list of paths to the generated files.
|
||||
*/
|
||||
function decodeBase64AndSaveFiles(string $base64FilesContents, string $prefix, string $extension, string $storageFolder): string
|
||||
{
|
||||
// Ensure the output directory exists
|
||||
if (! is_dir($storageFolder)) {
|
||||
mkdir($storageFolder, 0755, true);
|
||||
}
|
||||
|
||||
// Split the base64 string into an array of files
|
||||
$base64FilesContents = explode(',', trim($base64FilesContents));
|
||||
$counter = 1;
|
||||
$outputFiles = [];
|
||||
|
||||
// Process each file
|
||||
foreach ($base64FilesContents as $base64FileContent) {
|
||||
$outputFile = $storageFolder . '/' . $prefix . '-' . $counter . '.' . $extension;
|
||||
|
||||
$fileContent = base64_decode($base64FileContent, true);
|
||||
if ($fileContent === false) {
|
||||
echo 'Failed to decode: ' . $base64FileContent;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// Write the decoded file to the output directory
|
||||
if (file_put_contents($outputFile, $fileContent) === false) {
|
||||
echo 'Failed to write to ' . $outputFile;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// Add the output file path to the list
|
||||
$outputFiles[] = $outputFile;
|
||||
$counter++;
|
||||
}
|
||||
|
||||
// Return a comma-separated list of the generated file paths
|
||||
return implode(',', $outputFiles);
|
||||
}
|
||||
+202
-19
@@ -1,23 +1,71 @@
|
||||
<?php
|
||||
|
||||
require('./config.secret.inc.php');
|
||||
require_once '/etc/phpmyadmin/config.secret.inc.php';
|
||||
require_once '/etc/phpmyadmin/helpers.php';
|
||||
|
||||
/* Ensure we got the environment */
|
||||
$vars = array(
|
||||
$vars = [
|
||||
'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_ABSOLUTE_URI',
|
||||
'PMA_CONTROLHOST',
|
||||
'PMA_CONTROLPORT',
|
||||
'PMA_PMADB',
|
||||
'PMA_CONTROLUSER',
|
||||
'PMA_CONTROLPASS',
|
||||
'PMA_QUERYHISTORYDB',
|
||||
'PMA_QUERYHISTORYMAX',
|
||||
'MAX_EXECUTION_TIME',
|
||||
'MEMORY_LIMIT',
|
||||
'PMA_UPLOADDIR',
|
||||
'PMA_SAVEDIR',
|
||||
'PMA_SSL',
|
||||
'PMA_SSLS',
|
||||
'PMA_SSL_DIR',
|
||||
'PMA_SSL_VERIFY',
|
||||
'PMA_SSL_VERIFIES',
|
||||
'PMA_SSL_CA',
|
||||
'PMA_SSL_CAS',
|
||||
'PMA_SSL_CA_BASE64',
|
||||
'PMA_SSL_CAS_BASE64',
|
||||
'PMA_SSL_KEY',
|
||||
'PMA_SSL_KEYS',
|
||||
'PMA_SSL_KEY_BASE64',
|
||||
'PMA_SSL_KEYS_BASE64',
|
||||
'PMA_SSL_CERT',
|
||||
'PMA_SSL_CERTS',
|
||||
'PMA_SSL_CERT_BASE64',
|
||||
'PMA_SSL_CERTS_BASE64',
|
||||
];
|
||||
|
||||
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 (! defined('PMA_SSL_DIR')) {
|
||||
define('PMA_SSL_DIR', $_ENV['PMA_SSL_DIR'] ?? '/etc/phpmyadmin/ssl');
|
||||
}
|
||||
|
||||
if (isset($_ENV['PMA_QUERYHISTORYDB'])) {
|
||||
$cfg['QueryHistoryDB'] = (bool) $_ENV['PMA_QUERYHISTORYDB'];
|
||||
}
|
||||
|
||||
if (isset($_ENV['PMA_QUERYHISTORYMAX'])) {
|
||||
$cfg['QueryHistoryMax'] = (int) $_ENV['PMA_QUERYHISTORYMAX'];
|
||||
}
|
||||
|
||||
/* Arbitrary server connection */
|
||||
if (isset($_ENV['PMA_ARBITRARY']) && $_ENV['PMA_ARBITRARY'] === '1') {
|
||||
$cfg['AllowArbitraryServer'] = true;
|
||||
@@ -28,36 +76,171 @@ if (isset($_ENV['PMA_ABSOLUTE_URI'])) {
|
||||
$cfg['PmaAbsoluteUri'] = trim($_ENV['PMA_ABSOLUTE_URI']);
|
||||
}
|
||||
|
||||
if (isset($_ENV['PMA_SSL_CA_BASE64'])) {
|
||||
$_ENV['PMA_SSL_CA'] = decodeBase64AndSaveFiles($_ENV['PMA_SSL_CA_BASE64'], 'phpmyadmin-ssl-CA', 'pem', PMA_SSL_DIR);
|
||||
}
|
||||
|
||||
/* Decode and save the SSL key from base64 */
|
||||
if (isset($_ENV['PMA_SSL_KEY_BASE64'])) {
|
||||
$_ENV['PMA_SSL_KEY'] = decodeBase64AndSaveFiles($_ENV['PMA_SSL_KEY_BASE64'], 'phpmyadmin-ssl-CERT', 'cert', PMA_SSL_DIR);
|
||||
}
|
||||
|
||||
/* Decode and save the SSL certificate from base64 */
|
||||
if (isset($_ENV['PMA_SSL_CERT_BASE64'])) {
|
||||
$_ENV['PMA_SSL_CERT'] = decodeBase64AndSaveFiles($_ENV['PMA_SSL_CERT_BASE64'], 'phpmyadmin-ssl-CERT', 'cert', PMA_SSL_DIR);
|
||||
}
|
||||
|
||||
/* Decode and save multiple SSL CA certificates from base64 */
|
||||
if (isset($_ENV['PMA_SSL_CAS_BASE64'])) {
|
||||
$_ENV['PMA_SSL_CAS'] = decodeBase64AndSaveFiles($_ENV['PMA_SSL_CAS_BASE64'], 'phpmyadmin-ssl-CA', 'pem', PMA_SSL_DIR);
|
||||
}
|
||||
|
||||
/* Decode and save multiple SSL keys from base64 */
|
||||
if (isset($_ENV['PMA_SSL_KEYS_BASE64'])) {
|
||||
$_ENV['PMA_SSL_KEYS'] = decodeBase64AndSaveFiles($_ENV['PMA_SSL_KEYS_BASE64'], 'phpmyadmin-ssl-CERT', 'cert', PMA_SSL_DIR);
|
||||
}
|
||||
|
||||
/* Decode and save multiple SSL certificates from base64 */
|
||||
if (isset($_ENV['PMA_SSL_CERTS_BASE64'])) {
|
||||
$_ENV['PMA_SSL_CERTS'] = decodeBase64AndSaveFiles($_ENV['PMA_SSL_CERTS_BASE64'], 'phpmyadmin-ssl-KEY', 'key', PMA_SSL_DIR);
|
||||
}
|
||||
|
||||
/* Figure out hosts */
|
||||
|
||||
/* Fallback to default linked */
|
||||
$hosts = array('db');
|
||||
$hosts = ['db'];
|
||||
|
||||
/* Set by environment */
|
||||
if (!empty($_ENV['PMA_HOST'])) {
|
||||
$hosts = array($_ENV['PMA_HOST']);
|
||||
} elseif (!empty($_ENV['PMA_HOSTS'])) {
|
||||
$hosts = explode(',', $_ENV['PMA_HOSTS']);
|
||||
if (! empty($_ENV['PMA_HOST'])) {
|
||||
$hosts = [$_ENV['PMA_HOST']];
|
||||
$verbose = [$_ENV['PMA_VERBOSE']];
|
||||
$ports = [$_ENV['PMA_PORT']];
|
||||
$ssls = [$_ENV['PMA_SSL']];
|
||||
$ssl_verifies = [$_ENV['PMA_SSL_VERIFY']];
|
||||
$ssl_cas = [$_ENV['PMA_SSL_CA']];
|
||||
$ssl_keys = [$_ENV['PMA_SSL_KEY']];
|
||||
$ssl_certs = [$_ENV['PMA_SSL_CERT']];
|
||||
} 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']));
|
||||
$ssls = array_map('trim', explode(',', $_ENV['PMA_SSLS']));
|
||||
$ssl_verifies = array_map('trim', explode(',', $_ENV['PMA_SSL_VERIFIES']));
|
||||
$ssl_cas = array_map('trim', explode(',', $_ENV['PMA_SSL_CAS']));
|
||||
$ssl_keys = array_map('trim', explode(',', $_ENV['PMA_SSL_KEYS']));
|
||||
$ssl_certs = array_map('trim', explode(',', $_ENV['PMA_SSL_CERTS']));
|
||||
}
|
||||
|
||||
if (! empty($_ENV['PMA_SOCKET'])) {
|
||||
$sockets = [$_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($ssls[$i - 1]) && $ssls[$i - 1] === '1') {
|
||||
$cfg['Servers'][$i]['ssl'] = $ssls[$i - 1];
|
||||
}
|
||||
if (isset($_ENV['PMA_USER'])) {
|
||||
if (isset($ssl_verifies[$i - 1]) && $ssl_verifies[$i - 1] === '1') {
|
||||
$cfg['Servers'][$i]['ssl_verify'] = $ssl_verifies[$i - 1];
|
||||
}
|
||||
if (isset($ssl_cas[$i - 1])) {
|
||||
$cfg['Servers'][$i]['ssl_ca'] = $ssl_cas[$i - 1];
|
||||
}
|
||||
if (isset($ssl_keys[$i - 1])) {
|
||||
$cfg['Servers'][$i]['ssl_key'] = $ssl_keys[$i - 1];
|
||||
}
|
||||
if (isset($ssl_certs[$i - 1])) {
|
||||
$cfg['Servers'][$i]['ssl_cert'] = $ssl_certs[$i - 1];
|
||||
}
|
||||
$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'] : 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;
|
||||
}
|
||||
// Avoid overwriting the last server id $i, use another variable name
|
||||
for ($socketHostId = 1; isset($sockets[$socketHostId - 1]); $socketHostId++) {
|
||||
$cfg['Servers'][$socketHostId]['socket'] = $sockets[$socketHostId - 1];
|
||||
$cfg['Servers'][$socketHostId]['host'] = 'localhost';
|
||||
}
|
||||
/*
|
||||
* Revert back to last configured server to make
|
||||
* it easier in config.user.inc.php
|
||||
*/
|
||||
$i--;
|
||||
|
||||
/* Uploads setup */
|
||||
$cfg['UploadDir'] = '';
|
||||
$cfg['SaveDir'] = '';
|
||||
if (isset($_ENV['PMA_UPLOADDIR'])) {
|
||||
$cfg['UploadDir'] = $_ENV['PMA_UPLOADDIR'];
|
||||
}
|
||||
|
||||
if (isset($_ENV['PMA_SAVEDIR'])) {
|
||||
$cfg['SaveDir'] = $_ENV['PMA_SAVEDIR'];
|
||||
}
|
||||
|
||||
if (isset($_ENV['MAX_EXECUTION_TIME'])) {
|
||||
$cfg['ExecTimeLimit'] = $_ENV['MAX_EXECUTION_TIME'];
|
||||
}
|
||||
|
||||
if (isset($_ENV['MEMORY_LIMIT'])) {
|
||||
$cfg['MemoryLimit'] = $_ENV['MEMORY_LIMIT'];
|
||||
}
|
||||
|
||||
/* Include User Defined Settings Hook */
|
||||
if (file_exists('/etc/phpmyadmin/config.user.inc.php')) {
|
||||
include '/etc/phpmyadmin/config.user.inc.php';
|
||||
}
|
||||
|
||||
/* Support additional configurations */
|
||||
if (is_dir('/etc/phpmyadmin/conf.d/')) {
|
||||
foreach (glob('/etc/phpmyadmin/conf.d/*.php') as $filename) {
|
||||
include $filename;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
phpmyadmin:
|
||||
image: phpmyadmin/phpmyadmin:testing
|
||||
container_name: myadmin
|
||||
environment:
|
||||
- PMA_ARBITRARY=1
|
||||
restart: always
|
||||
ports:
|
||||
- 8090:80
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
phpmyadmin:
|
||||
image: phpmyadmin/phpmyadmin
|
||||
container_name: myadmin
|
||||
image: phpmyadmin
|
||||
container_name: phpmyadmin
|
||||
environment:
|
||||
- PMA_ARBITRARY=1
|
||||
restart: always
|
||||
|
||||
Executable
+63
@@ -0,0 +1,63 @@
|
||||
#!/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
|
||||
chgrp www-data /etc/phpmyadmin/config.secret.inc.php
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
# start: Apache specific settings
|
||||
if [ -n "${APACHE_PORT+x}" ]; then
|
||||
echo "Setting apache port to ${APACHE_PORT}."
|
||||
sed -i "/VirtualHost \*:80/c\\<VirtualHost \*:${APACHE_PORT}\>" /etc/apache2/sites-enabled/000-default.conf
|
||||
sed -i "/Listen 80/c\Listen ${APACHE_PORT}" /etc/apache2/ports.conf
|
||||
apachectl configtest
|
||||
fi
|
||||
# end: Apache specific settings
|
||||
|
||||
get_docker_secret() {
|
||||
local env_var="${1}"
|
||||
local env_var_file="${env_var}_FILE"
|
||||
|
||||
# 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_USER
|
||||
get_docker_secret PMA_PASSWORD
|
||||
get_docker_secret MYSQL_ROOT_PASSWORD
|
||||
get_docker_secret MYSQL_PASSWORD
|
||||
get_docker_secret PMA_HOSTS
|
||||
get_docker_secret PMA_HOST
|
||||
get_docker_secret PMA_CONTROLHOST
|
||||
get_docker_secret PMA_CONTROLUSER
|
||||
get_docker_secret PMA_CONTROLPASS
|
||||
|
||||
exec "$@"
|
||||
@@ -0,0 +1,146 @@
|
||||
# DO NOT EDIT: created by update.sh from Dockerfile-alpine.template
|
||||
FROM php:8.3-fpm-alpine
|
||||
|
||||
ENV UPLOAD_PROGRESS_EXT_URL="https://github.com/php/pecl-php-uploadprogress/archive/refs/tags/uploadprogress-2.0.2.tar.gz"
|
||||
ENV UPLOAD_PROGRESS_SHA256="fe3f6cdfcedad563c970c4fd1cda31e422cfc0df5cc9a217d8c80ed3c8d137f5"
|
||||
|
||||
# install and docker-entrypoint.sh dependencies
|
||||
RUN apk add --no-cache \
|
||||
bash \
|
||||
tzdata \
|
||||
gnupg
|
||||
|
||||
# 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 \
|
||||
; \
|
||||
\
|
||||
mkdir -p /usr/src/php/ext/uploadprogress; \
|
||||
curl -fsSL -o /usr/src/php/ext/uploadprogress.tar.gz "$UPLOAD_PROGRESS_EXT_URL"; \
|
||||
echo "$UPLOAD_PROGRESS_SHA256 /usr/src/php/ext/uploadprogress.tar.gz" | sha256sum -c -; \
|
||||
tar -xf /usr/src/php/ext/uploadprogress.tar.gz -C /usr/src/php/ext/uploadprogress --strip-components=1; \
|
||||
\
|
||||
docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp --with-xpm; \
|
||||
docker-php-ext-install -j "$(nproc)" \
|
||||
bz2 \
|
||||
gd \
|
||||
mysqli \
|
||||
opcache \
|
||||
zip \
|
||||
bcmath \
|
||||
uploadprogress \
|
||||
; \
|
||||
\
|
||||
rm -r /usr/src/php/ext/uploadprogress /usr/src/php/ext/uploadprogress.tar.gz; \
|
||||
\
|
||||
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 --no-network --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
|
||||
ENV PMA_SSL_DIR=/etc/phpmyadmin/ssl
|
||||
ENV MAX_EXECUTION_TIME=600
|
||||
ENV MEMORY_LIMIT=512M
|
||||
ENV UPLOAD_LIMIT=2048K
|
||||
ENV TZ=UTC
|
||||
ENV SESSION_SAVE_PATH=/sessions
|
||||
RUN set -ex; \
|
||||
mkdir $SESSION_SAVE_PATH; \
|
||||
mkdir -p $PMA_SSL_DIR; \
|
||||
chmod 1777 $SESSION_SAVE_PATH; \
|
||||
chmod 755 $PMA_SSL_DIR; \
|
||||
chown www-data:www-data /etc/phpmyadmin; \
|
||||
chown www-data:www-data $PMA_SSL_DIR; \
|
||||
chown www-data:www-data $SESSION_SAVE_PATH; \
|
||||
\
|
||||
{ \
|
||||
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=${MAX_EXECUTION_TIME}'; \
|
||||
echo 'max_input_vars=10000'; \
|
||||
echo 'memory_limit=${MEMORY_LIMIT}'; \
|
||||
echo 'post_max_size=${UPLOAD_LIMIT}'; \
|
||||
echo 'upload_max_filesize=${UPLOAD_LIMIT}'; \
|
||||
echo 'date.timezone=${TZ}'; \
|
||||
echo 'session.save_path=${SESSION_SAVE_PATH}'; \
|
||||
} > $PHP_INI_DIR/conf.d/phpmyadmin-misc.ini
|
||||
|
||||
USER www-data:www-data
|
||||
|
||||
# Calculate download URL
|
||||
ENV VERSION=5.2.3
|
||||
ENV SHA256=57881348297c4412f86c410547cf76b4d8a236574dd2c6b7d6a2beebe7fc44e3
|
||||
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; \
|
||||
\
|
||||
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 keyserver.ubuntu.com --recv-keys "$GPGKEY" \
|
||||
|| gpg --batch --keyserver pgp.mit.edu --recv-keys "$GPGKEY" \
|
||||
|| gpg --batch --keyserver keyserver.pgp.com --recv-keys "$GPGKEY" \
|
||||
|| gpg --batch --keyserver keys.openpgp.org --recv-keys "$GPGKEY"; \
|
||||
gpg --batch --verify phpMyAdmin.tar.xz.asc phpMyAdmin.tar.xz; \
|
||||
tar -xf phpMyAdmin.tar.xz -C /var/www/html --strip-components=1; \
|
||||
mkdir -p /var/www/html/tmp; \
|
||||
gpgconf --kill all; \
|
||||
rm -r "$GNUPGHOME" phpMyAdmin.tar.xz phpMyAdmin.tar.xz.asc; \
|
||||
rm -r -v /var/www/html/setup/ /var/www/html/examples/ /var/www/html/js/src/ /var/www/html/babel.config.json /var/www/html/doc/html/_sources/ /var/www/html/RELEASE-DATE-$VERSION /var/www/html/CONTRIBUTING.md; \
|
||||
grep -q -F "'configFile' => ROOT_PATH . 'config.inc.php'," /var/www/html/libraries/vendor_config.php; \
|
||||
sed -i "s@'configFile' => .*@'configFile' => '/etc/phpmyadmin/config.inc.php',@" /var/www/html/libraries/vendor_config.php; \
|
||||
grep -q -F "'configFile' => '/etc/phpmyadmin/config.inc.php'," /var/www/html/libraries/vendor_config.php; \
|
||||
php -l /var/www/html/libraries/vendor_config.php; \
|
||||
find /var/www/html -type d -exec chmod 555 {} \;; \
|
||||
find /var/www/html -type f -exec chmod 444 {} \;; \
|
||||
chmod 1777 /var/www/html/tmp;
|
||||
|
||||
# Copy configuration
|
||||
COPY --chown=www-data:www-data config.inc.php /etc/phpmyadmin/config.inc.php
|
||||
COPY --chown=www-data:www-data helpers.php /etc/phpmyadmin/helpers.php
|
||||
|
||||
# Copy main script
|
||||
COPY docker-entrypoint.sh /docker-entrypoint.sh
|
||||
|
||||
USER root
|
||||
ENTRYPOINT [ "/docker-entrypoint.sh" ]
|
||||
CMD ["php-fpm"]
|
||||
@@ -0,0 +1,246 @@
|
||||
<?php
|
||||
|
||||
require_once '/etc/phpmyadmin/config.secret.inc.php';
|
||||
require_once '/etc/phpmyadmin/helpers.php';
|
||||
|
||||
/* Ensure we got the environment */
|
||||
$vars = [
|
||||
'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',
|
||||
'PMA_QUERYHISTORYMAX',
|
||||
'MAX_EXECUTION_TIME',
|
||||
'MEMORY_LIMIT',
|
||||
'PMA_UPLOADDIR',
|
||||
'PMA_SAVEDIR',
|
||||
'PMA_SSL',
|
||||
'PMA_SSLS',
|
||||
'PMA_SSL_DIR',
|
||||
'PMA_SSL_VERIFY',
|
||||
'PMA_SSL_VERIFIES',
|
||||
'PMA_SSL_CA',
|
||||
'PMA_SSL_CAS',
|
||||
'PMA_SSL_CA_BASE64',
|
||||
'PMA_SSL_CAS_BASE64',
|
||||
'PMA_SSL_KEY',
|
||||
'PMA_SSL_KEYS',
|
||||
'PMA_SSL_KEY_BASE64',
|
||||
'PMA_SSL_KEYS_BASE64',
|
||||
'PMA_SSL_CERT',
|
||||
'PMA_SSL_CERTS',
|
||||
'PMA_SSL_CERT_BASE64',
|
||||
'PMA_SSL_CERTS_BASE64',
|
||||
];
|
||||
|
||||
foreach ($vars as $var) {
|
||||
$env = getenv($var);
|
||||
if (!isset($_ENV[$var]) && $env !== false) {
|
||||
$_ENV[$var] = $env;
|
||||
}
|
||||
}
|
||||
|
||||
if (! defined('PMA_SSL_DIR')) {
|
||||
define('PMA_SSL_DIR', $_ENV['PMA_SSL_DIR'] ?? '/etc/phpmyadmin/ssl');
|
||||
}
|
||||
|
||||
if (isset($_ENV['PMA_QUERYHISTORYDB'])) {
|
||||
$cfg['QueryHistoryDB'] = (bool) $_ENV['PMA_QUERYHISTORYDB'];
|
||||
}
|
||||
|
||||
if (isset($_ENV['PMA_QUERYHISTORYMAX'])) {
|
||||
$cfg['QueryHistoryMax'] = (int) $_ENV['PMA_QUERYHISTORYMAX'];
|
||||
}
|
||||
|
||||
/* 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']);
|
||||
}
|
||||
|
||||
if (isset($_ENV['PMA_SSL_CA_BASE64'])) {
|
||||
$_ENV['PMA_SSL_CA'] = decodeBase64AndSaveFiles($_ENV['PMA_SSL_CA_BASE64'], 'phpmyadmin-ssl-CA', 'pem', PMA_SSL_DIR);
|
||||
}
|
||||
|
||||
/* Decode and save the SSL key from base64 */
|
||||
if (isset($_ENV['PMA_SSL_KEY_BASE64'])) {
|
||||
$_ENV['PMA_SSL_KEY'] = decodeBase64AndSaveFiles($_ENV['PMA_SSL_KEY_BASE64'], 'phpmyadmin-ssl-CERT', 'cert', PMA_SSL_DIR);
|
||||
}
|
||||
|
||||
/* Decode and save the SSL certificate from base64 */
|
||||
if (isset($_ENV['PMA_SSL_CERT_BASE64'])) {
|
||||
$_ENV['PMA_SSL_CERT'] = decodeBase64AndSaveFiles($_ENV['PMA_SSL_CERT_BASE64'], 'phpmyadmin-ssl-CERT', 'cert', PMA_SSL_DIR);
|
||||
}
|
||||
|
||||
/* Decode and save multiple SSL CA certificates from base64 */
|
||||
if (isset($_ENV['PMA_SSL_CAS_BASE64'])) {
|
||||
$_ENV['PMA_SSL_CAS'] = decodeBase64AndSaveFiles($_ENV['PMA_SSL_CAS_BASE64'], 'phpmyadmin-ssl-CA', 'pem', PMA_SSL_DIR);
|
||||
}
|
||||
|
||||
/* Decode and save multiple SSL keys from base64 */
|
||||
if (isset($_ENV['PMA_SSL_KEYS_BASE64'])) {
|
||||
$_ENV['PMA_SSL_KEYS'] = decodeBase64AndSaveFiles($_ENV['PMA_SSL_KEYS_BASE64'], 'phpmyadmin-ssl-CERT', 'cert', PMA_SSL_DIR);
|
||||
}
|
||||
|
||||
/* Decode and save multiple SSL certificates from base64 */
|
||||
if (isset($_ENV['PMA_SSL_CERTS_BASE64'])) {
|
||||
$_ENV['PMA_SSL_CERTS'] = decodeBase64AndSaveFiles($_ENV['PMA_SSL_CERTS_BASE64'], 'phpmyadmin-ssl-KEY', 'key', PMA_SSL_DIR);
|
||||
}
|
||||
|
||||
/* Figure out hosts */
|
||||
|
||||
/* Fallback to default linked */
|
||||
$hosts = ['db'];
|
||||
|
||||
/* Set by environment */
|
||||
if (! empty($_ENV['PMA_HOST'])) {
|
||||
$hosts = [$_ENV['PMA_HOST']];
|
||||
$verbose = [$_ENV['PMA_VERBOSE']];
|
||||
$ports = [$_ENV['PMA_PORT']];
|
||||
$ssls = [$_ENV['PMA_SSL']];
|
||||
$ssl_verifies = [$_ENV['PMA_SSL_VERIFY']];
|
||||
$ssl_cas = [$_ENV['PMA_SSL_CA']];
|
||||
$ssl_keys = [$_ENV['PMA_SSL_KEY']];
|
||||
$ssl_certs = [$_ENV['PMA_SSL_CERT']];
|
||||
} 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']));
|
||||
$ssls = array_map('trim', explode(',', $_ENV['PMA_SSLS']));
|
||||
$ssl_verifies = array_map('trim', explode(',', $_ENV['PMA_SSL_VERIFIES']));
|
||||
$ssl_cas = array_map('trim', explode(',', $_ENV['PMA_SSL_CAS']));
|
||||
$ssl_keys = array_map('trim', explode(',', $_ENV['PMA_SSL_KEYS']));
|
||||
$ssl_certs = array_map('trim', explode(',', $_ENV['PMA_SSL_CERTS']));
|
||||
}
|
||||
|
||||
if (! empty($_ENV['PMA_SOCKET'])) {
|
||||
$sockets = [$_ENV['PMA_SOCKET']];
|
||||
} elseif (! empty($_ENV['PMA_SOCKETS'])) {
|
||||
$sockets = explode(',', $_ENV['PMA_SOCKETS']);
|
||||
}
|
||||
|
||||
/* Server settings */
|
||||
for ($i = 1; isset($hosts[$i - 1]); $i++) {
|
||||
if (isset($ssls[$i - 1]) && $ssls[$i - 1] === '1') {
|
||||
$cfg['Servers'][$i]['ssl'] = $ssls[$i - 1];
|
||||
}
|
||||
if (isset($ssl_verifies[$i - 1]) && $ssl_verifies[$i - 1] === '1') {
|
||||
$cfg['Servers'][$i]['ssl_verify'] = $ssl_verifies[$i - 1];
|
||||
}
|
||||
if (isset($ssl_cas[$i - 1])) {
|
||||
$cfg['Servers'][$i]['ssl_ca'] = $ssl_cas[$i - 1];
|
||||
}
|
||||
if (isset($ssl_keys[$i - 1])) {
|
||||
$cfg['Servers'][$i]['ssl_key'] = $ssl_keys[$i - 1];
|
||||
}
|
||||
if (isset($ssl_certs[$i - 1])) {
|
||||
$cfg['Servers'][$i]['ssl_cert'] = $ssl_certs[$i - 1];
|
||||
}
|
||||
$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;
|
||||
}
|
||||
// Avoid overwriting the last server id $i, use another variable name
|
||||
for ($socketHostId = 1; isset($sockets[$socketHostId - 1]); $socketHostId++) {
|
||||
$cfg['Servers'][$socketHostId]['socket'] = $sockets[$socketHostId - 1];
|
||||
$cfg['Servers'][$socketHostId]['host'] = 'localhost';
|
||||
}
|
||||
/*
|
||||
* Revert back to last configured server to make
|
||||
* it easier in config.user.inc.php
|
||||
*/
|
||||
$i--;
|
||||
|
||||
/* Uploads setup */
|
||||
if (isset($_ENV['PMA_UPLOADDIR'])) {
|
||||
$cfg['UploadDir'] = $_ENV['PMA_UPLOADDIR'];
|
||||
}
|
||||
|
||||
if (isset($_ENV['PMA_SAVEDIR'])) {
|
||||
$cfg['SaveDir'] = $_ENV['PMA_SAVEDIR'];
|
||||
}
|
||||
|
||||
if (isset($_ENV['MAX_EXECUTION_TIME'])) {
|
||||
$cfg['ExecTimeLimit'] = $_ENV['MAX_EXECUTION_TIME'];
|
||||
}
|
||||
|
||||
if (isset($_ENV['MEMORY_LIMIT'])) {
|
||||
$cfg['MemoryLimit'] = $_ENV['MEMORY_LIMIT'];
|
||||
}
|
||||
|
||||
/* Include User Defined Settings Hook */
|
||||
if (file_exists('/etc/phpmyadmin/config.user.inc.php')) {
|
||||
include '/etc/phpmyadmin/config.user.inc.php';
|
||||
}
|
||||
|
||||
/* Support additional configurations */
|
||||
if (is_dir('/etc/phpmyadmin/conf.d/')) {
|
||||
foreach (glob('/etc/phpmyadmin/conf.d/*.php') as $filename) {
|
||||
include $filename;
|
||||
}
|
||||
}
|
||||
Executable
+55
@@ -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
|
||||
chgrp www-data /etc/phpmyadmin/config.secret.inc.php
|
||||
|
||||
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
|
||||
|
||||
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_USER
|
||||
get_docker_secret PMA_PASSWORD
|
||||
get_docker_secret MYSQL_ROOT_PASSWORD
|
||||
get_docker_secret MYSQL_PASSWORD
|
||||
get_docker_secret PMA_HOSTS
|
||||
get_docker_secret PMA_HOST
|
||||
get_docker_secret PMA_CONTROLHOST
|
||||
get_docker_secret PMA_CONTROLUSER
|
||||
get_docker_secret PMA_CONTROLPASS
|
||||
|
||||
exec "$@"
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Helper function to decode and save multiple SSL files from base64.
|
||||
*
|
||||
* @param string $base64FilesContents The base64 encoded string containing multiple files separated by commas.
|
||||
* If no commas are present, the entire string is treated as a single file.
|
||||
* @param string $prefix The prefix to use for the generated file names.
|
||||
* @param string $extension The file extension to use for the generated files.
|
||||
* @param string $storageFolder The folder where to store the generated files.
|
||||
*
|
||||
* @return string A comma-separated list of paths to the generated files.
|
||||
*/
|
||||
function decodeBase64AndSaveFiles(string $base64FilesContents, string $prefix, string $extension, string $storageFolder): string
|
||||
{
|
||||
// Ensure the output directory exists
|
||||
if (! is_dir($storageFolder)) {
|
||||
mkdir($storageFolder, 0755, true);
|
||||
}
|
||||
|
||||
// Split the base64 string into an array of files
|
||||
$base64FilesContents = explode(',', trim($base64FilesContents));
|
||||
$counter = 1;
|
||||
$outputFiles = [];
|
||||
|
||||
// Process each file
|
||||
foreach ($base64FilesContents as $base64FileContent) {
|
||||
$outputFile = $storageFolder . '/' . $prefix . '-' . $counter . '.' . $extension;
|
||||
|
||||
$fileContent = base64_decode($base64FileContent, true);
|
||||
if ($fileContent === false) {
|
||||
echo 'Failed to decode: ' . $base64FileContent;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// Write the decoded file to the output directory
|
||||
if (file_put_contents($outputFile, $fileContent) === false) {
|
||||
echo 'Failed to write to ' . $outputFile;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// Add the output file path to the list
|
||||
$outputFiles[] = $outputFile;
|
||||
$counter++;
|
||||
}
|
||||
|
||||
// Return a comma-separated list of the generated file paths
|
||||
return implode(',', $outputFiles);
|
||||
}
|
||||
+157
@@ -0,0 +1,157 @@
|
||||
# DO NOT EDIT: created by update.sh from Dockerfile-debian.template
|
||||
FROM php:8.3-fpm
|
||||
|
||||
ENV UPLOAD_PROGRESS_EXT_URL="https://github.com/php/pecl-php-uploadprogress/archive/refs/tags/uploadprogress-2.0.2.tar.gz"
|
||||
ENV UPLOAD_PROGRESS_SHA256="fe3f6cdfcedad563c970c4fd1cda31e422cfc0df5cc9a217d8c80ed3c8d137f5"
|
||||
|
||||
# Install dependencies
|
||||
RUN set -ex; \
|
||||
\
|
||||
apt-get update; \
|
||||
apt-get install -y --no-install-recommends \
|
||||
gnupg \
|
||||
dirmngr \
|
||||
; \
|
||||
\
|
||||
savedAptMark="$(apt-mark showmanual)"; \
|
||||
\
|
||||
apt-get install -y --no-install-recommends \
|
||||
libbz2-dev \
|
||||
libfreetype6-dev \
|
||||
libjpeg-dev \
|
||||
libpng-dev \
|
||||
libwebp-dev \
|
||||
libxpm-dev \
|
||||
libzip-dev \
|
||||
; \
|
||||
\
|
||||
mkdir -p /usr/src/php/ext/uploadprogress; \
|
||||
curl -fsSL -o /usr/src/php/ext/uploadprogress.tar.gz "$UPLOAD_PROGRESS_EXT_URL"; \
|
||||
echo "$UPLOAD_PROGRESS_SHA256 /usr/src/php/ext/uploadprogress.tar.gz" | sha256sum -c -; \
|
||||
tar -xf /usr/src/php/ext/uploadprogress.tar.gz -C /usr/src/php/ext/uploadprogress --strip-components=1; \
|
||||
\
|
||||
docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp --with-xpm; \
|
||||
docker-php-ext-install -j "$(nproc)" \
|
||||
bz2 \
|
||||
gd \
|
||||
mysqli \
|
||||
opcache \
|
||||
zip \
|
||||
bcmath \
|
||||
uploadprogress \
|
||||
; \
|
||||
\
|
||||
rm -r /usr/src/php/ext/uploadprogress /usr/src/php/ext/uploadprogress.tar.gz; \
|
||||
\
|
||||
apt-mark auto '.*' > /dev/null; \
|
||||
apt-mark manual $savedAptMark; \
|
||||
extdir="$(php -r 'echo ini_get("extension_dir");')"; \
|
||||
ldd "$extdir"/*.so \
|
||||
| awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); print so }' \
|
||||
| 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/*; \
|
||||
ldd "$extdir"/*.so | grep -qzv "=> not found" || (echo "Sanity check failed: missing libraries:"; ldd "$extdir"/*.so | grep " => not found"; exit 1); \
|
||||
ldd "$extdir"/*.so | grep -q "libzip.so.* => .*/libzip.so.*" || (echo "Sanity check failed: libzip.so is not referenced"; ldd "$extdir"/*.so; exit 1); \
|
||||
err="$(php --version 3>&1 1>&2 2>&3)"; \
|
||||
[ -z "$err" ] || (echo "Sanity check failed: php returned errors; $err"; exit 1;);
|
||||
|
||||
# set recommended PHP.ini settings
|
||||
# see https://secure.php.net/manual/en/opcache.installation.php
|
||||
ENV PMA_SSL_DIR=/etc/phpmyadmin/ssl
|
||||
ENV MAX_EXECUTION_TIME=600
|
||||
ENV MEMORY_LIMIT=512M
|
||||
ENV UPLOAD_LIMIT=2048K
|
||||
ENV TZ=UTC
|
||||
ENV SESSION_SAVE_PATH=/sessions
|
||||
RUN set -ex; \
|
||||
mkdir $SESSION_SAVE_PATH; \
|
||||
mkdir -p $PMA_SSL_DIR; \
|
||||
chmod 1777 $SESSION_SAVE_PATH; \
|
||||
chmod 755 $PMA_SSL_DIR; \
|
||||
chown www-data:www-data /etc/phpmyadmin; \
|
||||
chown www-data:www-data $PMA_SSL_DIR; \
|
||||
chown www-data:www-data $SESSION_SAVE_PATH; \
|
||||
\
|
||||
{ \
|
||||
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=${MAX_EXECUTION_TIME}'; \
|
||||
echo 'max_input_vars=10000'; \
|
||||
echo 'memory_limit=${MEMORY_LIMIT}'; \
|
||||
echo 'post_max_size=${UPLOAD_LIMIT}'; \
|
||||
echo 'upload_max_filesize=${UPLOAD_LIMIT}'; \
|
||||
echo 'date.timezone=${TZ}'; \
|
||||
echo 'session.save_path=${SESSION_SAVE_PATH}'; \
|
||||
} > $PHP_INI_DIR/conf.d/phpmyadmin-misc.ini
|
||||
|
||||
USER www-data:www-data
|
||||
|
||||
# Calculate download URL
|
||||
ENV VERSION=5.2.3
|
||||
ENV SHA256=57881348297c4412f86c410547cf76b4d8a236574dd2c6b7d6a2beebe7fc44e3
|
||||
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; \
|
||||
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 keyserver.ubuntu.com --recv-keys "$GPGKEY" \
|
||||
|| gpg --batch --keyserver pgp.mit.edu --recv-keys "$GPGKEY" \
|
||||
|| gpg --batch --keyserver keyserver.pgp.com --recv-keys "$GPGKEY" \
|
||||
|| gpg --batch --keyserver keys.openpgp.org --recv-keys "$GPGKEY"; \
|
||||
gpg --batch --verify phpMyAdmin.tar.xz.asc phpMyAdmin.tar.xz; \
|
||||
tar -xf phpMyAdmin.tar.xz -C /var/www/html --strip-components=1; \
|
||||
mkdir -p /var/www/html/tmp; \
|
||||
gpgconf --kill all; \
|
||||
rm -r "$GNUPGHOME" phpMyAdmin.tar.xz phpMyAdmin.tar.xz.asc; \
|
||||
rm -r -v /var/www/html/setup/ /var/www/html/examples/ /var/www/html/js/src/ /var/www/html/babel.config.json /var/www/html/doc/html/_sources/ /var/www/html/RELEASE-DATE-$VERSION /var/www/html/CONTRIBUTING.md; \
|
||||
grep -q -F "'configFile' => ROOT_PATH . 'config.inc.php'," /var/www/html/libraries/vendor_config.php; \
|
||||
sed -i "s@'configFile' => .*@'configFile' => '/etc/phpmyadmin/config.inc.php',@" /var/www/html/libraries/vendor_config.php; \
|
||||
grep -q -F "'configFile' => '/etc/phpmyadmin/config.inc.php'," /var/www/html/libraries/vendor_config.php; \
|
||||
php -l /var/www/html/libraries/vendor_config.php; \
|
||||
find /var/www/html -type d -exec chmod 555 {} \;; \
|
||||
find /var/www/html -type f -exec chmod 444 {} \;; \
|
||||
chmod 1777 /var/www/html/tmp;
|
||||
|
||||
# Copy configuration
|
||||
COPY --chown=www-data:www-data config.inc.php /etc/phpmyadmin/config.inc.php
|
||||
COPY --chown=www-data:www-data helpers.php /etc/phpmyadmin/helpers.php
|
||||
|
||||
# Copy main script
|
||||
COPY docker-entrypoint.sh /docker-entrypoint.sh
|
||||
|
||||
USER root
|
||||
ENTRYPOINT [ "/docker-entrypoint.sh" ]
|
||||
CMD ["php-fpm"]
|
||||
@@ -0,0 +1,246 @@
|
||||
<?php
|
||||
|
||||
require_once '/etc/phpmyadmin/config.secret.inc.php';
|
||||
require_once '/etc/phpmyadmin/helpers.php';
|
||||
|
||||
/* Ensure we got the environment */
|
||||
$vars = [
|
||||
'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',
|
||||
'PMA_QUERYHISTORYMAX',
|
||||
'MAX_EXECUTION_TIME',
|
||||
'MEMORY_LIMIT',
|
||||
'PMA_UPLOADDIR',
|
||||
'PMA_SAVEDIR',
|
||||
'PMA_SSL',
|
||||
'PMA_SSLS',
|
||||
'PMA_SSL_DIR',
|
||||
'PMA_SSL_VERIFY',
|
||||
'PMA_SSL_VERIFIES',
|
||||
'PMA_SSL_CA',
|
||||
'PMA_SSL_CAS',
|
||||
'PMA_SSL_CA_BASE64',
|
||||
'PMA_SSL_CAS_BASE64',
|
||||
'PMA_SSL_KEY',
|
||||
'PMA_SSL_KEYS',
|
||||
'PMA_SSL_KEY_BASE64',
|
||||
'PMA_SSL_KEYS_BASE64',
|
||||
'PMA_SSL_CERT',
|
||||
'PMA_SSL_CERTS',
|
||||
'PMA_SSL_CERT_BASE64',
|
||||
'PMA_SSL_CERTS_BASE64',
|
||||
];
|
||||
|
||||
foreach ($vars as $var) {
|
||||
$env = getenv($var);
|
||||
if (!isset($_ENV[$var]) && $env !== false) {
|
||||
$_ENV[$var] = $env;
|
||||
}
|
||||
}
|
||||
|
||||
if (! defined('PMA_SSL_DIR')) {
|
||||
define('PMA_SSL_DIR', $_ENV['PMA_SSL_DIR'] ?? '/etc/phpmyadmin/ssl');
|
||||
}
|
||||
|
||||
if (isset($_ENV['PMA_QUERYHISTORYDB'])) {
|
||||
$cfg['QueryHistoryDB'] = (bool) $_ENV['PMA_QUERYHISTORYDB'];
|
||||
}
|
||||
|
||||
if (isset($_ENV['PMA_QUERYHISTORYMAX'])) {
|
||||
$cfg['QueryHistoryMax'] = (int) $_ENV['PMA_QUERYHISTORYMAX'];
|
||||
}
|
||||
|
||||
/* 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']);
|
||||
}
|
||||
|
||||
if (isset($_ENV['PMA_SSL_CA_BASE64'])) {
|
||||
$_ENV['PMA_SSL_CA'] = decodeBase64AndSaveFiles($_ENV['PMA_SSL_CA_BASE64'], 'phpmyadmin-ssl-CA', 'pem', PMA_SSL_DIR);
|
||||
}
|
||||
|
||||
/* Decode and save the SSL key from base64 */
|
||||
if (isset($_ENV['PMA_SSL_KEY_BASE64'])) {
|
||||
$_ENV['PMA_SSL_KEY'] = decodeBase64AndSaveFiles($_ENV['PMA_SSL_KEY_BASE64'], 'phpmyadmin-ssl-CERT', 'cert', PMA_SSL_DIR);
|
||||
}
|
||||
|
||||
/* Decode and save the SSL certificate from base64 */
|
||||
if (isset($_ENV['PMA_SSL_CERT_BASE64'])) {
|
||||
$_ENV['PMA_SSL_CERT'] = decodeBase64AndSaveFiles($_ENV['PMA_SSL_CERT_BASE64'], 'phpmyadmin-ssl-CERT', 'cert', PMA_SSL_DIR);
|
||||
}
|
||||
|
||||
/* Decode and save multiple SSL CA certificates from base64 */
|
||||
if (isset($_ENV['PMA_SSL_CAS_BASE64'])) {
|
||||
$_ENV['PMA_SSL_CAS'] = decodeBase64AndSaveFiles($_ENV['PMA_SSL_CAS_BASE64'], 'phpmyadmin-ssl-CA', 'pem', PMA_SSL_DIR);
|
||||
}
|
||||
|
||||
/* Decode and save multiple SSL keys from base64 */
|
||||
if (isset($_ENV['PMA_SSL_KEYS_BASE64'])) {
|
||||
$_ENV['PMA_SSL_KEYS'] = decodeBase64AndSaveFiles($_ENV['PMA_SSL_KEYS_BASE64'], 'phpmyadmin-ssl-CERT', 'cert', PMA_SSL_DIR);
|
||||
}
|
||||
|
||||
/* Decode and save multiple SSL certificates from base64 */
|
||||
if (isset($_ENV['PMA_SSL_CERTS_BASE64'])) {
|
||||
$_ENV['PMA_SSL_CERTS'] = decodeBase64AndSaveFiles($_ENV['PMA_SSL_CERTS_BASE64'], 'phpmyadmin-ssl-KEY', 'key', PMA_SSL_DIR);
|
||||
}
|
||||
|
||||
/* Figure out hosts */
|
||||
|
||||
/* Fallback to default linked */
|
||||
$hosts = ['db'];
|
||||
|
||||
/* Set by environment */
|
||||
if (! empty($_ENV['PMA_HOST'])) {
|
||||
$hosts = [$_ENV['PMA_HOST']];
|
||||
$verbose = [$_ENV['PMA_VERBOSE']];
|
||||
$ports = [$_ENV['PMA_PORT']];
|
||||
$ssls = [$_ENV['PMA_SSL']];
|
||||
$ssl_verifies = [$_ENV['PMA_SSL_VERIFY']];
|
||||
$ssl_cas = [$_ENV['PMA_SSL_CA']];
|
||||
$ssl_keys = [$_ENV['PMA_SSL_KEY']];
|
||||
$ssl_certs = [$_ENV['PMA_SSL_CERT']];
|
||||
} 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']));
|
||||
$ssls = array_map('trim', explode(',', $_ENV['PMA_SSLS']));
|
||||
$ssl_verifies = array_map('trim', explode(',', $_ENV['PMA_SSL_VERIFIES']));
|
||||
$ssl_cas = array_map('trim', explode(',', $_ENV['PMA_SSL_CAS']));
|
||||
$ssl_keys = array_map('trim', explode(',', $_ENV['PMA_SSL_KEYS']));
|
||||
$ssl_certs = array_map('trim', explode(',', $_ENV['PMA_SSL_CERTS']));
|
||||
}
|
||||
|
||||
if (! empty($_ENV['PMA_SOCKET'])) {
|
||||
$sockets = [$_ENV['PMA_SOCKET']];
|
||||
} elseif (! empty($_ENV['PMA_SOCKETS'])) {
|
||||
$sockets = explode(',', $_ENV['PMA_SOCKETS']);
|
||||
}
|
||||
|
||||
/* Server settings */
|
||||
for ($i = 1; isset($hosts[$i - 1]); $i++) {
|
||||
if (isset($ssls[$i - 1]) && $ssls[$i - 1] === '1') {
|
||||
$cfg['Servers'][$i]['ssl'] = $ssls[$i - 1];
|
||||
}
|
||||
if (isset($ssl_verifies[$i - 1]) && $ssl_verifies[$i - 1] === '1') {
|
||||
$cfg['Servers'][$i]['ssl_verify'] = $ssl_verifies[$i - 1];
|
||||
}
|
||||
if (isset($ssl_cas[$i - 1])) {
|
||||
$cfg['Servers'][$i]['ssl_ca'] = $ssl_cas[$i - 1];
|
||||
}
|
||||
if (isset($ssl_keys[$i - 1])) {
|
||||
$cfg['Servers'][$i]['ssl_key'] = $ssl_keys[$i - 1];
|
||||
}
|
||||
if (isset($ssl_certs[$i - 1])) {
|
||||
$cfg['Servers'][$i]['ssl_cert'] = $ssl_certs[$i - 1];
|
||||
}
|
||||
$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;
|
||||
}
|
||||
// Avoid overwriting the last server id $i, use another variable name
|
||||
for ($socketHostId = 1; isset($sockets[$socketHostId - 1]); $socketHostId++) {
|
||||
$cfg['Servers'][$socketHostId]['socket'] = $sockets[$socketHostId - 1];
|
||||
$cfg['Servers'][$socketHostId]['host'] = 'localhost';
|
||||
}
|
||||
/*
|
||||
* Revert back to last configured server to make
|
||||
* it easier in config.user.inc.php
|
||||
*/
|
||||
$i--;
|
||||
|
||||
/* Uploads setup */
|
||||
if (isset($_ENV['PMA_UPLOADDIR'])) {
|
||||
$cfg['UploadDir'] = $_ENV['PMA_UPLOADDIR'];
|
||||
}
|
||||
|
||||
if (isset($_ENV['PMA_SAVEDIR'])) {
|
||||
$cfg['SaveDir'] = $_ENV['PMA_SAVEDIR'];
|
||||
}
|
||||
|
||||
if (isset($_ENV['MAX_EXECUTION_TIME'])) {
|
||||
$cfg['ExecTimeLimit'] = $_ENV['MAX_EXECUTION_TIME'];
|
||||
}
|
||||
|
||||
if (isset($_ENV['MEMORY_LIMIT'])) {
|
||||
$cfg['MemoryLimit'] = $_ENV['MEMORY_LIMIT'];
|
||||
}
|
||||
|
||||
/* Include User Defined Settings Hook */
|
||||
if (file_exists('/etc/phpmyadmin/config.user.inc.php')) {
|
||||
include '/etc/phpmyadmin/config.user.inc.php';
|
||||
}
|
||||
|
||||
/* Support additional configurations */
|
||||
if (is_dir('/etc/phpmyadmin/conf.d/')) {
|
||||
foreach (glob('/etc/phpmyadmin/conf.d/*.php') as $filename) {
|
||||
include $filename;
|
||||
}
|
||||
}
|
||||
Executable
+55
@@ -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
|
||||
chgrp www-data /etc/phpmyadmin/config.secret.inc.php
|
||||
|
||||
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
|
||||
|
||||
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_USER
|
||||
get_docker_secret PMA_PASSWORD
|
||||
get_docker_secret MYSQL_ROOT_PASSWORD
|
||||
get_docker_secret MYSQL_PASSWORD
|
||||
get_docker_secret PMA_HOSTS
|
||||
get_docker_secret PMA_HOST
|
||||
get_docker_secret PMA_CONTROLHOST
|
||||
get_docker_secret PMA_CONTROLUSER
|
||||
get_docker_secret PMA_CONTROLPASS
|
||||
|
||||
exec "$@"
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Helper function to decode and save multiple SSL files from base64.
|
||||
*
|
||||
* @param string $base64FilesContents The base64 encoded string containing multiple files separated by commas.
|
||||
* If no commas are present, the entire string is treated as a single file.
|
||||
* @param string $prefix The prefix to use for the generated file names.
|
||||
* @param string $extension The file extension to use for the generated files.
|
||||
* @param string $storageFolder The folder where to store the generated files.
|
||||
*
|
||||
* @return string A comma-separated list of paths to the generated files.
|
||||
*/
|
||||
function decodeBase64AndSaveFiles(string $base64FilesContents, string $prefix, string $extension, string $storageFolder): string
|
||||
{
|
||||
// Ensure the output directory exists
|
||||
if (! is_dir($storageFolder)) {
|
||||
mkdir($storageFolder, 0755, true);
|
||||
}
|
||||
|
||||
// Split the base64 string into an array of files
|
||||
$base64FilesContents = explode(',', trim($base64FilesContents));
|
||||
$counter = 1;
|
||||
$outputFiles = [];
|
||||
|
||||
// Process each file
|
||||
foreach ($base64FilesContents as $base64FileContent) {
|
||||
$outputFile = $storageFolder . '/' . $prefix . '-' . $counter . '.' . $extension;
|
||||
|
||||
$fileContent = base64_decode($base64FileContent, true);
|
||||
if ($fileContent === false) {
|
||||
echo 'Failed to decode: ' . $base64FileContent;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// Write the decoded file to the output directory
|
||||
if (file_put_contents($outputFile, $fileContent) === false) {
|
||||
echo 'Failed to write to ' . $outputFile;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// Add the output file path to the list
|
||||
$outputFiles[] = $outputFile;
|
||||
$counter++;
|
||||
}
|
||||
|
||||
// Return a comma-separated list of the generated file paths
|
||||
return implode(',', $outputFiles);
|
||||
}
|
||||
Executable
+95
@@ -0,0 +1,95 @@
|
||||
#!/usr/bin/env bash
|
||||
set -Eeuo pipefail
|
||||
|
||||
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 COPY'd from "$1/Dockerfile"
|
||||
dirCommit() {
|
||||
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 -A -g parentRepoToArches=( $(
|
||||
find -name 'Dockerfile' -exec awk '
|
||||
toupper($1) == "FROM" && $2 !~ /^('"$repo"'|scratch|.*\/.*)(:|$)/ {
|
||||
print "'"$officialImagesUrl"'" $2
|
||||
}
|
||||
' '{}' + \
|
||||
| sort -u \
|
||||
| xargs bashbrew cat --format '[{{ .RepoName }}:{{ .TagName }}]="{{ join " " .TagEntry.Architectures }}"'
|
||||
) )"
|
||||
}
|
||||
getArches 'phpmyadmin'
|
||||
|
||||
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
|
||||
|
||||
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' | grep -E '^[0-9]{1,}.[0-9]{1,}.[0-9]{1,}$')"
|
||||
|
||||
for variant in apache fpm fpm-alpine; do
|
||||
commit="$(dirCommit "$variant")"
|
||||
fullversion="$(git show "$commit":"$variant/Dockerfile" | awk -F" |=" '$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
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Helper function to decode and save multiple SSL files from base64.
|
||||
*
|
||||
* @param string $base64FilesContents The base64 encoded string containing multiple files separated by commas.
|
||||
* If no commas are present, the entire string is treated as a single file.
|
||||
* @param string $prefix The prefix to use for the generated file names.
|
||||
* @param string $extension The file extension to use for the generated files.
|
||||
* @param string $storageFolder The folder where to store the generated files.
|
||||
*
|
||||
* @return string A comma-separated list of paths to the generated files.
|
||||
*/
|
||||
function decodeBase64AndSaveFiles(string $base64FilesContents, string $prefix, string $extension, string $storageFolder): string
|
||||
{
|
||||
// Ensure the output directory exists
|
||||
if (! is_dir($storageFolder)) {
|
||||
mkdir($storageFolder, 0755, true);
|
||||
}
|
||||
|
||||
// Split the base64 string into an array of files
|
||||
$base64FilesContents = explode(',', trim($base64FilesContents));
|
||||
$counter = 1;
|
||||
$outputFiles = [];
|
||||
|
||||
// Process each file
|
||||
foreach ($base64FilesContents as $base64FileContent) {
|
||||
$outputFile = $storageFolder . '/' . $prefix . '-' . $counter . '.' . $extension;
|
||||
|
||||
$fileContent = base64_decode($base64FileContent, true);
|
||||
if ($fileContent === false) {
|
||||
echo 'Failed to decode: ' . $base64FileContent;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// Write the decoded file to the output directory
|
||||
if (file_put_contents($outputFile, $fileContent) === false) {
|
||||
echo 'Failed to write to ' . $outputFile;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// Add the output file path to the list
|
||||
$outputFiles[] = $outputFile;
|
||||
$counter++;
|
||||
}
|
||||
|
||||
// Return a comma-separated list of the generated file paths
|
||||
return implode(',', $outputFiles);
|
||||
}
|
||||
Executable
+4
@@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
# This file is used by docker hub to build the image
|
||||
|
||||
docker build -t $IMAGE_NAME .
|
||||
@@ -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,9 @@
|
||||
# Testing image for phpMyAdmin
|
||||
|
||||
FROM alpine:3.21
|
||||
|
||||
# Install test dependencies
|
||||
RUN set -ex; \
|
||||
\
|
||||
apk add --no-cache --update mariadb-client mariadb-connector-c bash \
|
||||
py3-html5lib py3-pytest py3-mechanize curl
|
||||
@@ -0,0 +1,2 @@
|
||||
<?php
|
||||
$cfg['AllowArbitraryServer'] = true;
|
||||
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
|
||||
$cfg['ShowPhpInfo'] = true;
|
||||
@@ -0,0 +1,33 @@
|
||||
import pytest
|
||||
|
||||
def pytest_addoption(parser):
|
||||
parser.addoption("--url")
|
||||
parser.addoption("--username")
|
||||
parser.addoption("--password")
|
||||
parser.addoption("--root-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 root_password(request):
|
||||
return request.config.getoption("--root-password")
|
||||
|
||||
@pytest.fixture
|
||||
def server(request):
|
||||
return request.config.getoption("--server")
|
||||
|
||||
@pytest.fixture
|
||||
def sqlfile(request):
|
||||
return request.config.getoption("--sqlfile")
|
||||
@@ -0,0 +1,69 @@
|
||||
version: "3.1"
|
||||
|
||||
services:
|
||||
db_server:
|
||||
image: ${DB:-mariadb:10.11}
|
||||
environment:
|
||||
MARIADB_ROOT_PASSWORD: "${TESTSUITE_PASSWORD:-my-secret-pw}"
|
||||
healthcheck:
|
||||
test: ["CMD", "mariadb-admin", "ping", "-uroot", "-p${TESTSUITE_PASSWORD:-my-secret-pw}"]
|
||||
start_period: 10s
|
||||
interval: 5s
|
||||
timeout: 60s
|
||||
retries: 10
|
||||
networks:
|
||||
testing:
|
||||
aliases:
|
||||
- phpmyadmin_testing_db
|
||||
tmpfs:
|
||||
- /var/lib/mysql:rw,noexec,nosuid,size=300m
|
||||
|
||||
phpmyadmin:
|
||||
build:
|
||||
context: ../../apache
|
||||
environment:
|
||||
PMA_HOST: db_server
|
||||
UPLOAD_LIMIT: 123M
|
||||
MAX_EXECUTION_TIME: 125
|
||||
HIDE_PHP_VERSION: 1
|
||||
volumes:
|
||||
- ../config.user.inc.php:/etc/phpmyadmin/conf.d/config.test.php:ro
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-Ss", "http://localhost/robots.txt"]
|
||||
start_period: 5s
|
||||
interval: 3s
|
||||
timeout: 60s
|
||||
retries: 10
|
||||
networks:
|
||||
testing:
|
||||
aliases:
|
||||
- phpmyadmin_testing_apache
|
||||
depends_on:
|
||||
db_server:
|
||||
condition: service_healthy
|
||||
|
||||
sut:
|
||||
depends_on:
|
||||
phpmyadmin:
|
||||
condition: service_healthy
|
||||
db_server:
|
||||
condition: service_healthy
|
||||
build:
|
||||
context: ../
|
||||
command: "/tests/testing/test-docker.sh"
|
||||
networks:
|
||||
testing:
|
||||
environment:
|
||||
TESTSUITE_HOSTNAME: phpmyadmin_testing_apache
|
||||
TESTSUITE_PORT: 80
|
||||
TESTSUITE_PASSWORD: "${TESTSUITE_PASSWORD:-my-secret-pw}"
|
||||
PMA_HOST: phpmyadmin_testing_db
|
||||
PMA_PORT: 3306
|
||||
volumes:
|
||||
- ../../:/tests:ro
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
working_dir: /tests
|
||||
|
||||
networks:
|
||||
testing:
|
||||
driver: bridge
|
||||
@@ -0,0 +1,69 @@
|
||||
version: "3.1"
|
||||
|
||||
services:
|
||||
db_server:
|
||||
image: ${DB:-mariadb:10.11}
|
||||
environment:
|
||||
MARIADB_ROOT_PASSWORD: "${TESTSUITE_PASSWORD:-my-secret-pw}"
|
||||
healthcheck:
|
||||
test: ["CMD", "mariadb-admin", "ping", "-uroot", "-p${TESTSUITE_PASSWORD:-my-secret-pw}"]
|
||||
start_period: 10s
|
||||
interval: 5s
|
||||
timeout: 60s
|
||||
retries: 10
|
||||
networks:
|
||||
testing:
|
||||
aliases:
|
||||
- phpmyadmin_testing_db
|
||||
tmpfs:
|
||||
- /var/lib/mysql:rw,noexec,nosuid,size=300m
|
||||
|
||||
phpmyadmin:
|
||||
build:
|
||||
context: ../../apache
|
||||
environment:
|
||||
PMA_ARBITRARY: 1
|
||||
UPLOAD_LIMIT: 123M
|
||||
MAX_EXECUTION_TIME: 125
|
||||
HIDE_PHP_VERSION: 1
|
||||
volumes:
|
||||
- ../config.user.inc.php:/etc/phpmyadmin/config.user.inc.php:ro
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-Ss", "http://localhost/robots.txt"]
|
||||
start_period: 5s
|
||||
interval: 3s
|
||||
timeout: 60s
|
||||
retries: 10
|
||||
networks:
|
||||
testing:
|
||||
aliases:
|
||||
- phpmyadmin_testing_apache
|
||||
depends_on:
|
||||
db_server:
|
||||
condition: service_healthy
|
||||
|
||||
sut:
|
||||
depends_on:
|
||||
phpmyadmin:
|
||||
condition: service_healthy
|
||||
db_server:
|
||||
condition: service_healthy
|
||||
build:
|
||||
context: ../
|
||||
command: "/tests/testing/test-docker.sh"
|
||||
networks:
|
||||
testing:
|
||||
environment:
|
||||
TESTSUITE_HOSTNAME_ARBITRARY: 1
|
||||
TESTSUITE_HOSTNAME: phpmyadmin_testing_apache
|
||||
PMA_HOST: phpmyadmin_testing_db
|
||||
TESTSUITE_PORT: 80
|
||||
TESTSUITE_PASSWORD: "${TESTSUITE_PASSWORD:-my-secret-pw}"
|
||||
volumes:
|
||||
- ../../:/tests:ro
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
working_dir: /tests
|
||||
|
||||
networks:
|
||||
testing:
|
||||
driver: bridge
|
||||
@@ -0,0 +1,70 @@
|
||||
version: "3.1"
|
||||
|
||||
services:
|
||||
db_server:
|
||||
image: ${DB:-mariadb:10.11}
|
||||
environment:
|
||||
MARIADB_ROOT_PASSWORD: "${TESTSUITE_PASSWORD:-my-secret-pw}"
|
||||
healthcheck:
|
||||
test: ["CMD", "mariadb-admin", "ping", "-uroot", "-p${TESTSUITE_PASSWORD:-my-secret-pw}"]
|
||||
start_period: 10s
|
||||
interval: 5s
|
||||
timeout: 60s
|
||||
retries: 10
|
||||
networks:
|
||||
testing:
|
||||
aliases:
|
||||
- phpmyadmin_testing_db
|
||||
tmpfs:
|
||||
- /var/lib/mysql:rw,noexec,nosuid,size=300m
|
||||
|
||||
phpmyadmin:
|
||||
build:
|
||||
context: ../../apache
|
||||
environment:
|
||||
PMA_HOST: db_server
|
||||
UPLOAD_LIMIT: 123M
|
||||
MAX_EXECUTION_TIME: 125
|
||||
HIDE_PHP_VERSION: 1
|
||||
APACHE_PORT: 8090
|
||||
volumes:
|
||||
- ../config.user.inc.php:/etc/phpmyadmin/config.user.inc.php:ro
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-Ss", "http://localhost:8090/robots.txt"]
|
||||
start_period: 5s
|
||||
interval: 3s
|
||||
timeout: 60s
|
||||
retries: 10
|
||||
networks:
|
||||
testing:
|
||||
aliases:
|
||||
- phpmyadmin_testing_apache
|
||||
depends_on:
|
||||
db_server:
|
||||
condition: service_healthy
|
||||
|
||||
sut:
|
||||
depends_on:
|
||||
phpmyadmin:
|
||||
condition: service_healthy
|
||||
db_server:
|
||||
condition: service_healthy
|
||||
build:
|
||||
context: ../
|
||||
command: "/tests/testing/test-docker.sh"
|
||||
networks:
|
||||
testing:
|
||||
environment:
|
||||
TESTSUITE_HOSTNAME: phpmyadmin_testing_apache
|
||||
TESTSUITE_PORT: 8090
|
||||
TESTSUITE_PASSWORD: "${TESTSUITE_PASSWORD:-my-secret-pw}"
|
||||
PMA_HOST: phpmyadmin_testing_db
|
||||
PMA_PORT: 3306
|
||||
volumes:
|
||||
- ../../:/tests:ro
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
working_dir: /tests
|
||||
|
||||
networks:
|
||||
testing:
|
||||
driver: bridge
|
||||
@@ -0,0 +1,80 @@
|
||||
version: "3.1"
|
||||
|
||||
services:
|
||||
db_server:
|
||||
image: ${DB:-mariadb:10.11}
|
||||
environment:
|
||||
MARIADB_ROOT_PASSWORD: "${TESTSUITE_PASSWORD:-my-secret-pw}"
|
||||
healthcheck:
|
||||
test: ["CMD", "mariadb-admin", "ping", "-uroot", "-p${TESTSUITE_PASSWORD:-my-secret-pw}"]
|
||||
start_period: 10s
|
||||
interval: 5s
|
||||
timeout: 60s
|
||||
retries: 10
|
||||
networks:
|
||||
testing:
|
||||
aliases:
|
||||
- phpmyadmin_testing_db
|
||||
tmpfs:
|
||||
- /var/lib/mysql:rw,noexec,nosuid,size=300m
|
||||
|
||||
phpmyadmin:
|
||||
build:
|
||||
context: ../../apache
|
||||
environment:
|
||||
PMA_HOST: db_server
|
||||
UPLOAD_LIMIT: 123M
|
||||
MAX_EXECUTION_TIME: 125
|
||||
HIDE_PHP_VERSION: 1
|
||||
PMA_UPLOADDIR: /etc/phpmyadmin/imports
|
||||
PMA_SAVEDIR: /etc/phpmyadmin/exports
|
||||
volumes:
|
||||
- ../config.user.inc.php:/etc/phpmyadmin/config.user.inc.php:ro
|
||||
- phpmyadmin-data:/etc/phpmyadmin/imports:ro
|
||||
- phpmyadmin-data:/etc/phpmyadmin/exports
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-Ss", "http://localhost/robots.txt"]
|
||||
start_period: 5s
|
||||
interval: 3s
|
||||
timeout: 60s
|
||||
retries: 10
|
||||
networks:
|
||||
testing:
|
||||
aliases:
|
||||
- phpmyadmin_testing_apache
|
||||
depends_on:
|
||||
db_server:
|
||||
condition: service_healthy
|
||||
|
||||
sut:
|
||||
depends_on:
|
||||
phpmyadmin:
|
||||
condition: service_healthy
|
||||
db_server:
|
||||
condition: service_healthy
|
||||
build:
|
||||
context: ../
|
||||
command: "/tests/testing/test-docker.sh"
|
||||
networks:
|
||||
testing:
|
||||
environment:
|
||||
TESTSUITE_HOSTNAME: phpmyadmin_testing_apache
|
||||
TESTSUITE_PORT: 80
|
||||
TESTSUITE_PASSWORD: "${TESTSUITE_PASSWORD:-my-secret-pw}"
|
||||
PMA_HOST: phpmyadmin_testing_db
|
||||
PMA_PORT: 3306
|
||||
PMA_UPLOADDIR: /etc/phpmyadmin/imports
|
||||
PMA_SAVEDIR: /etc/phpmyadmin/exports
|
||||
volumes:
|
||||
- ../../:/tests:ro
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
- phpmyadmin-data:/etc/phpmyadmin/imports
|
||||
- phpmyadmin-data:/etc/phpmyadmin/exports
|
||||
working_dir: /tests
|
||||
|
||||
networks:
|
||||
testing:
|
||||
driver: bridge
|
||||
|
||||
volumes:
|
||||
phpmyadmin-data:
|
||||
@@ -0,0 +1,69 @@
|
||||
version: "3.1"
|
||||
|
||||
services:
|
||||
db_server:
|
||||
image: ${DB:-mariadb:10.11}
|
||||
environment:
|
||||
MARIADB_ROOT_PASSWORD: "${TESTSUITE_PASSWORD:-my-secret-pw}"
|
||||
healthcheck:
|
||||
test: ["CMD", "mariadb-admin", "ping", "-uroot", "-p${TESTSUITE_PASSWORD:-my-secret-pw}"]
|
||||
start_period: 10s
|
||||
interval: 5s
|
||||
timeout: 60s
|
||||
retries: 10
|
||||
networks:
|
||||
testing:
|
||||
aliases:
|
||||
- phpmyadmin_testing_db
|
||||
tmpfs:
|
||||
- /var/lib/mysql:rw,noexec,nosuid,size=300m
|
||||
|
||||
phpmyadmin:
|
||||
build:
|
||||
context: ../../apache
|
||||
environment:
|
||||
PMA_HOST: db_server
|
||||
UPLOAD_LIMIT: 123M
|
||||
MAX_EXECUTION_TIME: 125
|
||||
HIDE_PHP_VERSION: 1
|
||||
volumes:
|
||||
- ../config.user.inc.php:/etc/phpmyadmin/config.user.inc.php:ro
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-Ss", "http://localhost/robots.txt"]
|
||||
start_period: 5s
|
||||
interval: 3s
|
||||
timeout: 60s
|
||||
retries: 10
|
||||
networks:
|
||||
testing:
|
||||
aliases:
|
||||
- phpmyadmin_testing_apache
|
||||
depends_on:
|
||||
db_server:
|
||||
condition: service_healthy
|
||||
|
||||
sut:
|
||||
depends_on:
|
||||
phpmyadmin:
|
||||
condition: service_healthy
|
||||
db_server:
|
||||
condition: service_healthy
|
||||
build:
|
||||
context: ../
|
||||
command: "/tests/testing/test-docker.sh"
|
||||
networks:
|
||||
testing:
|
||||
environment:
|
||||
TESTSUITE_HOSTNAME: phpmyadmin_testing_apache
|
||||
TESTSUITE_PORT: 80
|
||||
TESTSUITE_PASSWORD: "${TESTSUITE_PASSWORD:-my-secret-pw}"
|
||||
PMA_HOST: phpmyadmin_testing_db
|
||||
PMA_PORT: 3306
|
||||
volumes:
|
||||
- ../../:/tests:ro
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
working_dir: /tests
|
||||
|
||||
networks:
|
||||
testing:
|
||||
driver: bridge
|
||||
@@ -0,0 +1,75 @@
|
||||
version: "3.1"
|
||||
|
||||
services:
|
||||
db_server:
|
||||
image: ${DB:-mariadb:10.11}
|
||||
environment:
|
||||
MARIADB_ROOT_PASSWORD: "${TESTSUITE_PASSWORD:-my-secret-pw}"
|
||||
healthcheck:
|
||||
test: ["CMD", "mariadb-admin", "ping", "-uroot", "-p${TESTSUITE_PASSWORD:-my-secret-pw}"]
|
||||
start_period: 10s
|
||||
interval: 5s
|
||||
timeout: 60s
|
||||
retries: 10
|
||||
networks:
|
||||
testing:
|
||||
aliases:
|
||||
- phpmyadmin_testing_db
|
||||
tmpfs:
|
||||
- /var/lib/mysql:rw,noexec,nosuid,size=300m
|
||||
volumes:
|
||||
- db-socket:/run/mysqld/
|
||||
|
||||
phpmyadmin:
|
||||
build:
|
||||
context: ../../apache
|
||||
environment:
|
||||
PMA_SOCKET: /run/mysqld/mysqld.sock
|
||||
UPLOAD_LIMIT: 123M
|
||||
MAX_EXECUTION_TIME: 125
|
||||
HIDE_PHP_VERSION: 1
|
||||
volumes:
|
||||
- ../config.user.inc.php:/etc/phpmyadmin/config.user.inc.php:ro
|
||||
- db-socket:/run/mysqld/
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-Ss", "http://localhost/robots.txt"]
|
||||
start_period: 5s
|
||||
interval: 3s
|
||||
timeout: 60s
|
||||
retries: 10
|
||||
networks:
|
||||
testing:
|
||||
aliases:
|
||||
- phpmyadmin_testing_apache
|
||||
depends_on:
|
||||
db_server:
|
||||
condition: service_healthy
|
||||
|
||||
sut:
|
||||
depends_on:
|
||||
phpmyadmin:
|
||||
condition: service_healthy
|
||||
db_server:
|
||||
condition: service_healthy
|
||||
build:
|
||||
context: ../
|
||||
command: "/tests/testing/test-docker.sh"
|
||||
networks:
|
||||
testing:
|
||||
environment:
|
||||
TESTSUITE_HOSTNAME: phpmyadmin_testing_apache
|
||||
TESTSUITE_PORT: 80
|
||||
TESTSUITE_PASSWORD: "${TESTSUITE_PASSWORD:-my-secret-pw}"
|
||||
PMA_HOST: phpmyadmin_testing_db
|
||||
PMA_PORT: 3306
|
||||
volumes:
|
||||
- ../../:/tests:ro
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
working_dir: /tests
|
||||
|
||||
networks:
|
||||
testing:
|
||||
driver: bridge
|
||||
|
||||
volumes:
|
||||
db-socket:
|
||||
@@ -0,0 +1,99 @@
|
||||
version: "3.1"
|
||||
|
||||
services:
|
||||
db_server:
|
||||
image: ${DB:-mariadb:11}
|
||||
command:
|
||||
- "--ssl-ca=/etc/phpmyadmin/ssl/ca-cert.pem"
|
||||
- "--ssl-cert=/etc/phpmyadmin/ssl/server-cert.pem"
|
||||
- "--ssl-key=/etc/phpmyadmin/ssl/server-key.pem"
|
||||
- "--require-secure-transport=ON"
|
||||
environment:
|
||||
MARIADB_USER: secure-user
|
||||
MARIADB_PASSWORD: "${TESTSUITE_PASSWORD:-my-secret-pw}"
|
||||
MARIADB_ROOT_PASSWORD: "${TESTSUITE_ROOT_PASSWORD:-random-pass}"
|
||||
# The database name used in the import test
|
||||
MARIADB_DATABASE: World
|
||||
healthcheck:
|
||||
test: ["CMD", "mariadb-admin", "ping", "-uroot", "-prandom-pass"]
|
||||
start_period: 10s
|
||||
interval: 5s
|
||||
timeout: 60s
|
||||
retries: 10
|
||||
networks:
|
||||
testing:
|
||||
aliases:
|
||||
- mariadb.phpmyadmin.local
|
||||
tmpfs:
|
||||
- /var/lib/mysql:rw,noexec,nosuid,size=300m
|
||||
volumes:
|
||||
#- ../secure-user.sql:/docker-entrypoint-initdb.d/secure-user.sql:ro
|
||||
- ../ca-cert.pem:/etc/phpmyadmin/ssl/ca-cert.pem:ro
|
||||
- ../ca-key.pem:/etc/phpmyadmin/ssl/ca-key.pem:ro
|
||||
- ../server-cert.pem:/etc/phpmyadmin/ssl/server-cert.pem:ro
|
||||
- ../server-key.pem:/etc/phpmyadmin/ssl/server-key.pem:ro
|
||||
#- ../mariadb-audit:/var/log/mariadb-audit
|
||||
|
||||
phpmyadmin:
|
||||
build:
|
||||
context: ../../apache
|
||||
environment:
|
||||
PMA_HOST: mariadb.phpmyadmin.local
|
||||
PMA_SSL: 1
|
||||
PMA_SSL_VERIFY: 1
|
||||
PMA_SSL_CA: /etc/phpmyadmin/ssl/ca-cert.pem
|
||||
PMA_SSL_CERT: /etc/phpmyadmin/ssl/client-cert.pem
|
||||
PMA_SSL_KEY: /etc/phpmyadmin/ssl/client-key.pem
|
||||
UPLOAD_LIMIT: 123M
|
||||
MAX_EXECUTION_TIME: 125
|
||||
HIDE_PHP_VERSION: 1
|
||||
volumes:
|
||||
- ../config.user.inc.php:/etc/phpmyadmin/config.user.inc.php:ro
|
||||
- ../ca-cert.pem:/etc/phpmyadmin/ssl/ca-cert.pem:ro
|
||||
- ../client-cert.pem:/etc/phpmyadmin/ssl/client-cert.pem:ro
|
||||
- ../client-key.pem:/etc/phpmyadmin/ssl/client-key.pem:ro
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-Ss", "http://localhost/robots.txt"]
|
||||
start_period: 5s
|
||||
interval: 3s
|
||||
timeout: 60s
|
||||
retries: 10
|
||||
networks:
|
||||
testing:
|
||||
aliases:
|
||||
- phpmyadmin_testing_apache
|
||||
depends_on:
|
||||
db_server:
|
||||
condition: service_healthy
|
||||
|
||||
sut:
|
||||
depends_on:
|
||||
phpmyadmin:
|
||||
condition: service_healthy
|
||||
db_server:
|
||||
condition: service_healthy
|
||||
build:
|
||||
context: ../
|
||||
command: "/tests/testing/test-docker.sh"
|
||||
networks:
|
||||
testing:
|
||||
environment:
|
||||
TESTSUITE_HOSTNAME: phpmyadmin_testing_apache
|
||||
TESTSUITE_PORT: 80
|
||||
TESTSUITE_USER: secure-user
|
||||
TESTSUITE_PASSWORD: "${TESTSUITE_PASSWORD:-my-secret-pw}"
|
||||
TESTSUITE_ROOT_PASSWORD: "${TESTSUITE_ROOT_PASSWORD:-random-pass}"
|
||||
PMA_HOST: mariadb.phpmyadmin.local
|
||||
PMA_PORT: 3306
|
||||
IS_USING_SSL: true
|
||||
volumes:
|
||||
- ../ca-cert.pem:/etc/phpmyadmin/ssl/ca-cert.pem:ro
|
||||
- ../server-cert.pem:/etc/phpmyadmin/ssl/server-cert.pem:ro
|
||||
- ../client-cert.pem:/etc/phpmyadmin/ssl/client-cert.pem:ro
|
||||
- ../client-key.pem:/etc/phpmyadmin/ssl/client-key.pem:ro
|
||||
- ../../:/tests:ro
|
||||
working_dir: /tests
|
||||
|
||||
networks:
|
||||
testing:
|
||||
driver: bridge
|
||||
@@ -0,0 +1,76 @@
|
||||
services:
|
||||
db_server:
|
||||
image: ${DB:-mariadb:10.11}
|
||||
# mysql:mysql in MariaDB for Docker (https://stackoverflow.com/a/55241769/5155484)
|
||||
user: 999:999
|
||||
environment:
|
||||
MARIADB_ROOT_PASSWORD: "${TESTSUITE_PASSWORD:-my-secret-pw}"
|
||||
healthcheck:
|
||||
test: ["CMD", "mariadb-admin", "ping", "-uroot", "-p${TESTSUITE_PASSWORD:-my-secret-pw}"]
|
||||
start_period: 10s
|
||||
interval: 5s
|
||||
timeout: 60s
|
||||
retries: 10
|
||||
networks:
|
||||
testing:
|
||||
aliases:
|
||||
- phpmyadmin_testing_db
|
||||
volumes:
|
||||
- mariadb-data:/var/lib/mysql
|
||||
|
||||
phpmyadmin:
|
||||
build:
|
||||
context: ../../apache
|
||||
# www-data:www-data in Debian (https://stackoverflow.com/a/69290889/5155484)
|
||||
user: 33:33
|
||||
environment:
|
||||
PMA_HOST: db_server
|
||||
UPLOAD_LIMIT: 123M
|
||||
MAX_EXECUTION_TIME: 125
|
||||
volumes:
|
||||
- ../config.user.inc.php:/etc/phpmyadmin/config.user.inc.php:ro
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-Ss", "http://localhost/robots.txt"]
|
||||
start_period: 5s
|
||||
interval: 3s
|
||||
timeout: 60s
|
||||
retries: 10
|
||||
networks:
|
||||
testing:
|
||||
aliases:
|
||||
- phpmyadmin_testing_apache
|
||||
depends_on:
|
||||
db_server:
|
||||
condition: service_healthy
|
||||
|
||||
sut:
|
||||
# nobody:nobody
|
||||
user: 65534:65534
|
||||
depends_on:
|
||||
phpmyadmin:
|
||||
condition: service_healthy
|
||||
db_server:
|
||||
condition: service_healthy
|
||||
build:
|
||||
context: ../
|
||||
command: "/tests/testing/test-docker.sh"
|
||||
networks:
|
||||
testing:
|
||||
environment:
|
||||
TESTSUITE_HOSTNAME: phpmyadmin_testing_apache
|
||||
TESTSUITE_PORT: 80
|
||||
TESTSUITE_PASSWORD: "${TESTSUITE_PASSWORD:-my-secret-pw}"
|
||||
PMA_HOST: phpmyadmin_testing_db
|
||||
PMA_PORT: 3306
|
||||
SKIP_EXPOSE_PHP_TEST: true
|
||||
volumes:
|
||||
- ../../:/tests:ro
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
working_dir: /tests
|
||||
|
||||
networks:
|
||||
testing:
|
||||
driver: bridge
|
||||
|
||||
volumes:
|
||||
mariadb-data:
|
||||
Executable
+37
@@ -0,0 +1,37 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -eu
|
||||
|
||||
# Source: https://github.com/chio-nzgft/docker-MariaDB-with-SSL
|
||||
# See: https://dev.mysql.com/doc/refman/5.7/en/creating-ssl-files-using-openssl.html
|
||||
|
||||
|
||||
ROOT_DIR="$(realpath $(dirname $0))"
|
||||
echo "Using root dir: $ROOT_DIR"
|
||||
|
||||
cd "$ROOT_DIR"
|
||||
|
||||
rm -f *.pem
|
||||
|
||||
SUBJECT_CA="/C=US/O=phpMyAdmin testing/OU=Docker/CN=ssl-ca.phpmyadmin.local/emailAddress=ssl-ca@example.org"
|
||||
SUBJECT_CLIENT="/C=US/O=phpMyAdmin testing/OU=Docker/CN=client.phpmyadmin.local/emailAddress=secure-user@example.org"
|
||||
SUBJECT_SERVER="/C=US/O=phpMyAdmin testing/OU=Docker/CN=mariadb.phpmyadmin.local"
|
||||
|
||||
echo "CA key"
|
||||
|
||||
openssl genrsa 2048 > ca-key.pem
|
||||
openssl req -new -x509 -nodes -days 3600 -subj "${SUBJECT_CA}" -key ca-key.pem -out ca-cert.pem
|
||||
echo "server key"
|
||||
|
||||
openssl req -subj "${SUBJECT_SERVER}" -newkey rsa:2048 -days 3600 -nodes -keyout server-key.pem -out server-req.pem
|
||||
openssl rsa -in server-key.pem -out server-key.pem
|
||||
openssl x509 -req -in server-req.pem -days 3600 -CA ca-cert.pem -CAkey ca-key.pem -set_serial 01 -out server-cert.pem
|
||||
echo "client key"
|
||||
|
||||
openssl req -subj "${SUBJECT_CLIENT}" -newkey rsa:2048 -days 3600 -nodes -keyout client-key.pem -out client-req.pem
|
||||
openssl rsa -in client-key.pem -out client-key.pem
|
||||
openssl x509 -req -in client-req.pem -days 3600 -CA ca-cert.pem -CAkey ca-key.pem -set_serial 01 -out client-cert.pem
|
||||
echo "check key ok"
|
||||
|
||||
openssl verify -CAfile ca-cert.pem server-cert.pem client-cert.pem
|
||||
chmod 666 *.pem
|
||||
Executable
+212
@@ -0,0 +1,212 @@
|
||||
#!/usr/bin/env python3
|
||||
import argparse
|
||||
import os
|
||||
import subprocess
|
||||
import re
|
||||
import sys
|
||||
|
||||
import mechanize
|
||||
import tempfile
|
||||
import pytest
|
||||
|
||||
def create_browser():
|
||||
br = mechanize.Browser()
|
||||
|
||||
# Ignore robots.txt
|
||||
br.set_handle_robots(False)
|
||||
return br
|
||||
|
||||
def do_login(br, url, username, password, server):
|
||||
# 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 logged in
|
||||
response = br.submit()
|
||||
return response
|
||||
|
||||
def get_world_sql_path():
|
||||
if os.path.exists('/world.sql'):
|
||||
return '/world.sql'
|
||||
elif os.path.exists('./world.sql'):
|
||||
return './world.sql'
|
||||
else:
|
||||
path = os.path.dirname(os.path.realpath(__file__))
|
||||
return path + '/world.sql'
|
||||
|
||||
def test_import(url, username, password, server, sqlfile):
|
||||
if sqlfile is None:
|
||||
sqlfile = get_world_sql_path()
|
||||
|
||||
br = create_browser()
|
||||
|
||||
response = do_login(br, url, username, password, server)
|
||||
|
||||
assert(b'Server version' in response.read())
|
||||
|
||||
# Open server import
|
||||
response = br.follow_link(text_regex=re.compile('Import'))
|
||||
assert(b'OpenDocument Spreadsheet' in response.read())
|
||||
|
||||
# Upload SQL file
|
||||
br.select_form('import')
|
||||
br.form.add_file(open(sqlfile), 'text/plain', sqlfile)
|
||||
response = br.submit()
|
||||
response = response.read()
|
||||
|
||||
assert(b'5326 queries executed' in response)
|
||||
|
||||
|
||||
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("bash " +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_USER')
|
||||
docker_secret('PMA_PASSWORD')
|
||||
docker_secret('PMA_HOSTS')
|
||||
docker_secret('PMA_HOST')
|
||||
docker_secret('PMA_CONTROLHOST')
|
||||
docker_secret('PMA_CONTROLUSER')
|
||||
docker_secret('PMA_CONTROLPASS')
|
||||
|
||||
def test_is_using_ssl(url, username, password, server):
|
||||
is_using_ssl = os.environ.get('IS_USING_SSL');
|
||||
|
||||
br = create_browser()
|
||||
response = do_login(br, url, username, password, server)
|
||||
response = response.read()
|
||||
|
||||
assert(b'Server connection' in response)
|
||||
|
||||
if is_using_ssl:
|
||||
assert(b'SSL is used' in response)
|
||||
assert(b'SSL is not being used' not in response)
|
||||
else:
|
||||
assert(b'SSL is used' not in response)
|
||||
assert(b'SSL is not being used' in response)
|
||||
|
||||
def test_is_using_ssl_client_cert(url, server):
|
||||
is_using_ssl = os.environ.get('IS_USING_SSL');
|
||||
if not is_using_ssl:
|
||||
pytest.skip("Missing IS_USING_SSL ENV", allow_module_level=True)
|
||||
|
||||
br = create_browser()
|
||||
password = ""
|
||||
response = do_login(br, url, "ssl-specific-user", password, server)
|
||||
response = response.read()
|
||||
|
||||
assert(b'Server connection' in response)
|
||||
assert(b'ssl-specific-user@' in response)
|
||||
|
||||
assert(b'SSL is used' in response)
|
||||
assert(b'SSL is not being used' not in response)
|
||||
|
||||
def test_php_ini(url, username, password, server):
|
||||
skip_expose_php_test = os.environ.get('SKIP_EXPOSE_PHP_TEST');
|
||||
|
||||
br = create_browser()
|
||||
response = do_login(br, url, username, password, server)
|
||||
response = response.read()
|
||||
|
||||
assert(b'Show PHP information' in response)
|
||||
|
||||
# Open Show PHP information
|
||||
response = br.follow_link(text_regex=re.compile('Show PHP information'))
|
||||
response = response.read()
|
||||
assert(b'PHP Version' in response)
|
||||
|
||||
assert(b'upload_max_filesize' in response)
|
||||
assert(b'post_max_size' in response)
|
||||
assert(b'expose_php' in response)
|
||||
assert(b'session.save_path' in response)
|
||||
|
||||
assert(b'<tr><td class="e">max_execution_time</td><td class="v">125</td><td class="v">125</td></tr>' in response)
|
||||
|
||||
assert(b'<tr><td class="e">upload_max_filesize</td><td class="v">123M</td><td class="v">123M</td></tr>' in response)
|
||||
assert(b'<tr><td class="e">post_max_size</td><td class="v">123M</td><td class="v">123M</td></tr>' in response)
|
||||
|
||||
if not skip_expose_php_test:
|
||||
assert(b'<tr><td class="e">expose_php</td><td class="v">Off</td><td class="v">Off</td></tr>' in response)
|
||||
|
||||
assert(b'<tr><td class="e">session.save_path</td><td class="v">/sessions</td><td class="v">/sessions</td></tr>' in response)
|
||||
|
||||
def test_import_from_folder(url, username, password, server, sqlfile):
|
||||
upload_dir = os.environ.get('PMA_UPLOADDIR');
|
||||
if not upload_dir:
|
||||
pytest.skip("Missing PMA_UPLOADDIR ENV", allow_module_level=True)
|
||||
|
||||
# Copy file into the volume
|
||||
with open(get_world_sql_path(), 'rb') as src, open(upload_dir + '/world-data.sql', 'wb') as dst:
|
||||
dst.write(src.read())
|
||||
|
||||
br = create_browser()
|
||||
|
||||
response = do_login(br, url, username, password, server)
|
||||
|
||||
assert(b'Server version' in response.read())
|
||||
|
||||
# Open server import
|
||||
response = br.follow_link(text_regex=re.compile('Import'))
|
||||
response = response.read()
|
||||
|
||||
assert(b'Browse your computer:' in response)
|
||||
assert(upload_dir.encode() in response)
|
||||
assert(b'world-data.sql' in response)
|
||||
|
||||
def test_export_to_folder(url, username, password, server, sqlfile):
|
||||
save_dir = os.environ.get('PMA_SAVEDIR');
|
||||
if not save_dir:
|
||||
pytest.skip("Missing PMA_SAVEDIR ENV", allow_module_level=True)
|
||||
|
||||
# Delete file from previous runs
|
||||
if os.path.exists(save_dir + "/db_server.sql"):
|
||||
os.remove(save_dir + "/db_server.sql")
|
||||
|
||||
assert os.path.exists(save_dir + "/db_server.sql") == False
|
||||
|
||||
# Avoid: "The web server does not have permission to save the file"
|
||||
os.chmod(save_dir , 0o777)
|
||||
|
||||
br = create_browser()
|
||||
|
||||
response = do_login(br, url, username, password, server)
|
||||
|
||||
assert(b'Server version' in response.read())
|
||||
|
||||
# Open server export
|
||||
response = br.follow_link(text_regex=re.compile('Export'))
|
||||
response = response.read()
|
||||
assert(b'Save on server in the directory' in response)
|
||||
assert(save_dir.encode() in response)
|
||||
|
||||
br.select_form('dump')
|
||||
br.find_control("quick_export_onserver").items[0].selected=True
|
||||
|
||||
response = br.submit()
|
||||
response = response.read()
|
||||
|
||||
assert(b'Dump has been saved to file' in response)
|
||||
assert(b'Dump has been saved to file /etc/phpmyadmin/exports/db_server.sql' in response)
|
||||
assert os.path.exists(save_dir + "/db_server.sql") == True
|
||||
Executable
+106
@@ -0,0 +1,106 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -eu
|
||||
|
||||
# Set phpMyAdmin environment
|
||||
PHPMYADMIN_HOSTNAME=${TESTSUITE_HOSTNAME:=localhost}
|
||||
PHPMYADMIN_PORT=${TESTSUITE_PORT:=80}
|
||||
PHPMYADMIN_URL=http://${PHPMYADMIN_HOSTNAME}:${PHPMYADMIN_PORT}/
|
||||
|
||||
# Set database environment
|
||||
PHPMYADMIN_DB_HOSTNAME=${PMA_HOST:=localhost}
|
||||
PHPMYADMIN_DB_PORT=${PMA_PORT:=3306}
|
||||
TESTSUITE_USER=${TESTSUITE_USER:=root}
|
||||
TESTSUITE_ROOT_PASSWORD=${TESTSUITE_ROOT_PASSWORD:-}
|
||||
|
||||
SUBJECT_CA="/C=US/O=phpMyAdmin testing/OU=Docker/CN=ssl-ca.phpmyadmin.local/emailAddress=ssl-ca@example.org"
|
||||
SUBJECT_CLIENT="/C=US/O=phpMyAdmin testing/OU=Docker/CN=client.phpmyadmin.local/emailAddress=secure-user@example.org"
|
||||
|
||||
if [ "${TESTSUITE_USER}" = "root" ] && [ -n "${TESTSUITE_ROOT_PASSWORD}" ]; then
|
||||
echo "Do not use TESTSUITE_ROOT_PASSWORD with TESTSUITE_USER=root"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
TEST_CLI_ARGS=""
|
||||
if [ -n "${TESTSUITE_HOSTNAME_ARBITRARY:-}" ]; then
|
||||
TEST_CLI_ARGS="$TEST_CLI_ARGS --server ${PHPMYADMIN_DB_HOSTNAME}"
|
||||
fi
|
||||
|
||||
if [ -n "${TESTSUITE_ROOT_PASSWORD}" ]; then
|
||||
TEST_CLI_ARGS="$TEST_CLI_ARGS --root-password ${TESTSUITE_ROOT_PASSWORD}"
|
||||
fi
|
||||
|
||||
# Find test script
|
||||
if [ -f ./phpmyadmin_test.py ] ; then
|
||||
FILENAME=./phpmyadmin_test.py
|
||||
else
|
||||
FILENAME=./testing/phpmyadmin_test.py
|
||||
fi
|
||||
|
||||
SSL_FLAG="--skip-ssl"
|
||||
|
||||
if [ -n "${IS_USING_SSL:-}" ]; then
|
||||
SSL_FLAG="--ssl --ssl-verify-server-cert --ssl-ca=/etc/phpmyadmin/ssl/ca-cert.pem"
|
||||
fi
|
||||
|
||||
mariadb $SSL_FLAG -h "${PHPMYADMIN_DB_HOSTNAME}" -P"${PHPMYADMIN_DB_PORT}" -u"$TESTSUITE_USER" -p"${TESTSUITE_PASSWORD}" -e "SELECT @@version;SHOW VARIABLES LIKE 'require_secure_transport';SHOW VARIABLES LIKE '%ssl%';"
|
||||
|
||||
if [ -n "${IS_USING_SSL:-}" ]; then
|
||||
set +e
|
||||
mariadb --skip-ssl -h "${PHPMYADMIN_DB_HOSTNAME}" -P"${PHPMYADMIN_DB_PORT}" -u"$TESTSUITE_USER" -p"${TESTSUITE_PASSWORD}" -e "SELECT @@version;SHOW VARIABLES LIKE 'require_secure_transport';" 1> /dev/null 2> /dev/null
|
||||
if [ $? != 1 ]; then
|
||||
echo "The server does not enforce SSL connections, stopping the test."
|
||||
exit 1
|
||||
fi
|
||||
set -e
|
||||
fi
|
||||
|
||||
if [ -n "${IS_USING_SSL:-}" ] && [ -n "${TESTSUITE_ROOT_PASSWORD}" ]; then
|
||||
mariadb $SSL_FLAG -h "${PHPMYADMIN_DB_HOSTNAME}" -P"${PHPMYADMIN_DB_PORT}" -u"root" -p"${TESTSUITE_ROOT_PASSWORD}" \
|
||||
-e "CREATE USER 'ssl-specific-user'@'%' REQUIRE SUBJECT '$SUBJECT_CLIENT' AND ISSUER '$SUBJECT_CA';"
|
||||
|
||||
set +e
|
||||
mariadb $SSL_FLAG --ssl-cert=/etc/phpmyadmin/ssl/client-cert.pem --ssl-key=/etc/phpmyadmin/ssl/client-key.pem -h "${PHPMYADMIN_DB_HOSTNAME}" -P"${PHPMYADMIN_DB_PORT}" -u"ssl-specific-user" -e "SELECT @@version;SHOW VARIABLES LIKE 'require_secure_transport';" 1> /dev/null 2> /dev/null
|
||||
if [ $? != 0 ]; then
|
||||
echo "The server should accept the SSL client cert login, stopping the test."
|
||||
exit 1
|
||||
fi
|
||||
set -e
|
||||
|
||||
set +e
|
||||
mariadb $SSL_FLAG -h "${PHPMYADMIN_DB_HOSTNAME}" -P"${PHPMYADMIN_DB_PORT}" -u"ssl-specific-user" -e "SELECT @@version;SHOW VARIABLES LIKE 'require_secure_transport';" 1> /dev/null 2> /dev/null
|
||||
if [ $? != 1 ]; then
|
||||
echo "The server should refuse the login without a client cert, stopping the test."
|
||||
exit 1
|
||||
fi
|
||||
set -e
|
||||
fi
|
||||
|
||||
ret=$?
|
||||
|
||||
if [ $ret -ne 0 ] ; then
|
||||
echo "Could not connect to ${PHPMYADMIN_DB_HOSTNAME} on port ${PHPMYADMIN_DB_PORT}"
|
||||
exit $ret
|
||||
fi
|
||||
|
||||
curl -fsSL --output /dev/null "${PHPMYADMIN_URL}"
|
||||
ret=$?
|
||||
|
||||
if [ $ret -ne 0 ] ; then
|
||||
echo "Could not connect to ${PHPMYADMIN_URL}"
|
||||
exit $ret
|
||||
fi
|
||||
|
||||
# Perform tests
|
||||
ret=0
|
||||
pytest -p no:cacheprovider -q --url "$PHPMYADMIN_URL" --username $TESTSUITE_USER --password "$TESTSUITE_PASSWORD" $TEST_CLI_ARGS $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: FAILED"
|
||||
exit $ret
|
||||
fi
|
||||
|
||||
echo "Result of ${PHPMYADMIN_DB_HOSTNAME} tests: SUCCESS"
|
||||
+5395
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,101 @@
|
||||
#!/bin/bash
|
||||
set -eu -o pipefail
|
||||
|
||||
variants=(
|
||||
apache
|
||||
fpm
|
||||
fpm-alpine
|
||||
)
|
||||
|
||||
declare -A base=(
|
||||
[apache]='debian'
|
||||
[fpm]='debian'
|
||||
[fpm-alpine]='alpine'
|
||||
)
|
||||
|
||||
declare -A php_version=(
|
||||
[default]='8.3'
|
||||
)
|
||||
|
||||
declare -A cmd=(
|
||||
[apache]='apache2-foreground'
|
||||
[fpm]='php-fpm'
|
||||
[fpm-alpine]='php-fpm'
|
||||
)
|
||||
|
||||
gpg_key='3D06A59ECE730EB71B511C17CE752F178259BD92'
|
||||
|
||||
function download_url() {
|
||||
echo "https://files.phpmyadmin.net/phpMyAdmin/$1/phpMyAdmin-$1-all-languages.tar.xz"
|
||||
}
|
||||
|
||||
function create_variant() {
|
||||
local variant="$1"
|
||||
local version="$2"
|
||||
local sha256="$3"
|
||||
|
||||
local branch="$(sed -ne 's/^\([0-9]*\.[0-9]*\)\..*$/\1/p' <<< "$version")"
|
||||
local url="$(download_url "$version")"
|
||||
local ascUrl="$(download_url "$version").asc"
|
||||
local phpVersion="${php_version[$version]-${php_version[default]}}"
|
||||
|
||||
echo "updating $version [$branch] $variant"
|
||||
|
||||
# Create the variant directory with a Dockerfile
|
||||
mkdir -p "$variant"
|
||||
|
||||
local template="Dockerfile-${base[$variant]}.template"
|
||||
echo "# DO NOT EDIT: created by update.sh from $template" > "$variant/Dockerfile"
|
||||
cat "$template" >> "$variant/Dockerfile"
|
||||
|
||||
# Replace Dockerfile variables
|
||||
sed -ri -e '
|
||||
s/%%VARIANT%%/'"$variant"'/;
|
||||
s/%%VERSION%%/'"$version"'/;
|
||||
s/%%SHA256%%/'"$sha256"'/;
|
||||
s/%%DOWNLOAD_URL%%/'"$(sed -e 's/[\/&]/\\&/g' <<< "$url")"'/;
|
||||
s/%%DOWNLOAD_URL_ASC%%/'"$(sed -e 's/[\/&]/\\&/g' <<< "$ascUrl")"'/;
|
||||
s/%%PHP_VERSION%%/'"$phpVersion"'/g;
|
||||
s/%%GPG_KEY%%/'"$gpg_key"'/g;
|
||||
s/%%CMD%%/'"${cmd[$variant]}"'/;
|
||||
' "$variant/Dockerfile"
|
||||
|
||||
# Copy docker-entrypoint.sh
|
||||
cp docker-entrypoint.sh "$variant/docker-entrypoint.sh"
|
||||
if [ "$variant" != "apache" ]; then
|
||||
sed -i "/^# start: Apache specific settings$/,/^# end: Apache specific settings$/d" "$variant/docker-entrypoint.sh"
|
||||
sed -i "/^\s*# start: Apache specific build$/,/^\s*# end: Apache specific build$/d" "$variant/Dockerfile"
|
||||
fi
|
||||
|
||||
# Copy config.inc.php and helpers.php
|
||||
cp config.inc.php "$variant/config.inc.php"
|
||||
cp helpers.php "$variant/helpers.php"
|
||||
|
||||
# Add variant to versions.json
|
||||
versionVariantsJson="$(jq -e \
|
||||
--arg branch "$branch" --arg variant "$variant" --arg base "${base[$variant]}" --arg phpVersion "$phpVersion" \
|
||||
'.[$branch].variants[$variant] = {"variant": $variant, "base": $base, "phpVersion": $phpVersion}' versions.json)"
|
||||
versionJson="$(jq -e \
|
||||
--arg branch "$branch" --arg version "$version" --arg sha256 "$sha256" --arg url "$url" --arg ascUrl "$ascUrl" --argjson variants "$versionVariantsJson" \
|
||||
'.[$branch] = {"branch": $branch, "version": $version, "sha256": $sha256, "url": $url, "ascUrl": $ascUrl, "variants": $variants[$branch].variants}' versions.json)"
|
||||
printf '%s\n' "$versionJson" > versions.json
|
||||
}
|
||||
|
||||
# Check script 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; }
|
||||
[ -n "${BASH_VERSINFO}" ] && [ -n "${BASH_VERSINFO[0]}" ] && [ ${BASH_VERSINFO[0]} -ge 4 ] \
|
||||
|| { echo >&2 "Bash 4.0 or greater is required. Aborting."; exit 1; }
|
||||
|
||||
# Create variants
|
||||
printf '%s\n' "{}" > versions.json
|
||||
|
||||
latest="$(curl -fsSL 'https://www.phpmyadmin.net/home_page/version.json' | jq -r '.version' | grep -E '^[0-9]{1,}.[0-9]{1,}.[0-9]{1,}$')"
|
||||
sha256="$(curl -fsSL "$(download_url "$latest").sha256" | cut -f1 -d ' ' | tr -cd 'a-f0-9' | cut -c 1-64)"
|
||||
|
||||
for variant in "${variants[@]}"; do
|
||||
create_variant "$variant" "$latest" "$sha256"
|
||||
done
|
||||
|
||||
# Cleanup the file as for now it's not wanted in the repository
|
||||
rm versions.json
|
||||
Reference in New Issue
Block a user