mirror of
https://github.com/phpmyadmin/docker.git
synced 2026-08-24 10:13:22 -05:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1241428f99 | ||
|
|
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 |
@@ -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@v3
|
||||
- uses: docker-library/bashbrew@v0.1.5
|
||||
- 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@v3
|
||||
- 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,29 @@
|
||||
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.4", "mysql:5.7", "mariadb:latest", "mysql:latest"]
|
||||
configuration: ["default", "one-host", "fs-import-export", "different-apache-port"]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- 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 }}
|
||||
-90
@@ -1,90 +0,0 @@
|
||||
services:
|
||||
- docker
|
||||
|
||||
language: python
|
||||
python: 2.7
|
||||
dist: bionic
|
||||
|
||||
stages:
|
||||
- name: "Build images"
|
||||
- name: "Test docker-compose"
|
||||
- name: "Run tests in testing container"
|
||||
|
||||
before_install:
|
||||
- export TESTSUITE_PASSWORD=`openssl rand -base64 30`
|
||||
- docker run --name db_server -e MYSQL_ROOT_PASSWORD=$TESTSUITE_PASSWORD -v $PWD/testing/testing.cnf:/etc/mysql/conf.d/testing.cnf:ro -d $DB
|
||||
|
||||
install:
|
||||
- pip install mechanize html5lib pytest
|
||||
|
||||
_helpers:
|
||||
- &test-docker-compose
|
||||
stage: "Test docker-compose"
|
||||
script:
|
||||
- docker-compose -f docker-compose.testing.yml up -d db_server
|
||||
- docker-compose -f docker-compose.testing.yml up -d
|
||||
- docker-compose exec phpmyadmin /test-docker.sh phpmyadmin_testing 80 phpmyadmin_testing_db
|
||||
- docker-compose stop
|
||||
- &test-apache-image
|
||||
stage: "Run tests in testing container"
|
||||
script:
|
||||
# Build image
|
||||
- docker build -t phpmyadmin/phpmyadmin apache
|
||||
# Test for single database
|
||||
- docker run --name testadmin -d --link db_server:db -p 9090:80 phpmyadmin/phpmyadmin
|
||||
- ./testing/test-docker.sh testadmin 9090
|
||||
# Test for single database using env
|
||||
- docker run --name envadmin -d --link db_server:db2 -e PMA_HOST=db2 -p 6060:80 phpmyadmin/phpmyadmin
|
||||
- ./testing/test-docker.sh envadmin 6060
|
||||
# Test for arbitrary database
|
||||
- docker run --name arbitraryadmin -d --link db_server:db3 -e PMA_ARBITRARY=1 -p 7070:80 phpmyadmin/phpmyadmin
|
||||
- ./testing/test-docker.sh arbitraryadmin 7070 db3
|
||||
# Test for arbitrary database with user config
|
||||
- docker run --name userconfigadmin -d --link db_server:db3 -v `readlink -f ./testing/config.test.inc.php`:/etc/phpmyadmin/config.user.inc.php -p 7080:80 phpmyadmin/phpmyadmin
|
||||
- ./testing/test-docker.sh userconfigadmin 7080 db3
|
||||
- &test-docker-compose-db
|
||||
stage: "Test docker-compose"
|
||||
script:
|
||||
- docker-compose -f docker-compose.yml -f docker-compose.db.yml up -d
|
||||
- ./testing/test-docker.sh phpmyadmin 8080 db_server
|
||||
- docker-compose stop
|
||||
- &build-image
|
||||
stage: "Build images"
|
||||
before_install: skip
|
||||
install: skip
|
||||
|
||||
jobs:
|
||||
include:
|
||||
- <<: *test-docker-compose
|
||||
name: "Run and stop container using testing docker-compose file for MariaDB"
|
||||
env: DB=mariadb:latest
|
||||
- <<: *test-docker-compose
|
||||
name: "Run and stop container using testing docker-compose file for MySQL"
|
||||
env: DB=mysql:latest
|
||||
- <<: *test-docker-compose-db
|
||||
name: "Run and stop container using db docker-compose file for MariaDB"
|
||||
env: DB=mariadb:latest
|
||||
- <<: *test-docker-compose-db
|
||||
name: "Run and stop container using db docker-compose file for MySQL"
|
||||
env: DB=mysql:latest
|
||||
- <<: *build-image
|
||||
name: "Apache amd64"
|
||||
arch: amd64
|
||||
script:
|
||||
- docker build -t phpmyadmin/phpmyadmin apache
|
||||
- <<: *build-image
|
||||
name: "fpm amd64"
|
||||
arch: amd64
|
||||
script:
|
||||
- docker build -t phpmyadmin/phpmyadmin fpm
|
||||
- <<: *build-image
|
||||
name: "fpm-alpine amd64"
|
||||
arch: amd64
|
||||
script:
|
||||
- docker build -t phpmyadmin/phpmyadmin fpm-alpine
|
||||
- <<: *test-apache-image
|
||||
name: "Run testing for MariaDB"
|
||||
env: DB=mariadb:latest
|
||||
- <<: *test-apache-image
|
||||
name: "Run testing for MySQL"
|
||||
env: DB=mysql:latest
|
||||
@@ -0,0 +1,71 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||
|
||||
## [Unreleased] - YYYY-MM-DD
|
||||
|
||||
- Move docker-compose test files into a folder
|
||||
- Fix the section about E2E tests in `README.md`
|
||||
- Support docker secrets from file for `PMA_USER` (#372)
|
||||
- Support docker secrets from file for `PMA_CONTROLUSER` (#372)
|
||||
- Support docker secrets from file for `PMA_CONTROLHOST` (#372)
|
||||
- Allow a different Apache port with `APACHE_PORT` (#340)
|
||||
- Add support for ENVs `PMA_UPLOADDIR` and `PMA_SAVEDIR` (#384)
|
||||
- Fixed a bug with `APACHE_PORT` ENV on container restart (#381)
|
||||
- Update to PHP 8.1 (#393)
|
||||
|
||||
## [5.1.4] - 2022-05-11
|
||||
|
||||
- Fix incorrect image tag name in `README.md`
|
||||
|
||||
## [5.1.2] - 2022-01-22
|
||||
|
||||
- Fix GPG keyservers in Dockerfiles
|
||||
- Remove microbadger badges, it closed
|
||||
- Improve the README file
|
||||
- Fix add back composer.json and remove non needed source files (#345)
|
||||
- Update to PHP 8.0 (#325)
|
||||
|
||||
## [5.1.1] - 2021-06-04
|
||||
|
||||
- Improve documentation
|
||||
|
||||
## [5.1.0] - 2021-02-24
|
||||
|
||||
- Set ini setting `max_input_vars = 10000`
|
||||
- Add support for ENV `PMA_QUERYHISTORYMAX`
|
||||
- Add support for ENV `MAX_EXECUTION_TIME`
|
||||
- Add support for ENV `MEMORY_LIMIT`
|
||||
- Move to GitHub actions
|
||||
- Re-work the test system
|
||||
- Support docker secrets from file for `PMA_CONTROLPASS`
|
||||
- Generate phpmyadmin-misc.ini from ENVs
|
||||
|
||||
## [4.9.{6,7}] - 2020-10-{10,16} and [5.0.{3,4}] - 2020-10-{10,16}
|
||||
|
||||
- Add `tzdata` package
|
||||
- Extract downloaded files directly to web root `/var/www/html/` (#277)
|
||||
- Add SHA checksum when downloading a version
|
||||
- Improved `UPLOAD_LIMIT` documentation
|
||||
- Update documentation from `phpmyadmin/phpmyadmin` to `phpmyadmin`
|
||||
- `phpmyadmin` is now the official image in the Docker official library
|
||||
|
||||
## [5.0.2] - 2020-03-21
|
||||
|
||||
- Add org.opencontainers.image.* labels
|
||||
- Apply some feedback from docker-library team to Dockerfiles
|
||||
|
||||
## [4.9.3] - 2020-01-02 and [5.0.0] - 2019-12-26
|
||||
|
||||
- Add support for ENV `HIDE_PHP_VERSION` to set ini setting `expose_php = Off`
|
||||
- Add support for ENV `UPLOAD_LIMIT` to set `upload_max_filesize` and `post_max_size` ini settings
|
||||
- Add support for ENVs `PMA_CONFIG_BASE64` and `PMA_USER_CONFIG_BASE64` (#192)
|
||||
- Support docker secrets from files for `PMA_PASSWORD`, `MYSQL_ROOT_PASSWORD` and `MYSQL_PASSWORD`
|
||||
- Support docker secrets from files for `PMA_HOSTS` and `PMA_HOST`
|
||||
|
||||
## [4.9.2-2] - 2020-12-20
|
||||
|
||||
- Update to PHP 7.4 (#257)
|
||||
- Drop ini setting `opcache.enable_cli=1`
|
||||
+44
-24
@@ -1,8 +1,9 @@
|
||||
FROM php:7.4-%%VARIANT%%
|
||||
FROM php:8.1-%%VARIANT%%
|
||||
|
||||
# docker-entrypoint.sh dependencies
|
||||
RUN apk add --no-cache \
|
||||
bash
|
||||
bash \
|
||||
tzdata
|
||||
|
||||
# Install dependencies
|
||||
RUN set -ex; \
|
||||
@@ -33,11 +34,16 @@ RUN set -ex; \
|
||||
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
|
||||
)"; \
|
||||
apk add --virtual .phpmyadmin-phpexts-rundeps $runDeps; \
|
||||
apk del .build-deps
|
||||
apk del --no-network .build-deps
|
||||
|
||||
# set recommended PHP.ini settings
|
||||
# see https://secure.php.net/manual/en/opcache.installation.php
|
||||
RUN { \
|
||||
ENV MAX_EXECUTION_TIME 600
|
||||
ENV MEMORY_LIMIT 512M
|
||||
ENV UPLOAD_LIMIT 2048K
|
||||
RUN set -ex; \
|
||||
\
|
||||
{ \
|
||||
echo 'opcache.memory_consumption=128'; \
|
||||
echo 'opcache.interned_strings_buffer=8'; \
|
||||
echo 'opcache.max_accelerated_files=4000'; \
|
||||
@@ -46,20 +52,33 @@ RUN { \
|
||||
} > $PHP_INI_DIR/conf.d/opcache-recommended.ini; \
|
||||
\
|
||||
{ \
|
||||
echo 'session.cookie_httponly = 1'; \
|
||||
echo 'session.use_strict_mode = 1'; \
|
||||
echo 'session.cookie_httponly=1'; \
|
||||
echo 'session.use_strict_mode=1'; \
|
||||
} > $PHP_INI_DIR/conf.d/session-strict.ini; \
|
||||
\
|
||||
{ \
|
||||
echo 'allow_url_fopen = Off'; \
|
||||
echo 'max_execution_time = 600'; \
|
||||
echo 'memory_limit = 512M'; \
|
||||
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}'; \
|
||||
} > $PHP_INI_DIR/conf.d/phpmyadmin-misc.ini
|
||||
|
||||
# Calculate download URL
|
||||
ENV VERSION %%VERSION%%
|
||||
ENV SHA256 %%SHA256%%
|
||||
ENV URL https://files.phpmyadmin.net/phpMyAdmin/${VERSION}/phpMyAdmin-${VERSION}-all-languages.tar.xz
|
||||
LABEL version=$VERSION
|
||||
|
||||
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; \
|
||||
@@ -69,24 +88,25 @@ RUN set -ex; \
|
||||
\
|
||||
export GNUPGHOME="$(mktemp -d)"; \
|
||||
export GPGKEY="3D06A59ECE730EB71B511C17CE752F178259BD92"; \
|
||||
curl --output phpMyAdmin.tar.xz --location $URL; \
|
||||
curl --output phpMyAdmin.tar.xz.asc --location $URL.asc; \
|
||||
gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPGKEY" \
|
||||
|| gpg --batch --keyserver ipv4.pool.sks-keyservers.net --recv-keys "$GPGKEY" \
|
||||
|| gpg --batch --keyserver keys.gnupg.net --recv-keys "$GPGKEY" \
|
||||
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 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 /usr/src; \
|
||||
tar -xf phpMyAdmin.tar.xz -C /var/www/html --strip-components=1; \
|
||||
mkdir -p /var/www/html/tmp; \
|
||||
chown www-data:www-data /var/www/html/tmp; \
|
||||
gpgconf --kill all; \
|
||||
rm -r "$GNUPGHOME" phpMyAdmin.tar.xz phpMyAdmin.tar.xz.asc; \
|
||||
mv /usr/src/phpMyAdmin-$VERSION-all-languages /usr/src/phpmyadmin; \
|
||||
rm -rf /usr/src/phpmyadmin/setup/ /usr/src/phpmyadmin/examples/ /usr/src/phpmyadmin/test/ /usr/src/phpmyadmin/po/ /usr/src/phpmyadmin/composer.json /usr/src/phpmyadmin/RELEASE-DATE-$VERSION; \
|
||||
sed -i "s@define('CONFIG_DIR'.*@define('CONFIG_DIR', '/etc/phpmyadmin/');@" /usr/src/phpmyadmin/libraries/vendor_config.php; \
|
||||
# Add directory for sessions to allow session persistence
|
||||
mkdir /sessions; \
|
||||
mkdir -p /var/nginx/client_body_temp; \
|
||||
apk del .fetch-deps
|
||||
rm -r -v /var/www/html/setup/ /var/www/html/examples/ /var/www/html/js/src/ /var/www/html/templates/test/ /var/www/html/babel.config.json /var/www/html/doc/html/_sources/ /var/www/html/RELEASE-DATE-$VERSION /var/www/html/CONTRIBUTING.md; \
|
||||
grep -q -F "'configFile' => ROOT_PATH . 'config.inc.php'," /var/www/html/libraries/vendor_config.php; \
|
||||
sed -i "s@'configFile' => .*@'configFile' => '/etc/phpmyadmin/config.inc.php',@" /var/www/html/libraries/vendor_config.php; \
|
||||
grep -q -F "'configFile' => '/etc/phpmyadmin/config.inc.php'," /var/www/html/libraries/vendor_config.php; \
|
||||
php -l /var/www/html/libraries/vendor_config.php; \
|
||||
apk del --no-network .fetch-deps
|
||||
|
||||
# Copy configuration
|
||||
COPY config.inc.php /etc/phpmyadmin/config.inc.php
|
||||
|
||||
+49
-26
@@ -1,4 +1,4 @@
|
||||
FROM php:7.4-%%VARIANT%%
|
||||
FROM php:8.1-%%VARIANT%%
|
||||
|
||||
# Install dependencies
|
||||
RUN set -ex; \
|
||||
@@ -40,7 +40,12 @@ RUN set -ex; \
|
||||
|
||||
# set recommended PHP.ini settings
|
||||
# see https://secure.php.net/manual/en/opcache.installation.php
|
||||
RUN { \
|
||||
ENV MAX_EXECUTION_TIME 600
|
||||
ENV MEMORY_LIMIT 512M
|
||||
ENV UPLOAD_LIMIT 2048K
|
||||
RUN set -ex; \
|
||||
\
|
||||
{ \
|
||||
echo 'opcache.memory_consumption=128'; \
|
||||
echo 'opcache.interned_strings_buffer=8'; \
|
||||
echo 'opcache.max_accelerated_files=4000'; \
|
||||
@@ -49,51 +54,69 @@ RUN { \
|
||||
} > $PHP_INI_DIR/conf.d/opcache-recommended.ini; \
|
||||
\
|
||||
{ \
|
||||
echo 'session.cookie_httponly = 1'; \
|
||||
echo 'session.use_strict_mode = 1'; \
|
||||
echo 'session.cookie_httponly=1'; \
|
||||
echo 'session.use_strict_mode=1'; \
|
||||
} > $PHP_INI_DIR/conf.d/session-strict.ini; \
|
||||
\
|
||||
{ \
|
||||
echo 'allow_url_fopen = Off'; \
|
||||
echo 'max_execution_time = 600'; \
|
||||
echo 'memory_limit = 512M'; \
|
||||
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}'; \
|
||||
} > $PHP_INI_DIR/conf.d/phpmyadmin-misc.ini
|
||||
|
||||
# Calculate download URL
|
||||
ENV VERSION %%VERSION%%
|
||||
ENV SHA256 %%SHA256%%
|
||||
ENV URL https://files.phpmyadmin.net/phpMyAdmin/${VERSION}/phpMyAdmin-${VERSION}-all-languages.tar.xz
|
||||
LABEL version=$VERSION
|
||||
|
||||
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; \
|
||||
fetchDeps=" \
|
||||
\
|
||||
savedAptMark="$(apt-mark showmanual)"; \
|
||||
\
|
||||
apt-get update; \
|
||||
apt-get install -y --no-install-recommends \
|
||||
gnupg \
|
||||
dirmngr \
|
||||
"; \
|
||||
apt-get update; \
|
||||
apt-get install -y --no-install-recommends $fetchDeps; \
|
||||
; \
|
||||
\
|
||||
export GNUPGHOME="$(mktemp -d)"; \
|
||||
export GPGKEY="3D06A59ECE730EB71B511C17CE752F178259BD92"; \
|
||||
curl --output phpMyAdmin.tar.xz --location $URL; \
|
||||
curl --output phpMyAdmin.tar.xz.asc --location $URL.asc; \
|
||||
gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPGKEY" \
|
||||
|| gpg --batch --keyserver ipv4.pool.sks-keyservers.net --recv-keys "$GPGKEY" \
|
||||
|| gpg --batch --keyserver keys.gnupg.net --recv-keys "$GPGKEY" \
|
||||
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 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 /usr/src; \
|
||||
tar -xf phpMyAdmin.tar.xz -C /var/www/html --strip-components=1; \
|
||||
mkdir -p /var/www/html/tmp; \
|
||||
chown www-data:www-data /var/www/html/tmp; \
|
||||
gpgconf --kill all; \
|
||||
rm -r "$GNUPGHOME" phpMyAdmin.tar.xz phpMyAdmin.tar.xz.asc; \
|
||||
mv /usr/src/phpMyAdmin-$VERSION-all-languages /usr/src/phpmyadmin; \
|
||||
rm -rf /usr/src/phpmyadmin/setup/ /usr/src/phpmyadmin/examples/ /usr/src/phpmyadmin/test/ /usr/src/phpmyadmin/po/ /usr/src/phpmyadmin/composer.json /usr/src/phpmyadmin/RELEASE-DATE-$VERSION; \
|
||||
sed -i "s@define('CONFIG_DIR'.*@define('CONFIG_DIR', '/etc/phpmyadmin/');@" /usr/src/phpmyadmin/libraries/vendor_config.php; \
|
||||
# Add directory for sessions to allow session persistence
|
||||
mkdir /sessions; \
|
||||
mkdir -p /var/nginx/client_body_temp; \
|
||||
rm -r -v /var/www/html/setup/ /var/www/html/examples/ /var/www/html/js/src/ /var/www/html/templates/test/ /var/www/html/babel.config.json /var/www/html/doc/html/_sources/ /var/www/html/RELEASE-DATE-$VERSION /var/www/html/CONTRIBUTING.md; \
|
||||
grep -q -F "'configFile' => ROOT_PATH . 'config.inc.php'," /var/www/html/libraries/vendor_config.php; \
|
||||
sed -i "s@'configFile' => .*@'configFile' => '/etc/phpmyadmin/config.inc.php',@" /var/www/html/libraries/vendor_config.php; \
|
||||
grep -q -F "'configFile' => '/etc/phpmyadmin/config.inc.php'," /var/www/html/libraries/vendor_config.php; \
|
||||
php -l /var/www/html/libraries/vendor_config.php; \
|
||||
\
|
||||
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $fetchDeps; \
|
||||
apt-mark auto '.*' > /dev/null; \
|
||||
apt-mark manual $savedAptMark; \
|
||||
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Copy configuration
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
DOCKER_REPO = phpmyadmin/phpmyadmin
|
||||
DOCKER_REPO = phpmyadmin
|
||||
|
||||
.PHONY: all build run logs clean stop rm prune
|
||||
|
||||
@@ -16,21 +16,24 @@ build-fpm-alpine:
|
||||
docker build ${DOCKER_FLAGS} -t ${DOCKER_REPO}:testing-fpm-alpine fpm-alpine
|
||||
|
||||
run:
|
||||
docker-compose -f docker-compose.testing.yml up -d
|
||||
docker-compose -f ./testing/docker-compose/docker-compose.testing-default.yml up -d
|
||||
|
||||
run-tests:
|
||||
docker-compose exec phpmyadmin /test-docker.sh phpmyadmin_testing 80 phpmyadmin_testing_db
|
||||
testing-%:
|
||||
docker-compose -p "phpmyadmin_$@" -f ./testing/docker-compose/docker-compose.$@.yml up --build --abort-on-container-exit --exit-code-from=sut
|
||||
docker-compose -p "phpmyadmin_$@" -f ./testing/docker-compose/docker-compose.$@.yml down
|
||||
|
||||
run-tests: testing-default testing-one-host testing-fs-import-export testing-different-apache-port
|
||||
|
||||
logs:
|
||||
docker-compose -f docker-compose.testing.yml logs
|
||||
docker-compose -f ./testing/docker-compose/docker-compose.testing-default.yml logs
|
||||
|
||||
clean: stop rm prune
|
||||
|
||||
stop:
|
||||
docker-compose -f docker-compose.testing.yml stop
|
||||
docker-compose -f ./testing/docker-compose/docker-compose.testing-default.yml stop
|
||||
|
||||
rm:
|
||||
docker-compose -f docker-compose.testing.yml rm
|
||||
docker-compose -f ./testing/docker-compose/docker-compose.testing-default.yml rm
|
||||
|
||||
prune:
|
||||
docker rm `docker ps -q -a --filter status=exited`
|
||||
|
||||
@@ -1,39 +1,48 @@
|
||||
# Official phpMyAdmin Docker image
|
||||
|
||||
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.
|
||||
|
||||
Run phpMyAdmin with Alpine, Apache and PHP FPM.
|
||||
|
||||
[](https://travis-ci.org/phpmyadmin/docker)
|
||||
[][hub]
|
||||
[][hub]
|
||||
[](https://microbadger.com/images/phpmyadmin/phpmyadmin "Get your own image badge on microbadger.com")
|
||||
[](https://microbadger.com/images/phpmyadmin/phpmyadmin "Get your own version badge on microbadger.com")
|
||||
[](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 does use MySQL server credential, please check the corresponding
|
||||
server image for information how it is setup.
|
||||
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 use following environment variables to define these:
|
||||
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
|
||||
## Supported Docker Hub tags
|
||||
|
||||
The following tags are available:
|
||||
|
||||
* `latest`, `fpm`, and `fpm-alpine` are always the most recent released version
|
||||
* Major versions, such as `5`, `5-fpm`, and `5-fpm-alpine`
|
||||
* Specific minor versions, such as `5.0`, `5.0-fpm`, and `5-fpm-alpine`
|
||||
* Specific patch versions, such as `5.0.0`, `5.0.0-fpm`, and `5.0.0-alpine`. Note that, on rare occasion,
|
||||
there may be an intermediary "docker-only" release, such as 4.9.2-1
|
||||
* `edge`, `edge-fpm`, `edge-fpm-alpine`, a development version build from the daily snapshot
|
||||
* Specific patch versions, such as `5.0.0`, `5.0.0-fpm`, and `5.0.0-fpm-alpine`. Note that, on rare occasion, there may be an intermediary "docker-only" release, such as 4.9.2-1
|
||||
|
||||
A complete list of tags is [available at Docker Hub](https://hub.docker.com/r/phpmyadmin/phpmyadmin/tags)
|
||||
A complete list of tags is [available at Docker Hub](https://hub.docker.com/_/phpmyadmin?tab=tags)
|
||||
|
||||
## Image variants
|
||||
|
||||
@@ -41,77 +50,93 @@ We provide three variations:
|
||||
|
||||
* "apache" includes a full Apache webserver with PHP and includes everything needed to work out of the box.
|
||||
This is the default when only a version number is requested.
|
||||
* "fpm" only starts a PHP FPM container. Use this variant if you already have a seperate webserver.
|
||||
* "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 seperate webserver. If you need more tools that are not available on Alpine Linux, use the fpm image instead.
|
||||
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 -e PMA_ARBITRARY=1 -p 8080:80 phpmyadmin/phpmyadmin
|
||||
```sh
|
||||
docker run --name phpmyadmin -d -e PMA_ARBITRARY=1 -p 8080:80 phpmyadmin:latest
|
||||
```
|
||||
|
||||
## Usage with docker-compose and 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.3
|
||||
restart: always
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: notSecureChangeMe
|
||||
|
||||
## Run the E2E tests with docker-compose
|
||||
|
||||
You can run the E2E tests with the local test environment by running MariaDB/MySQL databases. Adding ENV variable `PHPMYADMIN_RUN_TEST=true` already added on docker-compose file. Simply run:
|
||||
|
||||
Using the docker-compose.testing.yml from https://github.com/phpmyadmin/docker
|
||||
|
||||
```
|
||||
docker-compose -f docker-compose.testing.yml up phpmyadmin
|
||||
phpmyadmin:
|
||||
image: phpmyadmin
|
||||
restart: always
|
||||
ports:
|
||||
- 8080:80
|
||||
environment:
|
||||
- PMA_ARBITRARY=1
|
||||
```
|
||||
|
||||
## 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
|
||||
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:
|
||||
```
|
||||
docker run --name myadmin -d --link mysql_db_server:db -p 8080:80 -v /some/local/directory/config.user.inc.php:/etc/phpmyadmin/config.user.inc.php phpmyadmin/phpmyadmin
|
||||
|
||||
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
|
||||
```
|
||||
|
||||
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
|
||||
Be sure to have `<?php` as your first line of the configuration file or the contents will not be detected as PHP code.
|
||||
|
||||
## Usage behind reverse proxys
|
||||
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
|
||||
|
||||
## 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.
|
||||
|
||||
@@ -124,28 +149,58 @@ Set the variable ``PMA_ABSOLUTE_URI`` to the fully-qualified path (``https://pma
|
||||
* ``PMA_HOSTS`` - define comma separated list of address/host names of the MySQL servers
|
||||
* ``PMA_VERBOSES`` - define comma separated list of verbose names of the MySQL servers
|
||||
* ``PMA_PORTS`` - define comma separated list of ports of the MySQL servers
|
||||
* ``PMA_USER`` and ``PMA_PASSWORD`` - define username to use for config authentication method
|
||||
* ``PMA_ABSOLUTE_URI`` - define user-facing URI
|
||||
* ``HIDE_PHP_VERSION`` - if defined, will hide the php version (`expose_php = Off`). Set to any value (such as HIDE_PHP_VERSION=true).
|
||||
* ``UPLOAD_LIMIT`` - if set, will override the default value for apache and php-fpm (default value is 2048 kb)
|
||||
* ``PMA_CONFIG_BASE64`` - if set, will override the default config.inc.php with the base64 decoded contents of the variable
|
||||
* ``PMA_USER_CONFIG_BASE64`` - if set, will override the default config.user.inc.php with the base64 decoded contents of the variable
|
||||
* ``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)
|
||||
* ``HIDE_PHP_VERSION`` - if defined, this option will hide the PHP version (`expose_php = Off`). Set to any value (such as `HIDE_PHP_VERSION=true`).
|
||||
* ``APACHE_PORT`` - if defined, this option will change the default Apache port from `80` in case you want it to run on a different port like an unprivileged port. Set to any port value (such as `APACHE_PORT=8090`)
|
||||
|
||||
For usage with Docker secrets, appending ``_FILE`` to the ``PMA_PASSWORD`` environment variable is allowed (it overrides ``PMA_PASSWORD`` if it is set):
|
||||
```
|
||||
docker run --name myadmin -d -e PMA_PASSWORD_FILE=/run/secrets/db_password.txt -p 8080:80 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 be read from a file using ``_FILE``
|
||||
- PMA_PASSWORD
|
||||
- MYSQL_ROOT_PASSWORD
|
||||
- MYSQL_PASSWORD
|
||||
- PMA_HOSTS
|
||||
- PMA_HOST
|
||||
|
||||
- `MYSQL_ROOT_PASSWORD`
|
||||
- `MYSQL_PASSWORD`
|
||||
- `PMA_USER`
|
||||
- `PMA_PASSWORD`
|
||||
- `PMA_HOSTS`
|
||||
- `PMA_HOST`
|
||||
- `PMA_CONTROLHOST`
|
||||
- `PMA_CONTROLUSER`
|
||||
- `PMA_CONTROLPASS`
|
||||
|
||||
## Run the E2E tests for this docker image
|
||||
|
||||
You can run the E2E test suite on a local test environment.
|
||||
The Requirements are `make`, `docker` and `docker-compose`.
|
||||
|
||||
Clone this repository: `https://github.com/phpmyadmin/docker.git`
|
||||
|
||||
And then run this command to start the test suite:
|
||||
```sh
|
||||
make run-tests
|
||||
```
|
||||
|
||||
For more detailed documentation see https://docs.phpmyadmin.net/en/latest/setup.html#installing-using-docker
|
||||
|
||||
[hub]: https://hub.docker.com/r/phpmyadmin/phpmyadmin/
|
||||
[hub]: https://hub.docker.com/_/phpmyadmin
|
||||
|
||||
Please report any issues with the Docker container to https://github.com/phpmyadmin/docker/issues
|
||||
|
||||
|
||||
+50
-27
@@ -1,4 +1,4 @@
|
||||
FROM php:7.4-apache
|
||||
FROM php:8.1-apache
|
||||
|
||||
# Install dependencies
|
||||
RUN set -ex; \
|
||||
@@ -40,7 +40,12 @@ RUN set -ex; \
|
||||
|
||||
# set recommended PHP.ini settings
|
||||
# see https://secure.php.net/manual/en/opcache.installation.php
|
||||
RUN { \
|
||||
ENV MAX_EXECUTION_TIME 600
|
||||
ENV MEMORY_LIMIT 512M
|
||||
ENV UPLOAD_LIMIT 2048K
|
||||
RUN set -ex; \
|
||||
\
|
||||
{ \
|
||||
echo 'opcache.memory_consumption=128'; \
|
||||
echo 'opcache.interned_strings_buffer=8'; \
|
||||
echo 'opcache.max_accelerated_files=4000'; \
|
||||
@@ -49,51 +54,69 @@ RUN { \
|
||||
} > $PHP_INI_DIR/conf.d/opcache-recommended.ini; \
|
||||
\
|
||||
{ \
|
||||
echo 'session.cookie_httponly = 1'; \
|
||||
echo 'session.use_strict_mode = 1'; \
|
||||
echo 'session.cookie_httponly=1'; \
|
||||
echo 'session.use_strict_mode=1'; \
|
||||
} > $PHP_INI_DIR/conf.d/session-strict.ini; \
|
||||
\
|
||||
{ \
|
||||
echo 'allow_url_fopen = Off'; \
|
||||
echo 'max_execution_time = 600'; \
|
||||
echo 'memory_limit = 512M'; \
|
||||
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}'; \
|
||||
} > $PHP_INI_DIR/conf.d/phpmyadmin-misc.ini
|
||||
|
||||
# Calculate download URL
|
||||
ENV VERSION 5.0.0
|
||||
ENV VERSION 5.2.1
|
||||
ENV SHA256 373f9599dfbd96d6fe75316d5dad189e68c305f297edf42377db9dd6b41b2557
|
||||
ENV URL https://files.phpmyadmin.net/phpMyAdmin/${VERSION}/phpMyAdmin-${VERSION}-all-languages.tar.xz
|
||||
LABEL version=$VERSION
|
||||
|
||||
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; \
|
||||
fetchDeps=" \
|
||||
\
|
||||
savedAptMark="$(apt-mark showmanual)"; \
|
||||
\
|
||||
apt-get update; \
|
||||
apt-get install -y --no-install-recommends \
|
||||
gnupg \
|
||||
dirmngr \
|
||||
"; \
|
||||
apt-get update; \
|
||||
apt-get install -y --no-install-recommends $fetchDeps; \
|
||||
; \
|
||||
\
|
||||
export GNUPGHOME="$(mktemp -d)"; \
|
||||
export GPGKEY="3D06A59ECE730EB71B511C17CE752F178259BD92"; \
|
||||
curl --output phpMyAdmin.tar.xz --location $URL; \
|
||||
curl --output phpMyAdmin.tar.xz.asc --location $URL.asc; \
|
||||
gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPGKEY" \
|
||||
|| gpg --batch --keyserver ipv4.pool.sks-keyservers.net --recv-keys "$GPGKEY" \
|
||||
|| gpg --batch --keyserver keys.gnupg.net --recv-keys "$GPGKEY" \
|
||||
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 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 /usr/src; \
|
||||
tar -xf phpMyAdmin.tar.xz -C /var/www/html --strip-components=1; \
|
||||
mkdir -p /var/www/html/tmp; \
|
||||
chown www-data:www-data /var/www/html/tmp; \
|
||||
gpgconf --kill all; \
|
||||
rm -r "$GNUPGHOME" phpMyAdmin.tar.xz phpMyAdmin.tar.xz.asc; \
|
||||
mv /usr/src/phpMyAdmin-$VERSION-all-languages /usr/src/phpmyadmin; \
|
||||
rm -rf /usr/src/phpmyadmin/setup/ /usr/src/phpmyadmin/examples/ /usr/src/phpmyadmin/test/ /usr/src/phpmyadmin/po/ /usr/src/phpmyadmin/composer.json /usr/src/phpmyadmin/RELEASE-DATE-$VERSION; \
|
||||
sed -i "s@define('CONFIG_DIR'.*@define('CONFIG_DIR', '/etc/phpmyadmin/');@" /usr/src/phpmyadmin/libraries/vendor_config.php; \
|
||||
# Add directory for sessions to allow session persistence
|
||||
mkdir /sessions; \
|
||||
mkdir -p /var/nginx/client_body_temp; \
|
||||
rm -r -v /var/www/html/setup/ /var/www/html/examples/ /var/www/html/js/src/ /var/www/html/templates/test/ /var/www/html/babel.config.json /var/www/html/doc/html/_sources/ /var/www/html/RELEASE-DATE-$VERSION /var/www/html/CONTRIBUTING.md; \
|
||||
grep -q -F "'configFile' => ROOT_PATH . 'config.inc.php'," /var/www/html/libraries/vendor_config.php; \
|
||||
sed -i "s@'configFile' => .*@'configFile' => '/etc/phpmyadmin/config.inc.php',@" /var/www/html/libraries/vendor_config.php; \
|
||||
grep -q -F "'configFile' => '/etc/phpmyadmin/config.inc.php'," /var/www/html/libraries/vendor_config.php; \
|
||||
php -l /var/www/html/libraries/vendor_config.php; \
|
||||
\
|
||||
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $fetchDeps; \
|
||||
apt-mark auto '.*' > /dev/null; \
|
||||
apt-mark manual $savedAptMark; \
|
||||
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Copy configuration
|
||||
|
||||
+41
-17
@@ -1,9 +1,9 @@
|
||||
<?php
|
||||
|
||||
require('/etc/phpmyadmin/config.secret.inc.php');
|
||||
require '/etc/phpmyadmin/config.secret.inc.php';
|
||||
|
||||
/* Ensure we got the environment */
|
||||
$vars = array(
|
||||
$vars = [
|
||||
'PMA_ARBITRARY',
|
||||
'PMA_HOST',
|
||||
'PMA_HOSTS',
|
||||
@@ -21,8 +21,14 @@ $vars = array(
|
||||
'PMA_PMADB',
|
||||
'PMA_CONTROLUSER',
|
||||
'PMA_CONTROLPASS',
|
||||
'PMA_QUERYHISTORYDB'
|
||||
);
|
||||
'PMA_QUERYHISTORYDB',
|
||||
'PMA_QUERYHISTORYMAX',
|
||||
'MAX_EXECUTION_TIME',
|
||||
'MEMORY_LIMIT',
|
||||
'PMA_UPLOADDIR',
|
||||
'PMA_SAVEDIR',
|
||||
];
|
||||
|
||||
foreach ($vars as $var) {
|
||||
$env = getenv($var);
|
||||
if (!isset($_ENV[$var]) && $env !== false) {
|
||||
@@ -30,7 +36,11 @@ foreach ($vars as $var) {
|
||||
}
|
||||
}
|
||||
if (isset($_ENV['PMA_QUERYHISTORYDB'])) {
|
||||
$cfg['QueryHistoryDB'] = boolval($_ENV['PMA_QUERYHISTORYDB']);
|
||||
$cfg['QueryHistoryDB'] = (bool) $_ENV['PMA_QUERYHISTORYDB'];
|
||||
}
|
||||
|
||||
if (isset($_ENV['PMA_QUERYHISTORYMAX'])) {
|
||||
$cfg['QueryHistoryMax'] = (int) $_ENV['PMA_QUERYHISTORYMAX'];
|
||||
}
|
||||
|
||||
/* Arbitrary server connection */
|
||||
@@ -46,21 +56,22 @@ if (isset($_ENV['PMA_ABSOLUTE_URI'])) {
|
||||
/* Figure out hosts */
|
||||
|
||||
/* Fallback to default linked */
|
||||
$hosts = array('db');
|
||||
$hosts = ['db'];
|
||||
|
||||
/* Set by environment */
|
||||
if (!empty($_ENV['PMA_HOST'])) {
|
||||
$hosts = array($_ENV['PMA_HOST']);
|
||||
$verbose = array($_ENV['PMA_VERBOSE']);
|
||||
$ports = array($_ENV['PMA_PORT']);
|
||||
} elseif (!empty($_ENV['PMA_HOSTS'])) {
|
||||
if (! empty($_ENV['PMA_HOST'])) {
|
||||
$hosts = [$_ENV['PMA_HOST']];
|
||||
$verbose = [$_ENV['PMA_VERBOSE']];
|
||||
$ports = [$_ENV['PMA_PORT']];
|
||||
} elseif (! empty($_ENV['PMA_HOSTS'])) {
|
||||
$hosts = array_map('trim', explode(',', $_ENV['PMA_HOSTS']));
|
||||
$verbose = array_map('trim', explode(',', $_ENV['PMA_VERBOSES']));
|
||||
$ports = array_map('trim', explode(',', $_ENV['PMA_PORTS']));
|
||||
}
|
||||
if (!empty($_ENV['PMA_SOCKET'])) {
|
||||
$sockets = array($_ENV['PMA_SOCKET']);
|
||||
} elseif (!empty($_ENV['PMA_SOCKETS'])) {
|
||||
|
||||
if (! empty($_ENV['PMA_SOCKET'])) {
|
||||
$sockets = [$_ENV['PMA_SOCKET']];
|
||||
} elseif (! empty($_ENV['PMA_SOCKETS'])) {
|
||||
$sockets = explode(',', $_ENV['PMA_SOCKETS']);
|
||||
}
|
||||
|
||||
@@ -128,10 +139,23 @@ for ($i = 1; isset($sockets[$i - 1]); $i++) {
|
||||
$i--;
|
||||
|
||||
/* Uploads setup */
|
||||
$cfg['UploadDir'] = '';
|
||||
$cfg['SaveDir'] = '';
|
||||
if (isset($_ENV['PMA_UPLOADDIR'])) {
|
||||
$cfg['UploadDir'] = $_ENV['PMA_UPLOADDIR'];
|
||||
}
|
||||
|
||||
if (isset($_ENV['PMA_SAVEDIR'])) {
|
||||
$cfg['SaveDir'] = $_ENV['PMA_SAVEDIR'];
|
||||
}
|
||||
|
||||
if (isset($_ENV['MAX_EXECUTION_TIME'])) {
|
||||
$cfg['ExecTimeLimit'] = $_ENV['MAX_EXECUTION_TIME'];
|
||||
}
|
||||
|
||||
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');
|
||||
include '/etc/phpmyadmin/config.user.inc.php';
|
||||
}
|
||||
|
||||
+14
-42
@@ -1,40 +1,5 @@
|
||||
#!/bin/bash
|
||||
if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
|
||||
if [ "$(id -u)" = '0' ]; then
|
||||
case "$1" in
|
||||
apache2*)
|
||||
user="${APACHE_RUN_USER:-www-data}"
|
||||
group="${APACHE_RUN_GROUP:-www-data}"
|
||||
;;
|
||||
*) # php-fpm
|
||||
user='www-data'
|
||||
group='www-data'
|
||||
;;
|
||||
esac
|
||||
else
|
||||
user="$(id -u)"
|
||||
group="$(id -g)"
|
||||
fi
|
||||
|
||||
# Custom folders for sessions
|
||||
chown ${user}:${group} /sessions /var/nginx/client_body_temp
|
||||
|
||||
if ! [ -e index.php -a -e url.php ]; then
|
||||
echo >&2 "phpMyAdmin not found in $PWD - copying now..."
|
||||
if [ "$(ls -A)" ]; then
|
||||
echo >&2 "WARNING: $PWD is not empty - press Ctrl+C now if this is an error!"
|
||||
( set -x; ls -A; sleep 10 )
|
||||
fi
|
||||
tar --create \
|
||||
--file - \
|
||||
--one-file-system \
|
||||
--directory /usr/src/phpmyadmin \
|
||||
--owner "$user" --group "$group" \
|
||||
. | tar --extract --file -
|
||||
echo >&2 "Complete! phpMyAdmin has been successfully copied to $PWD"
|
||||
mkdir -p tmp; \
|
||||
chmod -R 777 tmp; \
|
||||
fi
|
||||
|
||||
if [ ! -f /etc/phpmyadmin/config.secret.inc.php ]; then
|
||||
cat > /etc/phpmyadmin/config.secret.inc.php <<EOT
|
||||
@@ -53,12 +18,6 @@ if [ ! -z "${HIDE_PHP_VERSION}" ]; then
|
||||
echo -e 'expose_php = Off\n' > $PHP_INI_DIR/conf.d/phpmyadmin-hide-php-version.ini
|
||||
fi
|
||||
|
||||
UPLOAD_LIMIT_INI_FILE="$PHP_INI_DIR/conf.d/phpmyadmin-upload-limit.ini"
|
||||
if [ ! -z "${UPLOAD_LIMIT}" ]; then
|
||||
echo "Adding the custom upload limit."
|
||||
echo -e "upload_max_filesize = $UPLOAD_LIMIT\npost_max_size = $UPLOAD_LIMIT\n" > $UPLOAD_LIMIT_INI_FILE
|
||||
fi
|
||||
|
||||
if [ ! -z "${PMA_CONFIG_BASE64}" ]; then
|
||||
echo "Adding the custom config.inc.php from base64."
|
||||
echo "${PMA_CONFIG_BASE64}" | base64 -d > /etc/phpmyadmin/config.inc.php
|
||||
@@ -69,7 +28,16 @@ if [ ! -z "${PMA_USER_CONFIG_BASE64}" ]; then
|
||||
echo "${PMA_USER_CONFIG_BASE64}" | base64 -d > /etc/phpmyadmin/config.user.inc.php
|
||||
fi
|
||||
|
||||
function get_docker_secret() {
|
||||
# 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"
|
||||
|
||||
@@ -81,10 +49,14 @@ function get_docker_secret() {
|
||||
fi
|
||||
}
|
||||
|
||||
get_docker_secret PMA_USER
|
||||
get_docker_secret PMA_PASSWORD
|
||||
get_docker_secret MYSQL_ROOT_PASSWORD
|
||||
get_docker_secret MYSQL_PASSWORD
|
||||
get_docker_secret PMA_HOSTS
|
||||
get_docker_secret PMA_HOST
|
||||
get_docker_secret PMA_CONTROLHOST
|
||||
get_docker_secret PMA_CONTROLUSER
|
||||
get_docker_secret PMA_CONTROLPASS
|
||||
|
||||
exec "$@"
|
||||
|
||||
+41
-17
@@ -1,9 +1,9 @@
|
||||
<?php
|
||||
|
||||
require('/etc/phpmyadmin/config.secret.inc.php');
|
||||
require '/etc/phpmyadmin/config.secret.inc.php';
|
||||
|
||||
/* Ensure we got the environment */
|
||||
$vars = array(
|
||||
$vars = [
|
||||
'PMA_ARBITRARY',
|
||||
'PMA_HOST',
|
||||
'PMA_HOSTS',
|
||||
@@ -21,8 +21,14 @@ $vars = array(
|
||||
'PMA_PMADB',
|
||||
'PMA_CONTROLUSER',
|
||||
'PMA_CONTROLPASS',
|
||||
'PMA_QUERYHISTORYDB'
|
||||
);
|
||||
'PMA_QUERYHISTORYDB',
|
||||
'PMA_QUERYHISTORYMAX',
|
||||
'MAX_EXECUTION_TIME',
|
||||
'MEMORY_LIMIT',
|
||||
'PMA_UPLOADDIR',
|
||||
'PMA_SAVEDIR',
|
||||
];
|
||||
|
||||
foreach ($vars as $var) {
|
||||
$env = getenv($var);
|
||||
if (!isset($_ENV[$var]) && $env !== false) {
|
||||
@@ -30,7 +36,11 @@ foreach ($vars as $var) {
|
||||
}
|
||||
}
|
||||
if (isset($_ENV['PMA_QUERYHISTORYDB'])) {
|
||||
$cfg['QueryHistoryDB'] = boolval($_ENV['PMA_QUERYHISTORYDB']);
|
||||
$cfg['QueryHistoryDB'] = (bool) $_ENV['PMA_QUERYHISTORYDB'];
|
||||
}
|
||||
|
||||
if (isset($_ENV['PMA_QUERYHISTORYMAX'])) {
|
||||
$cfg['QueryHistoryMax'] = (int) $_ENV['PMA_QUERYHISTORYMAX'];
|
||||
}
|
||||
|
||||
/* Arbitrary server connection */
|
||||
@@ -46,21 +56,22 @@ if (isset($_ENV['PMA_ABSOLUTE_URI'])) {
|
||||
/* Figure out hosts */
|
||||
|
||||
/* Fallback to default linked */
|
||||
$hosts = array('db');
|
||||
$hosts = ['db'];
|
||||
|
||||
/* Set by environment */
|
||||
if (!empty($_ENV['PMA_HOST'])) {
|
||||
$hosts = array($_ENV['PMA_HOST']);
|
||||
$verbose = array($_ENV['PMA_VERBOSE']);
|
||||
$ports = array($_ENV['PMA_PORT']);
|
||||
} elseif (!empty($_ENV['PMA_HOSTS'])) {
|
||||
if (! empty($_ENV['PMA_HOST'])) {
|
||||
$hosts = [$_ENV['PMA_HOST']];
|
||||
$verbose = [$_ENV['PMA_VERBOSE']];
|
||||
$ports = [$_ENV['PMA_PORT']];
|
||||
} elseif (! empty($_ENV['PMA_HOSTS'])) {
|
||||
$hosts = array_map('trim', explode(',', $_ENV['PMA_HOSTS']));
|
||||
$verbose = array_map('trim', explode(',', $_ENV['PMA_VERBOSES']));
|
||||
$ports = array_map('trim', explode(',', $_ENV['PMA_PORTS']));
|
||||
}
|
||||
if (!empty($_ENV['PMA_SOCKET'])) {
|
||||
$sockets = array($_ENV['PMA_SOCKET']);
|
||||
} elseif (!empty($_ENV['PMA_SOCKETS'])) {
|
||||
|
||||
if (! empty($_ENV['PMA_SOCKET'])) {
|
||||
$sockets = [$_ENV['PMA_SOCKET']];
|
||||
} elseif (! empty($_ENV['PMA_SOCKETS'])) {
|
||||
$sockets = explode(',', $_ENV['PMA_SOCKETS']);
|
||||
}
|
||||
|
||||
@@ -128,10 +139,23 @@ for ($i = 1; isset($sockets[$i - 1]); $i++) {
|
||||
$i--;
|
||||
|
||||
/* Uploads setup */
|
||||
$cfg['UploadDir'] = '';
|
||||
$cfg['SaveDir'] = '';
|
||||
if (isset($_ENV['PMA_UPLOADDIR'])) {
|
||||
$cfg['UploadDir'] = $_ENV['PMA_UPLOADDIR'];
|
||||
}
|
||||
|
||||
if (isset($_ENV['PMA_SAVEDIR'])) {
|
||||
$cfg['SaveDir'] = $_ENV['PMA_SAVEDIR'];
|
||||
}
|
||||
|
||||
if (isset($_ENV['MAX_EXECUTION_TIME'])) {
|
||||
$cfg['ExecTimeLimit'] = $_ENV['MAX_EXECUTION_TIME'];
|
||||
}
|
||||
|
||||
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');
|
||||
include '/etc/phpmyadmin/config.user.inc.php';
|
||||
}
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
phpmyadmin:
|
||||
external_links:
|
||||
- db_server:db
|
||||
@@ -1,30 +0,0 @@
|
||||
version: '3.1'
|
||||
|
||||
services:
|
||||
db_server:
|
||||
image: ${DB:-mariadb:10.3}
|
||||
container_name: phpmyadmin_testing_db
|
||||
environment:
|
||||
- MYSQL_ROOT_PASSWORD=${TESTSUITE_PASSWORD:-my-secret-pw}
|
||||
volumes:
|
||||
- ./testing/testing.cnf:/etc/mysql/conf.d/testing.cnf:ro
|
||||
tmpfs:
|
||||
- /var/lib/mysql:rw,noexec,nosuid,size=300m
|
||||
|
||||
phpmyadmin:
|
||||
build:
|
||||
context: testing/
|
||||
container_name: phpmyadmin_testing
|
||||
volumes:
|
||||
- /sessions
|
||||
- ./testing/conftest.py:/conftest.py
|
||||
- ./testing/test-docker.sh:/test-docker.sh
|
||||
- ./testing/phpmyadmin_test.py:/phpmyadmin_test.py
|
||||
- ./docker-entrypoint.sh:/docker-entrypoint.sh
|
||||
ports:
|
||||
- 8090:80
|
||||
environment:
|
||||
- PMA_ARBITRARY=1
|
||||
- TESTSUITE_PASSWORD=${TESTSUITE_PASSWORD:-my-secret-pw}
|
||||
depends_on:
|
||||
- db_server
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
phpmyadmin:
|
||||
image: phpmyadmin/phpmyadmin
|
||||
image: phpmyadmin
|
||||
container_name: phpmyadmin
|
||||
environment:
|
||||
- PMA_ARBITRARY=1
|
||||
|
||||
+14
-42
@@ -1,40 +1,5 @@
|
||||
#!/bin/bash
|
||||
if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
|
||||
if [ "$(id -u)" = '0' ]; then
|
||||
case "$1" in
|
||||
apache2*)
|
||||
user="${APACHE_RUN_USER:-www-data}"
|
||||
group="${APACHE_RUN_GROUP:-www-data}"
|
||||
;;
|
||||
*) # php-fpm
|
||||
user='www-data'
|
||||
group='www-data'
|
||||
;;
|
||||
esac
|
||||
else
|
||||
user="$(id -u)"
|
||||
group="$(id -g)"
|
||||
fi
|
||||
|
||||
# Custom folders for sessions
|
||||
chown ${user}:${group} /sessions /var/nginx/client_body_temp
|
||||
|
||||
if ! [ -e index.php -a -e url.php ]; then
|
||||
echo >&2 "phpMyAdmin not found in $PWD - copying now..."
|
||||
if [ "$(ls -A)" ]; then
|
||||
echo >&2 "WARNING: $PWD is not empty - press Ctrl+C now if this is an error!"
|
||||
( set -x; ls -A; sleep 10 )
|
||||
fi
|
||||
tar --create \
|
||||
--file - \
|
||||
--one-file-system \
|
||||
--directory /usr/src/phpmyadmin \
|
||||
--owner "$user" --group "$group" \
|
||||
. | tar --extract --file -
|
||||
echo >&2 "Complete! phpMyAdmin has been successfully copied to $PWD"
|
||||
mkdir -p tmp; \
|
||||
chmod -R 777 tmp; \
|
||||
fi
|
||||
|
||||
if [ ! -f /etc/phpmyadmin/config.secret.inc.php ]; then
|
||||
cat > /etc/phpmyadmin/config.secret.inc.php <<EOT
|
||||
@@ -53,12 +18,6 @@ if [ ! -z "${HIDE_PHP_VERSION}" ]; then
|
||||
echo -e 'expose_php = Off\n' > $PHP_INI_DIR/conf.d/phpmyadmin-hide-php-version.ini
|
||||
fi
|
||||
|
||||
UPLOAD_LIMIT_INI_FILE="$PHP_INI_DIR/conf.d/phpmyadmin-upload-limit.ini"
|
||||
if [ ! -z "${UPLOAD_LIMIT}" ]; then
|
||||
echo "Adding the custom upload limit."
|
||||
echo -e "upload_max_filesize = $UPLOAD_LIMIT\npost_max_size = $UPLOAD_LIMIT\n" > $UPLOAD_LIMIT_INI_FILE
|
||||
fi
|
||||
|
||||
if [ ! -z "${PMA_CONFIG_BASE64}" ]; then
|
||||
echo "Adding the custom config.inc.php from base64."
|
||||
echo "${PMA_CONFIG_BASE64}" | base64 -d > /etc/phpmyadmin/config.inc.php
|
||||
@@ -69,7 +28,16 @@ if [ ! -z "${PMA_USER_CONFIG_BASE64}" ]; then
|
||||
echo "${PMA_USER_CONFIG_BASE64}" | base64 -d > /etc/phpmyadmin/config.user.inc.php
|
||||
fi
|
||||
|
||||
function get_docker_secret() {
|
||||
# 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"
|
||||
|
||||
@@ -81,10 +49,14 @@ function get_docker_secret() {
|
||||
fi
|
||||
}
|
||||
|
||||
get_docker_secret PMA_USER
|
||||
get_docker_secret PMA_PASSWORD
|
||||
get_docker_secret MYSQL_ROOT_PASSWORD
|
||||
get_docker_secret MYSQL_PASSWORD
|
||||
get_docker_secret PMA_HOSTS
|
||||
get_docker_secret PMA_HOST
|
||||
get_docker_secret PMA_CONTROLHOST
|
||||
get_docker_secret PMA_CONTROLUSER
|
||||
get_docker_secret PMA_CONTROLPASS
|
||||
|
||||
exec "$@"
|
||||
|
||||
+45
-25
@@ -1,8 +1,9 @@
|
||||
FROM php:7.4-fpm-alpine
|
||||
FROM php:8.1-fpm-alpine
|
||||
|
||||
# docker-entrypoint.sh dependencies
|
||||
RUN apk add --no-cache \
|
||||
bash
|
||||
bash \
|
||||
tzdata
|
||||
|
||||
# Install dependencies
|
||||
RUN set -ex; \
|
||||
@@ -33,11 +34,16 @@ RUN set -ex; \
|
||||
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
|
||||
)"; \
|
||||
apk add --virtual .phpmyadmin-phpexts-rundeps $runDeps; \
|
||||
apk del .build-deps
|
||||
apk del --no-network .build-deps
|
||||
|
||||
# set recommended PHP.ini settings
|
||||
# see https://secure.php.net/manual/en/opcache.installation.php
|
||||
RUN { \
|
||||
ENV MAX_EXECUTION_TIME 600
|
||||
ENV MEMORY_LIMIT 512M
|
||||
ENV UPLOAD_LIMIT 2048K
|
||||
RUN set -ex; \
|
||||
\
|
||||
{ \
|
||||
echo 'opcache.memory_consumption=128'; \
|
||||
echo 'opcache.interned_strings_buffer=8'; \
|
||||
echo 'opcache.max_accelerated_files=4000'; \
|
||||
@@ -46,20 +52,33 @@ RUN { \
|
||||
} > $PHP_INI_DIR/conf.d/opcache-recommended.ini; \
|
||||
\
|
||||
{ \
|
||||
echo 'session.cookie_httponly = 1'; \
|
||||
echo 'session.use_strict_mode = 1'; \
|
||||
echo 'session.cookie_httponly=1'; \
|
||||
echo 'session.use_strict_mode=1'; \
|
||||
} > $PHP_INI_DIR/conf.d/session-strict.ini; \
|
||||
\
|
||||
{ \
|
||||
echo 'allow_url_fopen = Off'; \
|
||||
echo 'max_execution_time = 600'; \
|
||||
echo 'memory_limit = 512M'; \
|
||||
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}'; \
|
||||
} > $PHP_INI_DIR/conf.d/phpmyadmin-misc.ini
|
||||
|
||||
# Calculate download URL
|
||||
ENV VERSION 5.0.0
|
||||
ENV VERSION 5.2.1
|
||||
ENV SHA256 373f9599dfbd96d6fe75316d5dad189e68c305f297edf42377db9dd6b41b2557
|
||||
ENV URL https://files.phpmyadmin.net/phpMyAdmin/${VERSION}/phpMyAdmin-${VERSION}-all-languages.tar.xz
|
||||
LABEL version=$VERSION
|
||||
|
||||
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; \
|
||||
@@ -69,24 +88,25 @@ RUN set -ex; \
|
||||
\
|
||||
export GNUPGHOME="$(mktemp -d)"; \
|
||||
export GPGKEY="3D06A59ECE730EB71B511C17CE752F178259BD92"; \
|
||||
curl --output phpMyAdmin.tar.xz --location $URL; \
|
||||
curl --output phpMyAdmin.tar.xz.asc --location $URL.asc; \
|
||||
gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPGKEY" \
|
||||
|| gpg --batch --keyserver ipv4.pool.sks-keyservers.net --recv-keys "$GPGKEY" \
|
||||
|| gpg --batch --keyserver keys.gnupg.net --recv-keys "$GPGKEY" \
|
||||
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 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 /usr/src; \
|
||||
tar -xf phpMyAdmin.tar.xz -C /var/www/html --strip-components=1; \
|
||||
mkdir -p /var/www/html/tmp; \
|
||||
chown www-data:www-data /var/www/html/tmp; \
|
||||
gpgconf --kill all; \
|
||||
rm -r "$GNUPGHOME" phpMyAdmin.tar.xz phpMyAdmin.tar.xz.asc; \
|
||||
mv /usr/src/phpMyAdmin-$VERSION-all-languages /usr/src/phpmyadmin; \
|
||||
rm -rf /usr/src/phpmyadmin/setup/ /usr/src/phpmyadmin/examples/ /usr/src/phpmyadmin/test/ /usr/src/phpmyadmin/po/ /usr/src/phpmyadmin/composer.json /usr/src/phpmyadmin/RELEASE-DATE-$VERSION; \
|
||||
sed -i "s@define('CONFIG_DIR'.*@define('CONFIG_DIR', '/etc/phpmyadmin/');@" /usr/src/phpmyadmin/libraries/vendor_config.php; \
|
||||
# Add directory for sessions to allow session persistence
|
||||
mkdir /sessions; \
|
||||
mkdir -p /var/nginx/client_body_temp; \
|
||||
apk del .fetch-deps
|
||||
rm -r -v /var/www/html/setup/ /var/www/html/examples/ /var/www/html/js/src/ /var/www/html/templates/test/ /var/www/html/babel.config.json /var/www/html/doc/html/_sources/ /var/www/html/RELEASE-DATE-$VERSION /var/www/html/CONTRIBUTING.md; \
|
||||
grep -q -F "'configFile' => ROOT_PATH . 'config.inc.php'," /var/www/html/libraries/vendor_config.php; \
|
||||
sed -i "s@'configFile' => .*@'configFile' => '/etc/phpmyadmin/config.inc.php',@" /var/www/html/libraries/vendor_config.php; \
|
||||
grep -q -F "'configFile' => '/etc/phpmyadmin/config.inc.php'," /var/www/html/libraries/vendor_config.php; \
|
||||
php -l /var/www/html/libraries/vendor_config.php; \
|
||||
apk del --no-network .fetch-deps
|
||||
|
||||
# Copy configuration
|
||||
COPY config.inc.php /etc/phpmyadmin/config.inc.php
|
||||
|
||||
+41
-17
@@ -1,9 +1,9 @@
|
||||
<?php
|
||||
|
||||
require('/etc/phpmyadmin/config.secret.inc.php');
|
||||
require '/etc/phpmyadmin/config.secret.inc.php';
|
||||
|
||||
/* Ensure we got the environment */
|
||||
$vars = array(
|
||||
$vars = [
|
||||
'PMA_ARBITRARY',
|
||||
'PMA_HOST',
|
||||
'PMA_HOSTS',
|
||||
@@ -21,8 +21,14 @@ $vars = array(
|
||||
'PMA_PMADB',
|
||||
'PMA_CONTROLUSER',
|
||||
'PMA_CONTROLPASS',
|
||||
'PMA_QUERYHISTORYDB'
|
||||
);
|
||||
'PMA_QUERYHISTORYDB',
|
||||
'PMA_QUERYHISTORYMAX',
|
||||
'MAX_EXECUTION_TIME',
|
||||
'MEMORY_LIMIT',
|
||||
'PMA_UPLOADDIR',
|
||||
'PMA_SAVEDIR',
|
||||
];
|
||||
|
||||
foreach ($vars as $var) {
|
||||
$env = getenv($var);
|
||||
if (!isset($_ENV[$var]) && $env !== false) {
|
||||
@@ -30,7 +36,11 @@ foreach ($vars as $var) {
|
||||
}
|
||||
}
|
||||
if (isset($_ENV['PMA_QUERYHISTORYDB'])) {
|
||||
$cfg['QueryHistoryDB'] = boolval($_ENV['PMA_QUERYHISTORYDB']);
|
||||
$cfg['QueryHistoryDB'] = (bool) $_ENV['PMA_QUERYHISTORYDB'];
|
||||
}
|
||||
|
||||
if (isset($_ENV['PMA_QUERYHISTORYMAX'])) {
|
||||
$cfg['QueryHistoryMax'] = (int) $_ENV['PMA_QUERYHISTORYMAX'];
|
||||
}
|
||||
|
||||
/* Arbitrary server connection */
|
||||
@@ -46,21 +56,22 @@ if (isset($_ENV['PMA_ABSOLUTE_URI'])) {
|
||||
/* Figure out hosts */
|
||||
|
||||
/* Fallback to default linked */
|
||||
$hosts = array('db');
|
||||
$hosts = ['db'];
|
||||
|
||||
/* Set by environment */
|
||||
if (!empty($_ENV['PMA_HOST'])) {
|
||||
$hosts = array($_ENV['PMA_HOST']);
|
||||
$verbose = array($_ENV['PMA_VERBOSE']);
|
||||
$ports = array($_ENV['PMA_PORT']);
|
||||
} elseif (!empty($_ENV['PMA_HOSTS'])) {
|
||||
if (! empty($_ENV['PMA_HOST'])) {
|
||||
$hosts = [$_ENV['PMA_HOST']];
|
||||
$verbose = [$_ENV['PMA_VERBOSE']];
|
||||
$ports = [$_ENV['PMA_PORT']];
|
||||
} elseif (! empty($_ENV['PMA_HOSTS'])) {
|
||||
$hosts = array_map('trim', explode(',', $_ENV['PMA_HOSTS']));
|
||||
$verbose = array_map('trim', explode(',', $_ENV['PMA_VERBOSES']));
|
||||
$ports = array_map('trim', explode(',', $_ENV['PMA_PORTS']));
|
||||
}
|
||||
if (!empty($_ENV['PMA_SOCKET'])) {
|
||||
$sockets = array($_ENV['PMA_SOCKET']);
|
||||
} elseif (!empty($_ENV['PMA_SOCKETS'])) {
|
||||
|
||||
if (! empty($_ENV['PMA_SOCKET'])) {
|
||||
$sockets = [$_ENV['PMA_SOCKET']];
|
||||
} elseif (! empty($_ENV['PMA_SOCKETS'])) {
|
||||
$sockets = explode(',', $_ENV['PMA_SOCKETS']);
|
||||
}
|
||||
|
||||
@@ -128,10 +139,23 @@ for ($i = 1; isset($sockets[$i - 1]); $i++) {
|
||||
$i--;
|
||||
|
||||
/* Uploads setup */
|
||||
$cfg['UploadDir'] = '';
|
||||
$cfg['SaveDir'] = '';
|
||||
if (isset($_ENV['PMA_UPLOADDIR'])) {
|
||||
$cfg['UploadDir'] = $_ENV['PMA_UPLOADDIR'];
|
||||
}
|
||||
|
||||
if (isset($_ENV['PMA_SAVEDIR'])) {
|
||||
$cfg['SaveDir'] = $_ENV['PMA_SAVEDIR'];
|
||||
}
|
||||
|
||||
if (isset($_ENV['MAX_EXECUTION_TIME'])) {
|
||||
$cfg['ExecTimeLimit'] = $_ENV['MAX_EXECUTION_TIME'];
|
||||
}
|
||||
|
||||
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');
|
||||
include '/etc/phpmyadmin/config.user.inc.php';
|
||||
}
|
||||
|
||||
@@ -1,40 +1,5 @@
|
||||
#!/bin/bash
|
||||
if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
|
||||
if [ "$(id -u)" = '0' ]; then
|
||||
case "$1" in
|
||||
apache2*)
|
||||
user="${APACHE_RUN_USER:-www-data}"
|
||||
group="${APACHE_RUN_GROUP:-www-data}"
|
||||
;;
|
||||
*) # php-fpm
|
||||
user='www-data'
|
||||
group='www-data'
|
||||
;;
|
||||
esac
|
||||
else
|
||||
user="$(id -u)"
|
||||
group="$(id -g)"
|
||||
fi
|
||||
|
||||
# Custom folders for sessions
|
||||
chown ${user}:${group} /sessions /var/nginx/client_body_temp
|
||||
|
||||
if ! [ -e index.php -a -e url.php ]; then
|
||||
echo >&2 "phpMyAdmin not found in $PWD - copying now..."
|
||||
if [ "$(ls -A)" ]; then
|
||||
echo >&2 "WARNING: $PWD is not empty - press Ctrl+C now if this is an error!"
|
||||
( set -x; ls -A; sleep 10 )
|
||||
fi
|
||||
tar --create \
|
||||
--file - \
|
||||
--one-file-system \
|
||||
--directory /usr/src/phpmyadmin \
|
||||
--owner "$user" --group "$group" \
|
||||
. | tar --extract --file -
|
||||
echo >&2 "Complete! phpMyAdmin has been successfully copied to $PWD"
|
||||
mkdir -p tmp; \
|
||||
chmod -R 777 tmp; \
|
||||
fi
|
||||
|
||||
if [ ! -f /etc/phpmyadmin/config.secret.inc.php ]; then
|
||||
cat > /etc/phpmyadmin/config.secret.inc.php <<EOT
|
||||
@@ -53,12 +18,6 @@ if [ ! -z "${HIDE_PHP_VERSION}" ]; then
|
||||
echo -e 'expose_php = Off\n' > $PHP_INI_DIR/conf.d/phpmyadmin-hide-php-version.ini
|
||||
fi
|
||||
|
||||
UPLOAD_LIMIT_INI_FILE="$PHP_INI_DIR/conf.d/phpmyadmin-upload-limit.ini"
|
||||
if [ ! -z "${UPLOAD_LIMIT}" ]; then
|
||||
echo "Adding the custom upload limit."
|
||||
echo -e "upload_max_filesize = $UPLOAD_LIMIT\npost_max_size = $UPLOAD_LIMIT\n" > $UPLOAD_LIMIT_INI_FILE
|
||||
fi
|
||||
|
||||
if [ ! -z "${PMA_CONFIG_BASE64}" ]; then
|
||||
echo "Adding the custom config.inc.php from base64."
|
||||
echo "${PMA_CONFIG_BASE64}" | base64 -d > /etc/phpmyadmin/config.inc.php
|
||||
@@ -69,7 +28,8 @@ if [ ! -z "${PMA_USER_CONFIG_BASE64}" ]; then
|
||||
echo "${PMA_USER_CONFIG_BASE64}" | base64 -d > /etc/phpmyadmin/config.user.inc.php
|
||||
fi
|
||||
|
||||
function get_docker_secret() {
|
||||
|
||||
get_docker_secret() {
|
||||
local env_var="${1}"
|
||||
local env_var_file="${env_var}_FILE"
|
||||
|
||||
@@ -81,10 +41,14 @@ function get_docker_secret() {
|
||||
fi
|
||||
}
|
||||
|
||||
get_docker_secret PMA_USER
|
||||
get_docker_secret PMA_PASSWORD
|
||||
get_docker_secret MYSQL_ROOT_PASSWORD
|
||||
get_docker_secret MYSQL_PASSWORD
|
||||
get_docker_secret PMA_HOSTS
|
||||
get_docker_secret PMA_HOST
|
||||
get_docker_secret PMA_CONTROLHOST
|
||||
get_docker_secret PMA_CONTROLUSER
|
||||
get_docker_secret PMA_CONTROLPASS
|
||||
|
||||
exec "$@"
|
||||
|
||||
+50
-27
@@ -1,4 +1,4 @@
|
||||
FROM php:7.4-fpm
|
||||
FROM php:8.1-fpm
|
||||
|
||||
# Install dependencies
|
||||
RUN set -ex; \
|
||||
@@ -40,7 +40,12 @@ RUN set -ex; \
|
||||
|
||||
# set recommended PHP.ini settings
|
||||
# see https://secure.php.net/manual/en/opcache.installation.php
|
||||
RUN { \
|
||||
ENV MAX_EXECUTION_TIME 600
|
||||
ENV MEMORY_LIMIT 512M
|
||||
ENV UPLOAD_LIMIT 2048K
|
||||
RUN set -ex; \
|
||||
\
|
||||
{ \
|
||||
echo 'opcache.memory_consumption=128'; \
|
||||
echo 'opcache.interned_strings_buffer=8'; \
|
||||
echo 'opcache.max_accelerated_files=4000'; \
|
||||
@@ -49,51 +54,69 @@ RUN { \
|
||||
} > $PHP_INI_DIR/conf.d/opcache-recommended.ini; \
|
||||
\
|
||||
{ \
|
||||
echo 'session.cookie_httponly = 1'; \
|
||||
echo 'session.use_strict_mode = 1'; \
|
||||
echo 'session.cookie_httponly=1'; \
|
||||
echo 'session.use_strict_mode=1'; \
|
||||
} > $PHP_INI_DIR/conf.d/session-strict.ini; \
|
||||
\
|
||||
{ \
|
||||
echo 'allow_url_fopen = Off'; \
|
||||
echo 'max_execution_time = 600'; \
|
||||
echo 'memory_limit = 512M'; \
|
||||
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}'; \
|
||||
} > $PHP_INI_DIR/conf.d/phpmyadmin-misc.ini
|
||||
|
||||
# Calculate download URL
|
||||
ENV VERSION 5.0.0
|
||||
ENV VERSION 5.2.1
|
||||
ENV SHA256 373f9599dfbd96d6fe75316d5dad189e68c305f297edf42377db9dd6b41b2557
|
||||
ENV URL https://files.phpmyadmin.net/phpMyAdmin/${VERSION}/phpMyAdmin-${VERSION}-all-languages.tar.xz
|
||||
LABEL version=$VERSION
|
||||
|
||||
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; \
|
||||
fetchDeps=" \
|
||||
\
|
||||
savedAptMark="$(apt-mark showmanual)"; \
|
||||
\
|
||||
apt-get update; \
|
||||
apt-get install -y --no-install-recommends \
|
||||
gnupg \
|
||||
dirmngr \
|
||||
"; \
|
||||
apt-get update; \
|
||||
apt-get install -y --no-install-recommends $fetchDeps; \
|
||||
; \
|
||||
\
|
||||
export GNUPGHOME="$(mktemp -d)"; \
|
||||
export GPGKEY="3D06A59ECE730EB71B511C17CE752F178259BD92"; \
|
||||
curl --output phpMyAdmin.tar.xz --location $URL; \
|
||||
curl --output phpMyAdmin.tar.xz.asc --location $URL.asc; \
|
||||
gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPGKEY" \
|
||||
|| gpg --batch --keyserver ipv4.pool.sks-keyservers.net --recv-keys "$GPGKEY" \
|
||||
|| gpg --batch --keyserver keys.gnupg.net --recv-keys "$GPGKEY" \
|
||||
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 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 /usr/src; \
|
||||
tar -xf phpMyAdmin.tar.xz -C /var/www/html --strip-components=1; \
|
||||
mkdir -p /var/www/html/tmp; \
|
||||
chown www-data:www-data /var/www/html/tmp; \
|
||||
gpgconf --kill all; \
|
||||
rm -r "$GNUPGHOME" phpMyAdmin.tar.xz phpMyAdmin.tar.xz.asc; \
|
||||
mv /usr/src/phpMyAdmin-$VERSION-all-languages /usr/src/phpmyadmin; \
|
||||
rm -rf /usr/src/phpmyadmin/setup/ /usr/src/phpmyadmin/examples/ /usr/src/phpmyadmin/test/ /usr/src/phpmyadmin/po/ /usr/src/phpmyadmin/composer.json /usr/src/phpmyadmin/RELEASE-DATE-$VERSION; \
|
||||
sed -i "s@define('CONFIG_DIR'.*@define('CONFIG_DIR', '/etc/phpmyadmin/');@" /usr/src/phpmyadmin/libraries/vendor_config.php; \
|
||||
# Add directory for sessions to allow session persistence
|
||||
mkdir /sessions; \
|
||||
mkdir -p /var/nginx/client_body_temp; \
|
||||
rm -r -v /var/www/html/setup/ /var/www/html/examples/ /var/www/html/js/src/ /var/www/html/templates/test/ /var/www/html/babel.config.json /var/www/html/doc/html/_sources/ /var/www/html/RELEASE-DATE-$VERSION /var/www/html/CONTRIBUTING.md; \
|
||||
grep -q -F "'configFile' => ROOT_PATH . 'config.inc.php'," /var/www/html/libraries/vendor_config.php; \
|
||||
sed -i "s@'configFile' => .*@'configFile' => '/etc/phpmyadmin/config.inc.php',@" /var/www/html/libraries/vendor_config.php; \
|
||||
grep -q -F "'configFile' => '/etc/phpmyadmin/config.inc.php'," /var/www/html/libraries/vendor_config.php; \
|
||||
php -l /var/www/html/libraries/vendor_config.php; \
|
||||
\
|
||||
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $fetchDeps; \
|
||||
apt-mark auto '.*' > /dev/null; \
|
||||
apt-mark manual $savedAptMark; \
|
||||
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Copy configuration
|
||||
|
||||
+41
-17
@@ -1,9 +1,9 @@
|
||||
<?php
|
||||
|
||||
require('/etc/phpmyadmin/config.secret.inc.php');
|
||||
require '/etc/phpmyadmin/config.secret.inc.php';
|
||||
|
||||
/* Ensure we got the environment */
|
||||
$vars = array(
|
||||
$vars = [
|
||||
'PMA_ARBITRARY',
|
||||
'PMA_HOST',
|
||||
'PMA_HOSTS',
|
||||
@@ -21,8 +21,14 @@ $vars = array(
|
||||
'PMA_PMADB',
|
||||
'PMA_CONTROLUSER',
|
||||
'PMA_CONTROLPASS',
|
||||
'PMA_QUERYHISTORYDB'
|
||||
);
|
||||
'PMA_QUERYHISTORYDB',
|
||||
'PMA_QUERYHISTORYMAX',
|
||||
'MAX_EXECUTION_TIME',
|
||||
'MEMORY_LIMIT',
|
||||
'PMA_UPLOADDIR',
|
||||
'PMA_SAVEDIR',
|
||||
];
|
||||
|
||||
foreach ($vars as $var) {
|
||||
$env = getenv($var);
|
||||
if (!isset($_ENV[$var]) && $env !== false) {
|
||||
@@ -30,7 +36,11 @@ foreach ($vars as $var) {
|
||||
}
|
||||
}
|
||||
if (isset($_ENV['PMA_QUERYHISTORYDB'])) {
|
||||
$cfg['QueryHistoryDB'] = boolval($_ENV['PMA_QUERYHISTORYDB']);
|
||||
$cfg['QueryHistoryDB'] = (bool) $_ENV['PMA_QUERYHISTORYDB'];
|
||||
}
|
||||
|
||||
if (isset($_ENV['PMA_QUERYHISTORYMAX'])) {
|
||||
$cfg['QueryHistoryMax'] = (int) $_ENV['PMA_QUERYHISTORYMAX'];
|
||||
}
|
||||
|
||||
/* Arbitrary server connection */
|
||||
@@ -46,21 +56,22 @@ if (isset($_ENV['PMA_ABSOLUTE_URI'])) {
|
||||
/* Figure out hosts */
|
||||
|
||||
/* Fallback to default linked */
|
||||
$hosts = array('db');
|
||||
$hosts = ['db'];
|
||||
|
||||
/* Set by environment */
|
||||
if (!empty($_ENV['PMA_HOST'])) {
|
||||
$hosts = array($_ENV['PMA_HOST']);
|
||||
$verbose = array($_ENV['PMA_VERBOSE']);
|
||||
$ports = array($_ENV['PMA_PORT']);
|
||||
} elseif (!empty($_ENV['PMA_HOSTS'])) {
|
||||
if (! empty($_ENV['PMA_HOST'])) {
|
||||
$hosts = [$_ENV['PMA_HOST']];
|
||||
$verbose = [$_ENV['PMA_VERBOSE']];
|
||||
$ports = [$_ENV['PMA_PORT']];
|
||||
} elseif (! empty($_ENV['PMA_HOSTS'])) {
|
||||
$hosts = array_map('trim', explode(',', $_ENV['PMA_HOSTS']));
|
||||
$verbose = array_map('trim', explode(',', $_ENV['PMA_VERBOSES']));
|
||||
$ports = array_map('trim', explode(',', $_ENV['PMA_PORTS']));
|
||||
}
|
||||
if (!empty($_ENV['PMA_SOCKET'])) {
|
||||
$sockets = array($_ENV['PMA_SOCKET']);
|
||||
} elseif (!empty($_ENV['PMA_SOCKETS'])) {
|
||||
|
||||
if (! empty($_ENV['PMA_SOCKET'])) {
|
||||
$sockets = [$_ENV['PMA_SOCKET']];
|
||||
} elseif (! empty($_ENV['PMA_SOCKETS'])) {
|
||||
$sockets = explode(',', $_ENV['PMA_SOCKETS']);
|
||||
}
|
||||
|
||||
@@ -128,10 +139,23 @@ for ($i = 1; isset($sockets[$i - 1]); $i++) {
|
||||
$i--;
|
||||
|
||||
/* Uploads setup */
|
||||
$cfg['UploadDir'] = '';
|
||||
$cfg['SaveDir'] = '';
|
||||
if (isset($_ENV['PMA_UPLOADDIR'])) {
|
||||
$cfg['UploadDir'] = $_ENV['PMA_UPLOADDIR'];
|
||||
}
|
||||
|
||||
if (isset($_ENV['PMA_SAVEDIR'])) {
|
||||
$cfg['SaveDir'] = $_ENV['PMA_SAVEDIR'];
|
||||
}
|
||||
|
||||
if (isset($_ENV['MAX_EXECUTION_TIME'])) {
|
||||
$cfg['ExecTimeLimit'] = $_ENV['MAX_EXECUTION_TIME'];
|
||||
}
|
||||
|
||||
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');
|
||||
include '/etc/phpmyadmin/config.user.inc.php';
|
||||
}
|
||||
|
||||
@@ -1,40 +1,5 @@
|
||||
#!/bin/bash
|
||||
if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
|
||||
if [ "$(id -u)" = '0' ]; then
|
||||
case "$1" in
|
||||
apache2*)
|
||||
user="${APACHE_RUN_USER:-www-data}"
|
||||
group="${APACHE_RUN_GROUP:-www-data}"
|
||||
;;
|
||||
*) # php-fpm
|
||||
user='www-data'
|
||||
group='www-data'
|
||||
;;
|
||||
esac
|
||||
else
|
||||
user="$(id -u)"
|
||||
group="$(id -g)"
|
||||
fi
|
||||
|
||||
# Custom folders for sessions
|
||||
chown ${user}:${group} /sessions /var/nginx/client_body_temp
|
||||
|
||||
if ! [ -e index.php -a -e url.php ]; then
|
||||
echo >&2 "phpMyAdmin not found in $PWD - copying now..."
|
||||
if [ "$(ls -A)" ]; then
|
||||
echo >&2 "WARNING: $PWD is not empty - press Ctrl+C now if this is an error!"
|
||||
( set -x; ls -A; sleep 10 )
|
||||
fi
|
||||
tar --create \
|
||||
--file - \
|
||||
--one-file-system \
|
||||
--directory /usr/src/phpmyadmin \
|
||||
--owner "$user" --group "$group" \
|
||||
. | tar --extract --file -
|
||||
echo >&2 "Complete! phpMyAdmin has been successfully copied to $PWD"
|
||||
mkdir -p tmp; \
|
||||
chmod -R 777 tmp; \
|
||||
fi
|
||||
|
||||
if [ ! -f /etc/phpmyadmin/config.secret.inc.php ]; then
|
||||
cat > /etc/phpmyadmin/config.secret.inc.php <<EOT
|
||||
@@ -53,12 +18,6 @@ if [ ! -z "${HIDE_PHP_VERSION}" ]; then
|
||||
echo -e 'expose_php = Off\n' > $PHP_INI_DIR/conf.d/phpmyadmin-hide-php-version.ini
|
||||
fi
|
||||
|
||||
UPLOAD_LIMIT_INI_FILE="$PHP_INI_DIR/conf.d/phpmyadmin-upload-limit.ini"
|
||||
if [ ! -z "${UPLOAD_LIMIT}" ]; then
|
||||
echo "Adding the custom upload limit."
|
||||
echo -e "upload_max_filesize = $UPLOAD_LIMIT\npost_max_size = $UPLOAD_LIMIT\n" > $UPLOAD_LIMIT_INI_FILE
|
||||
fi
|
||||
|
||||
if [ ! -z "${PMA_CONFIG_BASE64}" ]; then
|
||||
echo "Adding the custom config.inc.php from base64."
|
||||
echo "${PMA_CONFIG_BASE64}" | base64 -d > /etc/phpmyadmin/config.inc.php
|
||||
@@ -69,7 +28,8 @@ if [ ! -z "${PMA_USER_CONFIG_BASE64}" ]; then
|
||||
echo "${PMA_USER_CONFIG_BASE64}" | base64 -d > /etc/phpmyadmin/config.user.inc.php
|
||||
fi
|
||||
|
||||
function get_docker_secret() {
|
||||
|
||||
get_docker_secret() {
|
||||
local env_var="${1}"
|
||||
local env_var_file="${env_var}_FILE"
|
||||
|
||||
@@ -81,10 +41,14 @@ function get_docker_secret() {
|
||||
fi
|
||||
}
|
||||
|
||||
get_docker_secret PMA_USER
|
||||
get_docker_secret PMA_PASSWORD
|
||||
get_docker_secret MYSQL_ROOT_PASSWORD
|
||||
get_docker_secret MYSQL_PASSWORD
|
||||
get_docker_secret PMA_HOSTS
|
||||
get_docker_secret PMA_HOST
|
||||
get_docker_secret PMA_CONTROLHOST
|
||||
get_docker_secret PMA_CONTROLUSER
|
||||
get_docker_secret PMA_CONTROLPASS
|
||||
|
||||
exec "$@"
|
||||
|
||||
@@ -25,28 +25,35 @@ dockerfileCommit() {
|
||||
)
|
||||
}
|
||||
|
||||
# depends on docker library
|
||||
#getArches() {
|
||||
# local repo="$1"; shift
|
||||
# local officialImagesUrl='https://github.com/docker-library/official-images/raw/master/library/'
|
||||
#
|
||||
# eval "declare -g -A parentRepoToArches=( $(
|
||||
# find -name 'Dockerfile' -exec awk '
|
||||
# toupper($1) == "FROM" && $2 !~ /^('"$repo"'|scratch|microsoft\/[^:]+)(:|$)/ {
|
||||
# print "'"$officialImagesUrl"'" $2
|
||||
# }
|
||||
# ' '{}' + \
|
||||
# | sort -u \
|
||||
# | xargs bashbrew cat --format '[{{ .RepoName }}:{{ .TagName }}]="{{ join " " .TagEntry.Architectures }}"'
|
||||
# ) )"
|
||||
#}
|
||||
#getArches 'phpmyadmin'
|
||||
getArches() {
|
||||
local repo="$1"; shift
|
||||
local officialImagesUrl='https://github.com/docker-library/official-images/raw/master/library/'
|
||||
|
||||
eval "declare -g -A parentRepoToArches=( $(
|
||||
find -name 'Dockerfile' -exec awk '
|
||||
toupper($1) == "FROM" && $2 !~ /^('"$repo"'|scratch|microsoft\/[^:]+)(:|$)/ {
|
||||
print "'"$officialImagesUrl"'" $2
|
||||
}
|
||||
' '{}' + \
|
||||
| sort -u \
|
||||
| xargs bashbrew cat --format '[{{ .RepoName }}:{{ .TagName }}]="{{ join " " .TagEntry.Architectures }}"'
|
||||
) )"
|
||||
}
|
||||
|
||||
if ! command -v bashbrew --version &> /dev/null
|
||||
then
|
||||
echo "bashbrew could not be found"
|
||||
echo "You can download it from Jenkins at https://github.com/docker-library/bashbrew#installing"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
getArches 'phpmyadmin'
|
||||
|
||||
# Header.
|
||||
cat <<-EOH
|
||||
# This file is generated via https://github.com/phpmyadmin/docker/blob/$(fileCommit "$self")/$self
|
||||
Maintainers: Isaac Bennetch <bennetch@gmail.com>
|
||||
Michal Čihař <michal@cihar.com>
|
||||
Maintainers: Isaac Bennetch <bennetch@gmail.com> (@ibennetch),
|
||||
William Desportes <williamdes@wdes.fr> (@williamdes)
|
||||
GitRepo: https://github.com/phpmyadmin/docker.git
|
||||
EOH
|
||||
|
||||
@@ -57,13 +64,7 @@ join() {
|
||||
echo "${out#$sep}"
|
||||
}
|
||||
|
||||
latest="$(
|
||||
git ls-remote --tags https://github.com/phpmyadmin/phpmyadmin.git \
|
||||
| cut -d/ -f3 \
|
||||
| grep -vE -- '-rc|-b' \
|
||||
| sort -V \
|
||||
| tail -1
|
||||
)"
|
||||
latest="$(curl -fsSL 'https://www.phpmyadmin.net/home_page/version.json' | jq -r '.version')"
|
||||
|
||||
for variant in apache fpm fpm-alpine; do
|
||||
commit="$(dockerfileCommit "$variant")"
|
||||
@@ -83,9 +84,7 @@ for variant in apache fpm fpm-alpine; do
|
||||
|
||||
variantParent="$(awk 'toupper($1) == "FROM" { print $2 }' "$variant/Dockerfile")"
|
||||
|
||||
# depends on docker library
|
||||
#variantArches="${parentRepoToArches[$variantParent]}"
|
||||
variantArches="amd64 arm32v7 arm64v8 i386 ppc64le"
|
||||
variantArches="${parentRepoToArches[$variantParent]}"
|
||||
|
||||
cat <<-EOE
|
||||
|
||||
|
||||
Executable
+4
@@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
# This file is used by docker hub to build the image
|
||||
|
||||
docker build -t $IMAGE_NAME .
|
||||
+3
-11
@@ -1,17 +1,9 @@
|
||||
# Testing image for phpMyAdmin
|
||||
|
||||
FROM phpmyadmin/phpmyadmin
|
||||
FROM alpine:3.15
|
||||
|
||||
# Install test dependencies
|
||||
RUN set -ex; \
|
||||
\
|
||||
apt-get update; \
|
||||
apt-get install -y --no-install-recommends \
|
||||
curl \
|
||||
python-pip \
|
||||
; \
|
||||
pip install setuptools wheel; \
|
||||
pip install mechanize html5lib pytest; \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY phpmyadmin_test.py test-docker.sh world.sql conftest.py /
|
||||
apk add --no-cache --update mariadb-client mariadb-connector-c bash \
|
||||
py3-html5lib py3-pytest py3-mechanize curl
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
|
||||
$cfg['ShowPhpInfo'] = true;
|
||||
+1
-1
@@ -22,7 +22,7 @@ def password(request):
|
||||
@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.3}
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: "${TESTSUITE_PASSWORD:-my-secret-pw}"
|
||||
healthcheck:
|
||||
test: ["CMD", "mysqladmin", "ping", "-uroot", "-p${TESTSUITE_PASSWORD:-my-secret-pw}"]
|
||||
start_period: 10s
|
||||
interval: 5s
|
||||
timeout: 60s
|
||||
retries: 10
|
||||
networks:
|
||||
testing:
|
||||
aliases:
|
||||
- phpmyadmin_testing_db
|
||||
tmpfs:
|
||||
- /var/lib/mysql:rw,noexec,nosuid,size=300m
|
||||
|
||||
phpmyadmin:
|
||||
build:
|
||||
context: ../../apache
|
||||
environment:
|
||||
PMA_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.3}
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: "${TESTSUITE_PASSWORD:-my-secret-pw}"
|
||||
healthcheck:
|
||||
test: ["CMD", "mysqladmin", "ping", "-uroot", "-p${TESTSUITE_PASSWORD:-my-secret-pw}"]
|
||||
start_period: 10s
|
||||
interval: 5s
|
||||
timeout: 60s
|
||||
retries: 10
|
||||
networks:
|
||||
testing:
|
||||
aliases:
|
||||
- phpmyadmin_testing_db
|
||||
tmpfs:
|
||||
- /var/lib/mysql:rw,noexec,nosuid,size=300m
|
||||
|
||||
phpmyadmin:
|
||||
build:
|
||||
context: ../../apache
|
||||
environment:
|
||||
PMA_HOST: db_server
|
||||
UPLOAD_LIMIT: 123M
|
||||
MAX_EXECUTION_TIME: 125
|
||||
HIDE_PHP_VERSION: 1
|
||||
APACHE_PORT: 8090
|
||||
volumes:
|
||||
- ../config.user.inc.php:/etc/phpmyadmin/config.user.inc.php:ro
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-Ss", "http://localhost:8090/robots.txt"]
|
||||
start_period: 5s
|
||||
interval: 3s
|
||||
timeout: 60s
|
||||
retries: 10
|
||||
networks:
|
||||
testing:
|
||||
aliases:
|
||||
- phpmyadmin_testing_apache
|
||||
depends_on:
|
||||
db_server:
|
||||
condition: service_healthy
|
||||
|
||||
sut:
|
||||
depends_on:
|
||||
phpmyadmin:
|
||||
condition: service_healthy
|
||||
db_server:
|
||||
condition: service_healthy
|
||||
build:
|
||||
context: ../
|
||||
command: "/tests/testing/test-docker.sh"
|
||||
networks:
|
||||
testing:
|
||||
environment:
|
||||
TESTSUITE_HOSTNAME: phpmyadmin_testing_apache
|
||||
TESTSUITE_PORT: 8090
|
||||
TESTSUITE_PASSWORD: "${TESTSUITE_PASSWORD:-my-secret-pw}"
|
||||
PMA_HOST: phpmyadmin_testing_db
|
||||
PMA_PORT: 3306
|
||||
volumes:
|
||||
- ../../:/tests:ro
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
working_dir: /tests
|
||||
|
||||
networks:
|
||||
testing:
|
||||
driver: bridge
|
||||
@@ -0,0 +1,80 @@
|
||||
version: "3.1"
|
||||
|
||||
services:
|
||||
db_server:
|
||||
image: ${DB:-mariadb:10.3}
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: "${TESTSUITE_PASSWORD:-my-secret-pw}"
|
||||
healthcheck:
|
||||
test: ["CMD", "mysqladmin", "ping", "-uroot", "-p${TESTSUITE_PASSWORD:-my-secret-pw}"]
|
||||
start_period: 10s
|
||||
interval: 5s
|
||||
timeout: 60s
|
||||
retries: 10
|
||||
networks:
|
||||
testing:
|
||||
aliases:
|
||||
- phpmyadmin_testing_db
|
||||
tmpfs:
|
||||
- /var/lib/mysql:rw,noexec,nosuid,size=300m
|
||||
|
||||
phpmyadmin:
|
||||
build:
|
||||
context: ../../apache
|
||||
environment:
|
||||
PMA_HOST: db_server
|
||||
UPLOAD_LIMIT: 123M
|
||||
MAX_EXECUTION_TIME: 125
|
||||
HIDE_PHP_VERSION: 1
|
||||
PMA_UPLOADDIR: /etc/phpmyadmin/imports
|
||||
PMA_SAVEDIR: /etc/phpmyadmin/exports
|
||||
volumes:
|
||||
- ../config.user.inc.php:/etc/phpmyadmin/config.user.inc.php:ro
|
||||
- phpmyadmin-data:/etc/phpmyadmin/imports:ro
|
||||
- phpmyadmin-data:/etc/phpmyadmin/exports
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-Ss", "http://localhost/robots.txt"]
|
||||
start_period: 5s
|
||||
interval: 3s
|
||||
timeout: 60s
|
||||
retries: 10
|
||||
networks:
|
||||
testing:
|
||||
aliases:
|
||||
- phpmyadmin_testing_apache
|
||||
depends_on:
|
||||
db_server:
|
||||
condition: service_healthy
|
||||
|
||||
sut:
|
||||
depends_on:
|
||||
phpmyadmin:
|
||||
condition: service_healthy
|
||||
db_server:
|
||||
condition: service_healthy
|
||||
build:
|
||||
context: ../
|
||||
command: "/tests/testing/test-docker.sh"
|
||||
networks:
|
||||
testing:
|
||||
environment:
|
||||
TESTSUITE_HOSTNAME: phpmyadmin_testing_apache
|
||||
TESTSUITE_PORT: 80
|
||||
TESTSUITE_PASSWORD: "${TESTSUITE_PASSWORD:-my-secret-pw}"
|
||||
PMA_HOST: phpmyadmin_testing_db
|
||||
PMA_PORT: 3306
|
||||
PMA_UPLOADDIR: /etc/phpmyadmin/imports
|
||||
PMA_SAVEDIR: /etc/phpmyadmin/exports
|
||||
volumes:
|
||||
- ../../:/tests:ro
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
- phpmyadmin-data:/etc/phpmyadmin/imports
|
||||
- phpmyadmin-data:/etc/phpmyadmin/exports
|
||||
working_dir: /tests
|
||||
|
||||
networks:
|
||||
testing:
|
||||
driver: bridge
|
||||
|
||||
volumes:
|
||||
phpmyadmin-data:
|
||||
@@ -0,0 +1,69 @@
|
||||
version: "3.1"
|
||||
|
||||
services:
|
||||
db_server:
|
||||
image: ${DB:-mariadb:10.3}
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: "${TESTSUITE_PASSWORD:-my-secret-pw}"
|
||||
healthcheck:
|
||||
test: ["CMD", "mysqladmin", "ping", "-uroot", "-p${TESTSUITE_PASSWORD:-my-secret-pw}"]
|
||||
start_period: 10s
|
||||
interval: 5s
|
||||
timeout: 60s
|
||||
retries: 10
|
||||
networks:
|
||||
testing:
|
||||
aliases:
|
||||
- phpmyadmin_testing_db
|
||||
tmpfs:
|
||||
- /var/lib/mysql:rw,noexec,nosuid,size=300m
|
||||
|
||||
phpmyadmin:
|
||||
build:
|
||||
context: ../../apache
|
||||
environment:
|
||||
PMA_HOST: db_server
|
||||
UPLOAD_LIMIT: 123M
|
||||
MAX_EXECUTION_TIME: 125
|
||||
HIDE_PHP_VERSION: 1
|
||||
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
|
||||
+115
-19
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python2
|
||||
#!/usr/bin/env python3
|
||||
import argparse
|
||||
import os
|
||||
import subprocess
|
||||
@@ -9,24 +9,14 @@ import mechanize
|
||||
import tempfile
|
||||
import pytest
|
||||
|
||||
|
||||
def do_test_content(match, content):
|
||||
assert(match in content)
|
||||
|
||||
def test_phpmyadmin(url, username, password, server, sqlfile):
|
||||
if sqlfile is None:
|
||||
if os.path.exists('/world.sql'):
|
||||
sqlfile = '/world.sql'
|
||||
elif os.path.exists('./world.sql'):
|
||||
sqlfile = './world.sql'
|
||||
else:
|
||||
path = os.path.dirname(os.path.realpath(__file__))
|
||||
sqlfile = path + '/world.sql'
|
||||
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)
|
||||
|
||||
@@ -37,19 +27,38 @@ def test_phpmyadmin(url, username, password, server, sqlfile):
|
||||
if server is not None:
|
||||
br['pma_servername'] = server
|
||||
|
||||
# Login and check if loggged in
|
||||
# Login and check if logged in
|
||||
response = br.submit()
|
||||
do_test_content('Server version', response.read())
|
||||
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'))
|
||||
do_test_content('OpenDocument Spreadsheet', response.read())
|
||||
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()
|
||||
do_test_content('5326 queries executed', response.read())
|
||||
assert(b'5326 queries executed' in response.read())
|
||||
|
||||
|
||||
def docker_secret(env_name):
|
||||
@@ -64,7 +73,7 @@ def docker_secret(env_name):
|
||||
test_env = {env_name + '_FILE': secret_file[1]}
|
||||
|
||||
# Run entrypoint and afterwards echo the environment variables
|
||||
result = subprocess.Popen(dir_path+ "/../docker-entrypoint.sh 'env'", shell=True, stdout=subprocess.PIPE, env=test_env)
|
||||
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
|
||||
@@ -72,6 +81,93 @@ def docker_secret(env_name):
|
||||
def test_phpmyadmin_secrets():
|
||||
docker_secret('MYSQL_PASSWORD')
|
||||
docker_secret('MYSQL_ROOT_PASSWORD')
|
||||
docker_secret('PMA_USER')
|
||||
docker_secret('PMA_PASSWORD')
|
||||
docker_secret('PMA_HOSTS')
|
||||
docker_secret('PMA_HOST')
|
||||
docker_secret('PMA_CONTROLHOST')
|
||||
docker_secret('PMA_CONTROLUSER')
|
||||
docker_secret('PMA_CONTROLPASS')
|
||||
|
||||
|
||||
def test_php_ini(url, username, password, server):
|
||||
br = create_browser()
|
||||
response = do_login(br, url, username, password, server)
|
||||
|
||||
assert(b'Show PHP information' in response.read())
|
||||
|
||||
# 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'<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)
|
||||
|
||||
assert(b'<tr><td class="e">expose_php</td><td class="v">Off</td><td class="v">Off</td></tr>' in response)
|
||||
|
||||
|
||||
def test_import_from_folder(url, username, password, server, sqlfile):
|
||||
upload_dir = os.environ.get('PMA_UPLOADDIR');
|
||||
if not upload_dir:
|
||||
pytest.skip("Missing PMA_UPLOADDIR ENV", allow_module_level=True)
|
||||
|
||||
# Copy file into the volume
|
||||
with open(get_world_sql_path(), 'rb') as src, open(upload_dir + '/world-data.sql', 'wb') as dst:
|
||||
dst.write(src.read())
|
||||
|
||||
br = create_browser()
|
||||
|
||||
response = do_login(br, url, username, password, server)
|
||||
|
||||
assert(b'Server version' in response.read())
|
||||
|
||||
# Open server import
|
||||
response = br.follow_link(text_regex=re.compile('Import'))
|
||||
response = response.read()
|
||||
|
||||
assert(b'Browse your computer:' in response)
|
||||
assert(upload_dir.encode() in response)
|
||||
assert(b'world-data.sql' in response)
|
||||
|
||||
def test_export_to_folder(url, username, password, server, sqlfile):
|
||||
save_dir = os.environ.get('PMA_SAVEDIR');
|
||||
if not save_dir:
|
||||
pytest.skip("Missing PMA_SAVEDIR ENV", allow_module_level=True)
|
||||
|
||||
# Delete file from previous runs
|
||||
if os.path.exists(save_dir + "/db_server.sql"):
|
||||
os.remove(save_dir + "/db_server.sql")
|
||||
|
||||
assert os.path.exists(save_dir + "/db_server.sql") == False
|
||||
|
||||
# Avoid: "The web server does not have permission to save the file"
|
||||
os.chmod(save_dir , 0o777)
|
||||
|
||||
br = create_browser()
|
||||
|
||||
response = do_login(br, url, username, password, server)
|
||||
|
||||
assert(b'Server version' in response.read())
|
||||
|
||||
# Open server export
|
||||
response = br.follow_link(text_regex=re.compile('Export'))
|
||||
response = response.read()
|
||||
assert(b'Save on server in the directory' in response)
|
||||
assert(save_dir.encode() in response)
|
||||
|
||||
br.select_form('dump')
|
||||
br.find_control("quick_export_onserver").items[0].selected=True
|
||||
|
||||
response = br.submit()
|
||||
response = response.read()
|
||||
|
||||
assert(b'Dump has been saved to file' in response)
|
||||
assert(b'Dump has been saved to file /etc/phpmyadmin/exports/db_server.sql' in response)
|
||||
assert os.path.exists(save_dir + "/db_server.sql") == True
|
||||
|
||||
+20
-58
@@ -1,33 +1,17 @@
|
||||
#!/bin/sh
|
||||
|
||||
NAME="$1"
|
||||
|
||||
if [ -n "$2" ] ; then
|
||||
PORT="$2"
|
||||
TESTSUITE_PORT=$2
|
||||
fi
|
||||
|
||||
if [ -n "$3" ] ; then
|
||||
SERVER="--server $3"
|
||||
PMA_HOST=$3
|
||||
else
|
||||
SERVER=''
|
||||
fi
|
||||
|
||||
# Set PHPMyAdmin environment
|
||||
# Set phpMyAdmin environment
|
||||
PHPMYADMIN_HOSTNAME=${TESTSUITE_HOSTNAME:=localhost}
|
||||
PHPMYADMIN_PORT=${TESTSUITE_PORT:=80}
|
||||
PHPMYADMIN_URL=http://$PHPMYADMIN_HOSTNAME:$PORT/
|
||||
PHPMYADMIN_URL=http://${PHPMYADMIN_HOSTNAME}:${PHPMYADMIN_PORT}/
|
||||
|
||||
# Set database environment
|
||||
PHPMYADMIN_DB_HOSTNAME=${PMA_HOST:=localhost}
|
||||
PHPMYADMIN_DB_PORT=${PMA_PORT:=3306}
|
||||
|
||||
# Color text output
|
||||
GREEN="\033[0;32m"
|
||||
RED="\033[0;31m"
|
||||
NC="\033[0m" # No Color
|
||||
|
||||
if [ ! -z "${TESTSUITE_HOSTNAME_ARBITRARY}" ]; then
|
||||
SERVER="--server ${PHPMYADMIN_DB_HOSTNAME}"
|
||||
fi
|
||||
|
||||
# Find test script
|
||||
if [ -f ./phpmyadmin_test.py ] ; then
|
||||
@@ -36,54 +20,32 @@ else
|
||||
FILENAME=./testing/phpmyadmin_test.py
|
||||
fi
|
||||
|
||||
# Check if script is running inside container
|
||||
if ! [ -f /.dockerenv ] ; then
|
||||
echo "Tests running outside container..."
|
||||
COMMAND_HOST="docker exec ${NAME}"
|
||||
docker ps -a
|
||||
mysql -h "${PHPMYADMIN_DB_HOSTNAME}" -P"${PHPMYADMIN_DB_PORT}" -u"${TESTSUITE_USER:=root}" -p"${TESTSUITE_PASSWORD}" -e "SELECT @@version;" > /dev/null
|
||||
ret=$?
|
||||
|
||||
# Wait for database to start
|
||||
TIMEOUT=0
|
||||
while [ $(docker logs db_server 2>&1 | fgrep -c "mysqld: ready for connections.") -le 0 ] ; do
|
||||
echo "Waiting for ${PHPMYADMIN_DB_HOSTNAME} database start..."
|
||||
sleep 10
|
||||
TIMEOUT=$((TIMEOUT + 1))
|
||||
if [ $TIMEOUT -gt 3 ] ; then
|
||||
echo "Failed to connect ${PHPMYADMIN_DB_HOSTNAME} database!"
|
||||
echo "Result of ${PHPMYADMIN_DB_HOSTNAME} tests: ${RED}FAILED${NC}"
|
||||
docker logs ${NAME}
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
if [ $ret -ne 0 ] ; then
|
||||
echo "Could not connect to ${PHPMYADMIN_DB_HOSTNAME} on port ${PHPMYADMIN_DB_PORT}"
|
||||
exit $ret
|
||||
fi
|
||||
|
||||
# Wait for container to start
|
||||
TIMEOUT=0
|
||||
while [ $(docker logs ${NAME} 2>&1 | fgrep -c "Command line: 'apache2 -D FOREGROUND'") -le 0 ] ; do
|
||||
echo "Waiting for PHPMyAdmin start..."
|
||||
sleep 1
|
||||
TIMEOUT=$((TIMEOUT + 1))
|
||||
if [ $TIMEOUT -gt 10 ] ; then
|
||||
echo "Failed to connect PHPMyAdmin!"
|
||||
echo "Result of ${PHPMYADMIN_DB_HOSTNAME} tests: ${RED}FAILED${NC}"
|
||||
docker logs ${NAME}
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
else
|
||||
echo "Tests running inside container..."
|
||||
FILENAME=/phpmyadmin_test.py
|
||||
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 -q --url "$PHPMYADMIN_URL" --username root --password "$TESTSUITE_PASSWORD" $SERVER $FILENAME
|
||||
pytest -p no:cacheprovider -q --url "$PHPMYADMIN_URL" --username ${TESTSUITE_USER:=root} --password "$TESTSUITE_PASSWORD" $SERVER $FILENAME
|
||||
ret=$?
|
||||
|
||||
# Show debug output in case of failure
|
||||
if [ $ret -ne 0 ] ; then
|
||||
${COMMAND_HOST} ps faux
|
||||
echo "Result of ${PHPMYADMIN_DB_HOSTNAME} tests: ${RED}FAILED${NC}"
|
||||
echo "Result of ${PHPMYADMIN_DB_HOSTNAME} tests: FAILED"
|
||||
exit $ret
|
||||
fi
|
||||
|
||||
echo "Result of ${PHPMYADMIN_DB_HOSTNAME} tests: ${GREEN}SUCCESS${NC}"
|
||||
echo "Result of ${PHPMYADMIN_DB_HOSTNAME} tests: SUCCESS"
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
[program:test-mariadb]
|
||||
command=/test-docker.sh test 80 mariadb
|
||||
autostart=true
|
||||
autorestart=false
|
||||
priority=3
|
||||
startretries=1
|
||||
stopwaitsecs=20
|
||||
stdout_logfile=/dev/stdout
|
||||
stdout_logfile_maxbytes=0
|
||||
stderr_logfile=/dev/stderr
|
||||
stderr_logfile_maxbytes=0
|
||||
@@ -1,11 +0,0 @@
|
||||
[program:test-mysql]
|
||||
command=/test-docker.sh test 80 db_server
|
||||
autostart=true
|
||||
autorestart=false
|
||||
priority=3
|
||||
startretries=1
|
||||
stopwaitsecs=20
|
||||
stdout_logfile=/dev/stdout
|
||||
stdout_logfile_maxbytes=0
|
||||
stderr_logfile=/dev/stderr
|
||||
stderr_logfile_maxbytes=0
|
||||
@@ -1,2 +0,0 @@
|
||||
[mysqld]
|
||||
default_authentication_plugin = mysql_native_password
|
||||
@@ -22,6 +22,7 @@ declare -A base=(
|
||||
)
|
||||
|
||||
latest="$(curl -fsSL 'https://www.phpmyadmin.net/home_page/version.json' | jq -r '.version')"
|
||||
sha256="$(curl -fsSL "https://files.phpmyadmin.net/phpMyAdmin/$latest/phpMyAdmin-$latest-all-languages.tar.xz.sha256" | cut -f1 -d ' ' | tr -cd 'a-f0-9' | cut -c 1-64)"
|
||||
|
||||
for variant in apache fpm fpm-alpine; do
|
||||
template="Dockerfile-${base[$variant]}.template"
|
||||
@@ -30,7 +31,11 @@ for variant in apache fpm fpm-alpine; do
|
||||
cp docker-entrypoint.sh "$variant/docker-entrypoint.sh"
|
||||
sed -ri -e '
|
||||
s/%%VERSION%%/'"$latest"'/;
|
||||
s/%%SHA256%%/'"$sha256"'/;
|
||||
s/%%VARIANT%%/'"$variant"'/;
|
||||
s/%%CMD%%/'"${cmd[$variant]}"'/;
|
||||
' "$variant/Dockerfile"
|
||||
if [ "$variant" != "apache" ]; then
|
||||
sed -i "/^# start: Apache specific settings$/,/^# end: Apache specific settings$/d" "$variant/docker-entrypoint.sh"
|
||||
fi
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user