mirror of
https://github.com/phpmyadmin/docker.git
synced 2026-08-24 10:13:22 -05:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9d1872d753 | ||
|
|
5f2beb027a | ||
|
|
0bd0e9a958 | ||
|
|
8dfcf48b25 | ||
|
|
e9d1da4ebc | ||
|
|
f522725291 | ||
|
|
a68a25c673 | ||
|
|
21dbdb8968 | ||
|
|
ff0e3c994a | ||
|
|
24d76d8e35 | ||
|
|
d3281e86e1 | ||
|
|
6167470118 | ||
|
|
304a628535 | ||
|
|
342c5fb3fc | ||
|
|
c5174eeef9 | ||
|
|
909eab579e | ||
|
|
168df32465 | ||
|
|
41ef7ee430 | ||
|
|
33fc40f4a3 | ||
|
|
219e173c5e | ||
|
|
f30ef539da | ||
|
|
036fd21c08 | ||
|
|
7d35294fc5 | ||
|
|
ca4e508924 | ||
|
|
effe2b1e80 | ||
|
|
e670276b37 | ||
|
|
78e3cb7aba | ||
|
|
a114733200 | ||
|
|
967db65940 | ||
|
|
921f2867f7 | ||
|
|
df7df179f2 | ||
|
|
0e87cd4731 | ||
|
|
d3d7a78dae | ||
|
|
c775ef93dc | ||
|
|
d2f01baf40 | ||
|
|
56806ecbc7 | ||
|
|
662b82d27e | ||
|
|
fa5fb6c985 | ||
|
|
b1e2062fb4 | ||
|
|
f01eddea45 | ||
|
|
7899e91e35 | ||
|
|
7af014ffdf | ||
|
|
0512d0c6b3 | ||
|
|
17003ccf85 | ||
|
|
d5a587d00d | ||
|
|
b2409f5930 | ||
|
|
7a1cbfd6a3 | ||
|
|
25dde22ee9 | ||
|
|
f0ebd7aec5 | ||
|
|
98aa7b80c8 | ||
|
|
2d6fd72542 | ||
|
|
c706c520ef | ||
|
|
8269a39bfa | ||
|
|
c625c70fde | ||
|
|
2608fbd118 | ||
|
|
df45b3f76c | ||
|
|
edf7b2a375 | ||
|
|
b369d770dd | ||
|
|
e831e55d59 | ||
|
|
7a5f742d7d | ||
|
|
316a237509 | ||
|
|
44a266c45d | ||
|
|
2fe5947116 | ||
|
|
92a5a76a26 | ||
|
|
5dd9a0f015 | ||
|
|
f18aca104e | ||
|
|
d42e7c8a7d | ||
|
|
ca768f47fc | ||
|
|
c6aee5664c | ||
|
|
93e2be73ec | ||
|
|
85198de04f | ||
|
|
b024df6c3c | ||
|
|
ffedad4cdf | ||
|
|
c5d83d0fba | ||
|
|
d5f2f27d37 | ||
|
|
d53771b561 | ||
|
|
3bd49fb1ef | ||
|
|
d9236dfdad | ||
|
|
5e02108932 | ||
|
|
3a01bacb26 | ||
|
|
c09ec0fda8 | ||
|
|
621e3ad755 | ||
|
|
c03fa82b56 | ||
|
|
f5644c53c8 | ||
|
|
45873ade6a | ||
|
|
7aa164f6e1 | ||
|
|
c086bcea60 | ||
|
|
885eb78b98 | ||
|
|
686bf94364 | ||
|
|
ade6f52350 | ||
|
|
c29aadee1b | ||
|
|
30857caf5c | ||
|
|
2c92dfa55c | ||
|
|
a576282372 | ||
|
|
c4abbbaa35 | ||
|
|
15e82b23d2 | ||
|
|
ff2edd1f87 | ||
|
|
275b59e3dd | ||
|
|
a18b6e3842 | ||
|
|
524e669ce9 |
@@ -1,7 +0,0 @@
|
||||
.travis.yml
|
||||
docker-compose.yml
|
||||
docker-compose.testing.yml
|
||||
README.md
|
||||
LICENSE
|
||||
Makefile
|
||||
testing
|
||||
@@ -0,0 +1,23 @@
|
||||
# Configuration for probot-stale - https://github.com/probot/stale
|
||||
|
||||
# Number of days of inactivity before an Issue or Pull Request becomes stale
|
||||
daysUntilStale: 60
|
||||
# Number of days of inactivity before a stale Issue or Pull Request is closed
|
||||
daysUntilClose: 7
|
||||
# Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable
|
||||
exemptLabels:
|
||||
- pinned
|
||||
- security
|
||||
# Label to use when marking as stale
|
||||
staleLabel: wontfix
|
||||
# Comment to post when marking as stale. Set to `false` to disable
|
||||
markComment: >
|
||||
This issue has been automatically marked as stale because it has not had
|
||||
recent activity. It will be closed if no further activity occurs. Thank you
|
||||
for your contributions.
|
||||
# Comment to post when removing the stale label. Set to `false` to disable
|
||||
unmarkComment: false
|
||||
# Comment to post when closing a stale Issue or Pull Request. Set to `false` to disable
|
||||
closeComment: false
|
||||
# Limit to only `issues` or `pulls`
|
||||
only: pulls
|
||||
+78
-33
@@ -1,45 +1,90 @@
|
||||
dist: trusty
|
||||
|
||||
sudo: required
|
||||
|
||||
services:
|
||||
- docker
|
||||
|
||||
language: python
|
||||
python:
|
||||
- "2.7"
|
||||
python: 2.7
|
||||
dist: bionic
|
||||
|
||||
env:
|
||||
matrix:
|
||||
- DB=mysql:latest
|
||||
- DB=mariadb:latest
|
||||
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 -d $DB
|
||||
- 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
|
||||
|
||||
script:
|
||||
# Build image
|
||||
- docker build -t phpmyadmin/phpmyadmin .
|
||||
# Test for single database
|
||||
- docker run --name testadmin -d --link db_server:db -p 9090:80 phpmyadmin/phpmyadmin
|
||||
- ./testing/test-docker.sh testadmin 9090
|
||||
# Test for single database using env
|
||||
- docker run --name envadmin -d --link db_server:db2 -e PMA_HOST=db2 -p 6060:80 phpmyadmin/phpmyadmin
|
||||
- ./testing/test-docker.sh envadmin 6060
|
||||
# Test for arbitrary database
|
||||
- docker run --name arbitraryadmin -d --link db_server:db3 -e PMA_ARBITRARY=1 -p 7070:80 phpmyadmin/phpmyadmin
|
||||
- ./testing/test-docker.sh arbitraryadmin 7070 db3
|
||||
# Test for arbitrary database with user config
|
||||
- docker run --name userconfigadmin -d --link db_server:db3 -v `readlink -f ./testing/config.test.inc.php`:/etc/phpmyadmin/config.user.inc.php -p 7080:80 phpmyadmin/phpmyadmin
|
||||
- ./testing/test-docker.sh userconfigadmin 7080 db3
|
||||
# Test docker-compose
|
||||
- docker-compose -f docker-compose.yml -f docker-compose.db.yml up -d
|
||||
- ./testing/test-docker.sh phpmyadmin 8080 db_server
|
||||
- docker-compose stop
|
||||
# Run tests in testing container
|
||||
- docker-compose -f docker-compose.testing.yml up -d phpmyadmin
|
||||
- ./testing/wait-for-testing.sh
|
||||
_helpers:
|
||||
- &test-docker-compose
|
||||
stage: "Test docker-compose"
|
||||
script:
|
||||
- docker-compose -f docker-compose.testing.yml up -d db_server
|
||||
- docker-compose -f docker-compose.testing.yml up -d
|
||||
- docker-compose exec phpmyadmin /test-docker.sh phpmyadmin_testing 80 phpmyadmin_testing_db
|
||||
- docker-compose stop
|
||||
- &test-apache-image
|
||||
stage: "Run tests in testing container"
|
||||
script:
|
||||
# Build image
|
||||
- docker build -t phpmyadmin/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
|
||||
-47
@@ -1,47 +0,0 @@
|
||||
FROM alpine:3.5
|
||||
|
||||
# Install dependencies
|
||||
RUN apk add --no-cache php7-session php7-mysqli php7-mbstring php7-xml php7-gd php7-zlib php7-bz2 php7-zip php7-openssl php7-curl php7-opcache php7-json php7-ctype nginx php7-fpm supervisor
|
||||
|
||||
# Include keyring to verify download
|
||||
COPY phpmyadmin.keyring /
|
||||
|
||||
# Copy configuration
|
||||
COPY etc /etc/
|
||||
|
||||
# Copy main script
|
||||
COPY run.sh /run.sh
|
||||
RUN chmod u+rwx /run.sh
|
||||
|
||||
# Calculate download URL
|
||||
ENV VERSION 4.7.1
|
||||
ENV URL https://files.phpmyadmin.net/phpMyAdmin/${VERSION}/phpMyAdmin-${VERSION}-all-languages.tar.gz
|
||||
LABEL version=$VERSION
|
||||
|
||||
# Download tarball, verify it using gpg and extract
|
||||
RUN set -x \
|
||||
&& GNUPGHOME="$(mktemp -d)" \
|
||||
&& export GNUPGHOME \
|
||||
&& apk add --no-cache curl gnupg \
|
||||
&& curl --output phpMyAdmin.tar.gz --location $URL \
|
||||
&& curl --output phpMyAdmin.tar.gz.asc --location $URL.asc \
|
||||
&& gpgv --keyring /phpmyadmin.keyring phpMyAdmin.tar.gz.asc phpMyAdmin.tar.gz \
|
||||
&& apk del --no-cache curl gnupg \
|
||||
&& rm -rf "$GNUPGHOME" \
|
||||
&& tar xzf phpMyAdmin.tar.gz \
|
||||
&& rm -f phpMyAdmin.tar.gz phpMyAdmin.tar.gz.asc \
|
||||
&& mv phpMyAdmin-$VERSION-all-languages /www \
|
||||
&& rm -rf /www/setup/ /www/examples/ /www/test/ /www/po/ /www/composer.json /www/RELEASE-DATE-$VERSION \
|
||||
&& sed -i "s@define('CONFIG_DIR'.*@define('CONFIG_DIR', '/etc/phpmyadmin/');@" /www/libraries/vendor_config.php \
|
||||
&& chown -R root:nobody /www \
|
||||
&& find /www -type d -exec chmod 750 {} \; \
|
||||
&& find /www -type f -exec chmod 640 {} \;
|
||||
|
||||
# Add directory for sessions to allow session persistence
|
||||
RUN mkdir /sessions
|
||||
|
||||
# We expose phpMyAdmin on port 80
|
||||
EXPOSE 80
|
||||
|
||||
ENTRYPOINT [ "/run.sh" ]
|
||||
CMD ["phpmyadmin"]
|
||||
@@ -0,0 +1,92 @@
|
||||
FROM php:7.2-%%VARIANT%%
|
||||
|
||||
# docker-entrypoint.sh dependencies
|
||||
RUN apk add --no-cache \
|
||||
bash
|
||||
|
||||
# Install dependencies
|
||||
RUN set -ex; \
|
||||
\
|
||||
apk add --no-cache --virtual .build-deps \
|
||||
bzip2-dev \
|
||||
freetype-dev \
|
||||
libjpeg-turbo-dev \
|
||||
libpng-dev \
|
||||
libwebp-dev \
|
||||
libxpm-dev \
|
||||
; \
|
||||
\
|
||||
docker-php-ext-configure gd --with-freetype-dir=/usr --with-jpeg-dir=/usr --with-webp-dir=/usr --with-png-dir=/usr --with-xpm-dir=/usr; \
|
||||
docker-php-ext-install bz2 gd mysqli opcache zip; \
|
||||
\
|
||||
runDeps="$( \
|
||||
scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/lib/php/extensions \
|
||||
| tr ',' '\n' \
|
||||
| sort -u \
|
||||
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
|
||||
)"; \
|
||||
apk add --virtual .phpmyadmin-phpexts-rundeps $runDeps; \
|
||||
apk del .build-deps
|
||||
|
||||
# set recommended PHP.ini settings
|
||||
# see https://secure.php.net/manual/en/opcache.installation.php
|
||||
RUN { \
|
||||
echo 'opcache.memory_consumption=128'; \
|
||||
echo 'opcache.interned_strings_buffer=8'; \
|
||||
echo 'opcache.max_accelerated_files=4000'; \
|
||||
echo 'opcache.revalidate_freq=2'; \
|
||||
echo 'opcache.fast_shutdown=1'; \
|
||||
echo 'opcache.enable_cli=1'; \
|
||||
} > /usr/local/etc/php/conf.d/opcache-recommended.ini; \
|
||||
\
|
||||
{ \
|
||||
echo 'session.cookie_httponly = 1'; \
|
||||
echo 'session.use_strict_mode = 1'; \
|
||||
} > /usr/local/etc/php/conf.d/session-strict.ini; \
|
||||
\
|
||||
{ \
|
||||
echo 'allow_url_fopen = Off'; \
|
||||
echo 'max_execution_time = 600'; \
|
||||
echo 'memory_limit = 512M'; \
|
||||
} > /usr/local/etc/php/conf.d/phpmyadmin-misc.ini
|
||||
|
||||
# Calculate download URL
|
||||
ENV VERSION %%VERSION%%
|
||||
ENV URL https://files.phpmyadmin.net/phpMyAdmin/${VERSION}/phpMyAdmin-${VERSION}-all-languages.tar.xz
|
||||
LABEL version=$VERSION
|
||||
|
||||
# Download tarball, verify it using gpg and extract
|
||||
RUN set -ex; \
|
||||
apk add --no-cache --virtual .fetch-deps \
|
||||
gnupg \
|
||||
; \
|
||||
\
|
||||
export GNUPGHOME="$(mktemp -d)"; \
|
||||
export GPGKEY="3D06A59ECE730EB71B511C17CE752F178259BD92"; \
|
||||
curl --output phpMyAdmin.tar.xz --location $URL; \
|
||||
curl --output phpMyAdmin.tar.xz.asc --location $URL.asc; \
|
||||
gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPGKEY" \
|
||||
|| gpg --batch --keyserver ipv4.pool.sks-keyservers.net --recv-keys "$GPGKEY" \
|
||||
|| gpg --batch --keyserver keys.gnupg.net --recv-keys "$GPGKEY" \
|
||||
|| gpg --batch --keyserver pgp.mit.edu --recv-keys "$GPGKEY" \
|
||||
|| gpg --batch --keyserver keyserver.pgp.com --recv-keys "$GPGKEY"; \
|
||||
gpg --batch --verify phpMyAdmin.tar.xz.asc phpMyAdmin.tar.xz; \
|
||||
tar -xf phpMyAdmin.tar.xz -C /usr/src; \
|
||||
gpgconf --kill all; \
|
||||
rm -r "$GNUPGHOME" phpMyAdmin.tar.xz phpMyAdmin.tar.xz.asc; \
|
||||
mv /usr/src/phpMyAdmin-$VERSION-all-languages /usr/src/phpmyadmin; \
|
||||
rm -rf /usr/src/phpmyadmin/setup/ /usr/src/phpmyadmin/examples/ /usr/src/phpmyadmin/test/ /usr/src/phpmyadmin/po/ /usr/src/phpmyadmin/composer.json /usr/src/phpmyadmin/RELEASE-DATE-$VERSION; \
|
||||
sed -i "s@define('CONFIG_DIR'.*@define('CONFIG_DIR', '/etc/phpmyadmin/');@" /usr/src/phpmyadmin/libraries/vendor_config.php; \
|
||||
# Add directory for sessions to allow session persistence
|
||||
mkdir /sessions; \
|
||||
mkdir -p /var/nginx/client_body_temp; \
|
||||
apk del .fetch-deps
|
||||
|
||||
# Copy configuration
|
||||
COPY config.inc.php /etc/phpmyadmin/config.inc.php
|
||||
|
||||
# Copy main script
|
||||
COPY docker-entrypoint.sh /docker-entrypoint.sh
|
||||
|
||||
ENTRYPOINT [ "/docker-entrypoint.sh" ]
|
||||
CMD ["%%CMD%%"]
|
||||
@@ -0,0 +1,100 @@
|
||||
FROM php:7.2-%%VARIANT%%
|
||||
|
||||
# Install dependencies
|
||||
RUN set -ex; \
|
||||
\
|
||||
savedAptMark="$(apt-mark showmanual)"; \
|
||||
\
|
||||
apt-get update; \
|
||||
apt-get install -y --no-install-recommends \
|
||||
libbz2-dev \
|
||||
libfreetype6-dev \
|
||||
libjpeg-dev \
|
||||
libpng-dev \
|
||||
libwebp-dev \
|
||||
libxpm-dev \
|
||||
; \
|
||||
\
|
||||
docker-php-ext-configure gd --with-freetype-dir=/usr --with-jpeg-dir=/usr --with-webp-dir=/usr --with-png-dir=/usr --with-xpm-dir=/usr; \
|
||||
docker-php-ext-install bz2 gd mysqli opcache zip; \
|
||||
\
|
||||
apt-mark auto '.*' > /dev/null; \
|
||||
apt-mark manual $savedAptMark; \
|
||||
ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \
|
||||
| awk '/=>/ { print $3 }' \
|
||||
| sort -u \
|
||||
| xargs -r dpkg-query -S \
|
||||
| cut -d: -f1 \
|
||||
| sort -u \
|
||||
| xargs -rt apt-mark manual; \
|
||||
\
|
||||
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# set recommended PHP.ini settings
|
||||
# see https://secure.php.net/manual/en/opcache.installation.php
|
||||
RUN { \
|
||||
echo 'opcache.memory_consumption=128'; \
|
||||
echo 'opcache.interned_strings_buffer=8'; \
|
||||
echo 'opcache.max_accelerated_files=4000'; \
|
||||
echo 'opcache.revalidate_freq=2'; \
|
||||
echo 'opcache.fast_shutdown=1'; \
|
||||
echo 'opcache.enable_cli=1'; \
|
||||
} > /usr/local/etc/php/conf.d/opcache-recommended.ini; \
|
||||
\
|
||||
{ \
|
||||
echo 'session.cookie_httponly = 1'; \
|
||||
echo 'session.use_strict_mode = 1'; \
|
||||
} > /usr/local/etc/php/conf.d/session-strict.ini; \
|
||||
\
|
||||
{ \
|
||||
echo 'allow_url_fopen = Off'; \
|
||||
echo 'max_execution_time = 600'; \
|
||||
echo 'memory_limit = 512M'; \
|
||||
} > /usr/local/etc/php/conf.d/phpmyadmin-misc.ini
|
||||
|
||||
# Calculate download URL
|
||||
ENV VERSION %%VERSION%%
|
||||
ENV URL https://files.phpmyadmin.net/phpMyAdmin/${VERSION}/phpMyAdmin-${VERSION}-all-languages.tar.xz
|
||||
LABEL version=$VERSION
|
||||
|
||||
# Download tarball, verify it using gpg and extract
|
||||
RUN set -ex; \
|
||||
fetchDeps=" \
|
||||
gnupg \
|
||||
dirmngr \
|
||||
"; \
|
||||
apt-get update; \
|
||||
apt-get install -y --no-install-recommends $fetchDeps; \
|
||||
\
|
||||
export GNUPGHOME="$(mktemp -d)"; \
|
||||
export GPGKEY="3D06A59ECE730EB71B511C17CE752F178259BD92"; \
|
||||
curl --output phpMyAdmin.tar.xz --location $URL; \
|
||||
curl --output phpMyAdmin.tar.xz.asc --location $URL.asc; \
|
||||
gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPGKEY" \
|
||||
|| gpg --batch --keyserver ipv4.pool.sks-keyservers.net --recv-keys "$GPGKEY" \
|
||||
|| gpg --batch --keyserver keys.gnupg.net --recv-keys "$GPGKEY" \
|
||||
|| gpg --batch --keyserver pgp.mit.edu --recv-keys "$GPGKEY" \
|
||||
|| gpg --batch --keyserver keyserver.pgp.com --recv-keys "$GPGKEY"; \
|
||||
gpg --batch --verify phpMyAdmin.tar.xz.asc phpMyAdmin.tar.xz; \
|
||||
tar -xf phpMyAdmin.tar.xz -C /usr/src; \
|
||||
gpgconf --kill all; \
|
||||
rm -r "$GNUPGHOME" phpMyAdmin.tar.xz phpMyAdmin.tar.xz.asc; \
|
||||
mv /usr/src/phpMyAdmin-$VERSION-all-languages /usr/src/phpmyadmin; \
|
||||
rm -rf /usr/src/phpmyadmin/setup/ /usr/src/phpmyadmin/examples/ /usr/src/phpmyadmin/test/ /usr/src/phpmyadmin/po/ /usr/src/phpmyadmin/composer.json /usr/src/phpmyadmin/RELEASE-DATE-$VERSION; \
|
||||
sed -i "s@define('CONFIG_DIR'.*@define('CONFIG_DIR', '/etc/phpmyadmin/');@" /usr/src/phpmyadmin/libraries/vendor_config.php; \
|
||||
# Add directory for sessions to allow session persistence
|
||||
mkdir /sessions; \
|
||||
mkdir -p /var/nginx/client_body_temp; \
|
||||
\
|
||||
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $fetchDeps; \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Copy configuration
|
||||
COPY config.inc.php /etc/phpmyadmin/config.inc.php
|
||||
|
||||
# Copy main script
|
||||
COPY docker-entrypoint.sh /docker-entrypoint.sh
|
||||
|
||||
ENTRYPOINT [ "/docker-entrypoint.sh" ]
|
||||
CMD ["%%CMD%%"]
|
||||
@@ -1,14 +1,19 @@
|
||||
DOCKER_REPO = phpmyadmin/phpmyadmin
|
||||
|
||||
.PHONY: all build build_nc run logs clean stop rm prune
|
||||
.PHONY: all build run logs clean stop rm prune
|
||||
|
||||
all: build run logs
|
||||
|
||||
build:
|
||||
docker build -t ${DOCKER_REPO}:testing .
|
||||
build: build-apache build-fpm build-fpm-alpine
|
||||
|
||||
build_nc:
|
||||
docker build --no-cache=true -t ${DOCKER_REPO}:testing .
|
||||
build-apache:
|
||||
docker build ${DOCKER_FLAGS} -t ${DOCKER_REPO}:testing apache
|
||||
|
||||
build-fpm:
|
||||
docker build ${DOCKER_FLAGS} -t ${DOCKER_REPO}:testing-fpm fpm
|
||||
|
||||
build-fpm-alpine:
|
||||
docker build ${DOCKER_FLAGS} -t ${DOCKER_REPO}:testing-fpm-alpine fpm-alpine
|
||||
|
||||
run:
|
||||
docker-compose -f docker-compose.testing.yml up -d
|
||||
|
||||
@@ -27,11 +27,22 @@ The official MySQL and MariaDB use following environment variables to define the
|
||||
You can use following tags on Docker hub:
|
||||
|
||||
* `latest` - latest stable release
|
||||
* `4.6` - latest stable release from the 4.6 branch
|
||||
* `4.7` - latest stable release from the 4.7 branch
|
||||
* `edge` - bleeding edge docker image (contains stable phpMyAdmin, but the Docker image changes might not yet be fully tested)
|
||||
* `edge-4.7` - bleeding edge docker image + latest snapshots from 4.7 branch
|
||||
* `edge-4.8` - bleeding edge docker image + latest snapshots from 4.8 branch (currently master)
|
||||
* `4.8` - latest stable release for the 4.8 version
|
||||
* `4.8.5` - specific patch release for the 4.8 version
|
||||
|
||||
For each tag the following variants are provided:
|
||||
|
||||
### apache
|
||||
|
||||
This starts an Apache webserver with PHP, so you can use phpMyAdmin out of the box.
|
||||
|
||||
### fpm-alpine
|
||||
|
||||
This image has a very small footprint. It is based on Alpine Linux and starts only 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.
|
||||
|
||||
### fpm
|
||||
|
||||
This image starts only a PHP FPM container. Use this variant if you already have a seperate webserver.
|
||||
|
||||
## Usage with linked server
|
||||
|
||||
@@ -56,7 +67,7 @@ docker run --name myadmin -d -e PMA_HOST=dbhost -p 8080:80 phpmyadmin/phpmyadmin
|
||||
You can use arbitrary servers by adding ENV variable `PMA_ARBITRARY=1` to the startup command:
|
||||
|
||||
```
|
||||
docker run --name myadmin -d --link mysql_db_server:db -p 8080:80 -e PMA_ARBITRARY=1 phpmyadmin/phpmyadmin
|
||||
docker run --name myadmin -d -e PMA_ARBITRARY=1 -p 8080:80 phpmyadmin/phpmyadmin
|
||||
```
|
||||
|
||||
## Usage with docker-compose and arbitrary server
|
||||
@@ -110,9 +121,15 @@ Set the variable ``PMA_ABSOLUTE_URI`` to the fully-qualified path (``https://pma
|
||||
* ``PMA_PORT`` - define port of the MySQL server
|
||||
* ``PMA_HOSTS`` - define comma separated list of address/host names of the MySQL servers
|
||||
* ``PMA_VERBOSES`` - define comma separated list of verbose names of the MySQL servers
|
||||
* ``PMA_PORTS`` - define comma separated list of ports of the MySQL servers
|
||||
* ``PMA_USER`` and ``PMA_PASSWORD`` - define username to use for config authentication method
|
||||
* ``PMA_ABSOLUTE_URI`` - define user-facing URI
|
||||
|
||||
For usage with Docker secrets, appending ``_FILE`` to any environment variable is allowed:
|
||||
```
|
||||
docker run --name myadmin -d -e PMA_PASSWORD_FILE=/run/secrets/db_password.txt -p 8080:80 phpmyadmin/phpmyadmin
|
||||
```
|
||||
|
||||
For more detailed documentation see https://docs.phpmyadmin.net/en/latest/setup.html#installing-using-docker
|
||||
|
||||
[hub]: https://hub.docker.com/r/phpmyadmin/phpmyadmin/
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
FROM php:7.2-apache
|
||||
|
||||
# Install dependencies
|
||||
RUN set -ex; \
|
||||
\
|
||||
savedAptMark="$(apt-mark showmanual)"; \
|
||||
\
|
||||
apt-get update; \
|
||||
apt-get install -y --no-install-recommends \
|
||||
libbz2-dev \
|
||||
libfreetype6-dev \
|
||||
libjpeg-dev \
|
||||
libpng-dev \
|
||||
libwebp-dev \
|
||||
libxpm-dev \
|
||||
; \
|
||||
\
|
||||
docker-php-ext-configure gd --with-freetype-dir=/usr --with-jpeg-dir=/usr --with-webp-dir=/usr --with-png-dir=/usr --with-xpm-dir=/usr; \
|
||||
docker-php-ext-install bz2 gd mysqli opcache zip; \
|
||||
\
|
||||
apt-mark auto '.*' > /dev/null; \
|
||||
apt-mark manual $savedAptMark; \
|
||||
ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \
|
||||
| awk '/=>/ { print $3 }' \
|
||||
| sort -u \
|
||||
| xargs -r dpkg-query -S \
|
||||
| cut -d: -f1 \
|
||||
| sort -u \
|
||||
| xargs -rt apt-mark manual; \
|
||||
\
|
||||
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# set recommended PHP.ini settings
|
||||
# see https://secure.php.net/manual/en/opcache.installation.php
|
||||
RUN { \
|
||||
echo 'opcache.memory_consumption=128'; \
|
||||
echo 'opcache.interned_strings_buffer=8'; \
|
||||
echo 'opcache.max_accelerated_files=4000'; \
|
||||
echo 'opcache.revalidate_freq=2'; \
|
||||
echo 'opcache.fast_shutdown=1'; \
|
||||
echo 'opcache.enable_cli=1'; \
|
||||
} > /usr/local/etc/php/conf.d/opcache-recommended.ini; \
|
||||
\
|
||||
{ \
|
||||
echo 'session.cookie_httponly = 1'; \
|
||||
echo 'session.use_strict_mode = 1'; \
|
||||
} > /usr/local/etc/php/conf.d/session-strict.ini; \
|
||||
\
|
||||
{ \
|
||||
echo 'allow_url_fopen = Off'; \
|
||||
echo 'max_execution_time = 600'; \
|
||||
echo 'memory_limit = 512M'; \
|
||||
} > /usr/local/etc/php/conf.d/phpmyadmin-misc.ini
|
||||
|
||||
# Calculate download URL
|
||||
ENV VERSION 4.9.1
|
||||
ENV URL https://files.phpmyadmin.net/phpMyAdmin/${VERSION}/phpMyAdmin-${VERSION}-all-languages.tar.xz
|
||||
LABEL version=$VERSION
|
||||
|
||||
# Download tarball, verify it using gpg and extract
|
||||
RUN set -ex; \
|
||||
fetchDeps=" \
|
||||
gnupg \
|
||||
dirmngr \
|
||||
"; \
|
||||
apt-get update; \
|
||||
apt-get install -y --no-install-recommends $fetchDeps; \
|
||||
\
|
||||
export GNUPGHOME="$(mktemp -d)"; \
|
||||
export GPGKEY="3D06A59ECE730EB71B511C17CE752F178259BD92"; \
|
||||
curl --output phpMyAdmin.tar.xz --location $URL; \
|
||||
curl --output phpMyAdmin.tar.xz.asc --location $URL.asc; \
|
||||
gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPGKEY" \
|
||||
|| gpg --batch --keyserver ipv4.pool.sks-keyservers.net --recv-keys "$GPGKEY" \
|
||||
|| gpg --batch --keyserver keys.gnupg.net --recv-keys "$GPGKEY" \
|
||||
|| gpg --batch --keyserver pgp.mit.edu --recv-keys "$GPGKEY" \
|
||||
|| gpg --batch --keyserver keyserver.pgp.com --recv-keys "$GPGKEY"; \
|
||||
gpg --batch --verify phpMyAdmin.tar.xz.asc phpMyAdmin.tar.xz; \
|
||||
tar -xf phpMyAdmin.tar.xz -C /usr/src; \
|
||||
gpgconf --kill all; \
|
||||
rm -r "$GNUPGHOME" phpMyAdmin.tar.xz phpMyAdmin.tar.xz.asc; \
|
||||
mv /usr/src/phpMyAdmin-$VERSION-all-languages /usr/src/phpmyadmin; \
|
||||
rm -rf /usr/src/phpmyadmin/setup/ /usr/src/phpmyadmin/examples/ /usr/src/phpmyadmin/test/ /usr/src/phpmyadmin/po/ /usr/src/phpmyadmin/composer.json /usr/src/phpmyadmin/RELEASE-DATE-$VERSION; \
|
||||
sed -i "s@define('CONFIG_DIR'.*@define('CONFIG_DIR', '/etc/phpmyadmin/');@" /usr/src/phpmyadmin/libraries/vendor_config.php; \
|
||||
# Add directory for sessions to allow session persistence
|
||||
mkdir /sessions; \
|
||||
mkdir -p /var/nginx/client_body_temp; \
|
||||
\
|
||||
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $fetchDeps; \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Copy configuration
|
||||
COPY config.inc.php /etc/phpmyadmin/config.inc.php
|
||||
|
||||
# Copy main script
|
||||
COPY docker-entrypoint.sh /docker-entrypoint.sh
|
||||
|
||||
ENTRYPOINT [ "/docker-entrypoint.sh" ]
|
||||
CMD ["apache2-foreground"]
|
||||
@@ -0,0 +1,137 @@
|
||||
<?php
|
||||
|
||||
require('/etc/phpmyadmin/config.secret.inc.php');
|
||||
|
||||
/* Ensure we got the environment */
|
||||
$vars = array(
|
||||
'PMA_ARBITRARY',
|
||||
'PMA_HOST',
|
||||
'PMA_HOSTS',
|
||||
'PMA_VERBOSE',
|
||||
'PMA_VERBOSES',
|
||||
'PMA_PORT',
|
||||
'PMA_PORTS',
|
||||
'PMA_SOCKET',
|
||||
'PMA_SOCKETS',
|
||||
'PMA_USER',
|
||||
'PMA_PASSWORD',
|
||||
'PMA_ABSOLUTE_URI',
|
||||
'PMA_CONTROLHOST',
|
||||
'PMA_CONTROLPORT',
|
||||
'PMA_PMADB',
|
||||
'PMA_CONTROLUSER',
|
||||
'PMA_CONTROLPASS',
|
||||
'PMA_QUERYHISTORYDB'
|
||||
);
|
||||
foreach ($vars as $var) {
|
||||
$env = getenv($var);
|
||||
if (!isset($_ENV[$var]) && $env !== false) {
|
||||
$_ENV[$var] = $env;
|
||||
}
|
||||
}
|
||||
if (isset($_ENV['PMA_QUERYHISTORYDB'])) {
|
||||
$cfg['QueryHistoryDB'] = boolval($_ENV['PMA_QUERYHISTORYDB']);
|
||||
}
|
||||
|
||||
/* Arbitrary server connection */
|
||||
if (isset($_ENV['PMA_ARBITRARY']) && $_ENV['PMA_ARBITRARY'] === '1') {
|
||||
$cfg['AllowArbitraryServer'] = true;
|
||||
}
|
||||
|
||||
/* Play nice behind reverse proxys */
|
||||
if (isset($_ENV['PMA_ABSOLUTE_URI'])) {
|
||||
$cfg['PmaAbsoluteUri'] = trim($_ENV['PMA_ABSOLUTE_URI']);
|
||||
}
|
||||
|
||||
/* Figure out hosts */
|
||||
|
||||
/* Fallback to default linked */
|
||||
$hosts = array('db');
|
||||
|
||||
/* Set by environment */
|
||||
if (!empty($_ENV['PMA_HOST'])) {
|
||||
$hosts = array($_ENV['PMA_HOST']);
|
||||
$verbose = array($_ENV['PMA_VERBOSE']);
|
||||
$ports = array($_ENV['PMA_PORT']);
|
||||
} elseif (!empty($_ENV['PMA_HOSTS'])) {
|
||||
$hosts = array_map('trim', explode(',', $_ENV['PMA_HOSTS']));
|
||||
$verbose = array_map('trim', explode(',', $_ENV['PMA_VERBOSES']));
|
||||
$ports = array_map('trim', explode(',', $_ENV['PMA_PORTS']));
|
||||
}
|
||||
if (!empty($_ENV['PMA_SOCKET'])) {
|
||||
$sockets = array($_ENV['PMA_SOCKET']);
|
||||
} elseif (!empty($_ENV['PMA_SOCKETS'])) {
|
||||
$sockets = explode(',', $_ENV['PMA_SOCKETS']);
|
||||
}
|
||||
|
||||
/* Server settings */
|
||||
for ($i = 1; isset($hosts[$i - 1]); $i++) {
|
||||
$cfg['Servers'][$i]['host'] = $hosts[$i - 1];
|
||||
if (isset($verbose[$i - 1])) {
|
||||
$cfg['Servers'][$i]['verbose'] = $verbose[$i - 1];
|
||||
}
|
||||
if (isset($ports[$i - 1])) {
|
||||
$cfg['Servers'][$i]['port'] = $ports[$i - 1];
|
||||
}
|
||||
if (isset($_ENV['PMA_USER'])) {
|
||||
$cfg['Servers'][$i]['auth_type'] = 'config';
|
||||
$cfg['Servers'][$i]['user'] = $_ENV['PMA_USER'];
|
||||
$cfg['Servers'][$i]['password'] = isset($_ENV['PMA_PASSWORD']) ? $_ENV['PMA_PASSWORD'] : '';
|
||||
} else {
|
||||
$cfg['Servers'][$i]['auth_type'] = 'cookie';
|
||||
}
|
||||
if (isset($_ENV['PMA_PMADB'])) {
|
||||
$cfg['Servers'][$i]['pmadb'] = $_ENV['PMA_PMADB'];
|
||||
$cfg['Servers'][$i]['relation'] = 'pma__relation';
|
||||
$cfg['Servers'][$i]['table_info'] = 'pma__table_info';
|
||||
$cfg['Servers'][$i]['table_coords'] = 'pma__table_coords';
|
||||
$cfg['Servers'][$i]['pdf_pages'] = 'pma__pdf_pages';
|
||||
$cfg['Servers'][$i]['column_info'] = 'pma__column_info';
|
||||
$cfg['Servers'][$i]['bookmarktable'] = 'pma__bookmark';
|
||||
$cfg['Servers'][$i]['history'] = 'pma__history';
|
||||
$cfg['Servers'][$i]['recent'] = 'pma__recent';
|
||||
$cfg['Servers'][$i]['favorite'] = 'pma__favorite';
|
||||
$cfg['Servers'][$i]['table_uiprefs'] = 'pma__table_uiprefs';
|
||||
$cfg['Servers'][$i]['tracking'] = 'pma__tracking';
|
||||
$cfg['Servers'][$i]['userconfig'] = 'pma__userconfig';
|
||||
$cfg['Servers'][$i]['users'] = 'pma__users';
|
||||
$cfg['Servers'][$i]['usergroups'] = 'pma__usergroups';
|
||||
$cfg['Servers'][$i]['navigationhiding'] = 'pma__navigationhiding';
|
||||
$cfg['Servers'][$i]['savedsearches'] = 'pma__savedsearches';
|
||||
$cfg['Servers'][$i]['central_columns'] = 'pma__central_columns';
|
||||
$cfg['Servers'][$i]['designer_settings'] = 'pma__designer_settings';
|
||||
$cfg['Servers'][$i]['export_templates'] = 'pma__export_templates';
|
||||
}
|
||||
if (isset($_ENV['PMA_CONTROLHOST'])) {
|
||||
$cfg['Servers'][$i]['controlhost'] = $_ENV['PMA_CONTROLHOST'];
|
||||
}
|
||||
if (isset($_ENV['PMA_CONTROLPORT'])) {
|
||||
$cfg['Servers'][$i]['controlport'] = $_ENV['PMA_CONTROLPORT'];
|
||||
}
|
||||
if (isset($_ENV['PMA_CONTROLUSER'])) {
|
||||
$cfg['Servers'][$i]['controluser'] = $_ENV['PMA_CONTROLUSER'];
|
||||
}
|
||||
if (isset($_ENV['PMA_CONTROLPASS'])) {
|
||||
$cfg['Servers'][$i]['controlpass'] = $_ENV['PMA_CONTROLPASS'];
|
||||
}
|
||||
$cfg['Servers'][$i]['compress'] = false;
|
||||
$cfg['Servers'][$i]['AllowNoPassword'] = true;
|
||||
}
|
||||
for ($i = 1; isset($sockets[$i - 1]); $i++) {
|
||||
$cfg['Servers'][$i]['socket'] = $sockets[$i - 1];
|
||||
$cfg['Servers'][$i]['host'] = 'localhost';
|
||||
}
|
||||
/*
|
||||
* Revert back to last configured server to make
|
||||
* it easier in config.user.inc.php
|
||||
*/
|
||||
$i--;
|
||||
|
||||
/* Uploads setup */
|
||||
$cfg['UploadDir'] = '';
|
||||
$cfg['SaveDir'] = '';
|
||||
|
||||
/* Include User Defined Settings Hook */
|
||||
if (file_exists('/etc/phpmyadmin/config.user.inc.php')) {
|
||||
include('/etc/phpmyadmin/config.user.inc.php');
|
||||
}
|
||||
Executable
+50
@@ -0,0 +1,50 @@
|
||||
#!/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
|
||||
|
||||
chown www-data:www-data /sessions /var/nginx/client_body_temp
|
||||
|
||||
if ! [ -e index.php -a -e db_designer.php ]; then
|
||||
echo >&2 "phpMyAdmin not found in $PWD - copying now..."
|
||||
if [ "$(ls -A)" ]; then
|
||||
echo >&2 "WARNING: $PWD is not empty - press Ctrl+C now if this is an error!"
|
||||
( set -x; ls -A; sleep 10 )
|
||||
fi
|
||||
tar --create \
|
||||
--file - \
|
||||
--one-file-system \
|
||||
--directory /usr/src/phpmyadmin \
|
||||
--owner "$user" --group "$group" \
|
||||
. | tar --extract --file -
|
||||
echo >&2 "Complete! phpMyAdmin has been successfully copied to $PWD"
|
||||
mkdir -p tmp; \
|
||||
chmod -R 777 tmp; \
|
||||
fi
|
||||
|
||||
if [ ! -f /etc/phpmyadmin/config.secret.inc.php ]; then
|
||||
cat > /etc/phpmyadmin/config.secret.inc.php <<EOT
|
||||
<?php
|
||||
\$cfg['blowfish_secret'] = '$(tr -dc 'a-zA-Z0-9~!@#$%^&*_()+}{?></";.,[]=-' < /dev/urandom | fold -w 32 | head -n 1)';
|
||||
EOT
|
||||
fi
|
||||
|
||||
if [ ! -f /etc/phpmyadmin/config.user.inc.php ]; then
|
||||
touch /etc/phpmyadmin/config.user.inc.php
|
||||
fi
|
||||
fi
|
||||
|
||||
exec "$@"
|
||||
+137
@@ -0,0 +1,137 @@
|
||||
<?php
|
||||
|
||||
require('/etc/phpmyadmin/config.secret.inc.php');
|
||||
|
||||
/* Ensure we got the environment */
|
||||
$vars = array(
|
||||
'PMA_ARBITRARY',
|
||||
'PMA_HOST',
|
||||
'PMA_HOSTS',
|
||||
'PMA_VERBOSE',
|
||||
'PMA_VERBOSES',
|
||||
'PMA_PORT',
|
||||
'PMA_PORTS',
|
||||
'PMA_SOCKET',
|
||||
'PMA_SOCKETS',
|
||||
'PMA_USER',
|
||||
'PMA_PASSWORD',
|
||||
'PMA_ABSOLUTE_URI',
|
||||
'PMA_CONTROLHOST',
|
||||
'PMA_CONTROLPORT',
|
||||
'PMA_PMADB',
|
||||
'PMA_CONTROLUSER',
|
||||
'PMA_CONTROLPASS',
|
||||
'PMA_QUERYHISTORYDB'
|
||||
);
|
||||
foreach ($vars as $var) {
|
||||
$env = getenv($var);
|
||||
if (!isset($_ENV[$var]) && $env !== false) {
|
||||
$_ENV[$var] = $env;
|
||||
}
|
||||
}
|
||||
if (isset($_ENV['PMA_QUERYHISTORYDB'])) {
|
||||
$cfg['QueryHistoryDB'] = boolval($_ENV['PMA_QUERYHISTORYDB']);
|
||||
}
|
||||
|
||||
/* Arbitrary server connection */
|
||||
if (isset($_ENV['PMA_ARBITRARY']) && $_ENV['PMA_ARBITRARY'] === '1') {
|
||||
$cfg['AllowArbitraryServer'] = true;
|
||||
}
|
||||
|
||||
/* Play nice behind reverse proxys */
|
||||
if (isset($_ENV['PMA_ABSOLUTE_URI'])) {
|
||||
$cfg['PmaAbsoluteUri'] = trim($_ENV['PMA_ABSOLUTE_URI']);
|
||||
}
|
||||
|
||||
/* Figure out hosts */
|
||||
|
||||
/* Fallback to default linked */
|
||||
$hosts = array('db');
|
||||
|
||||
/* Set by environment */
|
||||
if (!empty($_ENV['PMA_HOST'])) {
|
||||
$hosts = array($_ENV['PMA_HOST']);
|
||||
$verbose = array($_ENV['PMA_VERBOSE']);
|
||||
$ports = array($_ENV['PMA_PORT']);
|
||||
} elseif (!empty($_ENV['PMA_HOSTS'])) {
|
||||
$hosts = array_map('trim', explode(',', $_ENV['PMA_HOSTS']));
|
||||
$verbose = array_map('trim', explode(',', $_ENV['PMA_VERBOSES']));
|
||||
$ports = array_map('trim', explode(',', $_ENV['PMA_PORTS']));
|
||||
}
|
||||
if (!empty($_ENV['PMA_SOCKET'])) {
|
||||
$sockets = array($_ENV['PMA_SOCKET']);
|
||||
} elseif (!empty($_ENV['PMA_SOCKETS'])) {
|
||||
$sockets = explode(',', $_ENV['PMA_SOCKETS']);
|
||||
}
|
||||
|
||||
/* Server settings */
|
||||
for ($i = 1; isset($hosts[$i - 1]); $i++) {
|
||||
$cfg['Servers'][$i]['host'] = $hosts[$i - 1];
|
||||
if (isset($verbose[$i - 1])) {
|
||||
$cfg['Servers'][$i]['verbose'] = $verbose[$i - 1];
|
||||
}
|
||||
if (isset($ports[$i - 1])) {
|
||||
$cfg['Servers'][$i]['port'] = $ports[$i - 1];
|
||||
}
|
||||
if (isset($_ENV['PMA_USER'])) {
|
||||
$cfg['Servers'][$i]['auth_type'] = 'config';
|
||||
$cfg['Servers'][$i]['user'] = $_ENV['PMA_USER'];
|
||||
$cfg['Servers'][$i]['password'] = isset($_ENV['PMA_PASSWORD']) ? $_ENV['PMA_PASSWORD'] : '';
|
||||
} else {
|
||||
$cfg['Servers'][$i]['auth_type'] = 'cookie';
|
||||
}
|
||||
if (isset($_ENV['PMA_PMADB'])) {
|
||||
$cfg['Servers'][$i]['pmadb'] = $_ENV['PMA_PMADB'];
|
||||
$cfg['Servers'][$i]['relation'] = 'pma__relation';
|
||||
$cfg['Servers'][$i]['table_info'] = 'pma__table_info';
|
||||
$cfg['Servers'][$i]['table_coords'] = 'pma__table_coords';
|
||||
$cfg['Servers'][$i]['pdf_pages'] = 'pma__pdf_pages';
|
||||
$cfg['Servers'][$i]['column_info'] = 'pma__column_info';
|
||||
$cfg['Servers'][$i]['bookmarktable'] = 'pma__bookmark';
|
||||
$cfg['Servers'][$i]['history'] = 'pma__history';
|
||||
$cfg['Servers'][$i]['recent'] = 'pma__recent';
|
||||
$cfg['Servers'][$i]['favorite'] = 'pma__favorite';
|
||||
$cfg['Servers'][$i]['table_uiprefs'] = 'pma__table_uiprefs';
|
||||
$cfg['Servers'][$i]['tracking'] = 'pma__tracking';
|
||||
$cfg['Servers'][$i]['userconfig'] = 'pma__userconfig';
|
||||
$cfg['Servers'][$i]['users'] = 'pma__users';
|
||||
$cfg['Servers'][$i]['usergroups'] = 'pma__usergroups';
|
||||
$cfg['Servers'][$i]['navigationhiding'] = 'pma__navigationhiding';
|
||||
$cfg['Servers'][$i]['savedsearches'] = 'pma__savedsearches';
|
||||
$cfg['Servers'][$i]['central_columns'] = 'pma__central_columns';
|
||||
$cfg['Servers'][$i]['designer_settings'] = 'pma__designer_settings';
|
||||
$cfg['Servers'][$i]['export_templates'] = 'pma__export_templates';
|
||||
}
|
||||
if (isset($_ENV['PMA_CONTROLHOST'])) {
|
||||
$cfg['Servers'][$i]['controlhost'] = $_ENV['PMA_CONTROLHOST'];
|
||||
}
|
||||
if (isset($_ENV['PMA_CONTROLPORT'])) {
|
||||
$cfg['Servers'][$i]['controlport'] = $_ENV['PMA_CONTROLPORT'];
|
||||
}
|
||||
if (isset($_ENV['PMA_CONTROLUSER'])) {
|
||||
$cfg['Servers'][$i]['controluser'] = $_ENV['PMA_CONTROLUSER'];
|
||||
}
|
||||
if (isset($_ENV['PMA_CONTROLPASS'])) {
|
||||
$cfg['Servers'][$i]['controlpass'] = $_ENV['PMA_CONTROLPASS'];
|
||||
}
|
||||
$cfg['Servers'][$i]['compress'] = false;
|
||||
$cfg['Servers'][$i]['AllowNoPassword'] = true;
|
||||
}
|
||||
for ($i = 1; isset($sockets[$i - 1]); $i++) {
|
||||
$cfg['Servers'][$i]['socket'] = $sockets[$i - 1];
|
||||
$cfg['Servers'][$i]['host'] = 'localhost';
|
||||
}
|
||||
/*
|
||||
* Revert back to last configured server to make
|
||||
* it easier in config.user.inc.php
|
||||
*/
|
||||
$i--;
|
||||
|
||||
/* Uploads setup */
|
||||
$cfg['UploadDir'] = '';
|
||||
$cfg['SaveDir'] = '';
|
||||
|
||||
/* Include User Defined Settings Hook */
|
||||
if (file_exists('/etc/phpmyadmin/config.user.inc.php')) {
|
||||
include('/etc/phpmyadmin/config.user.inc.php');
|
||||
}
|
||||
+10
-13
@@ -1,21 +1,19 @@
|
||||
version: '2'
|
||||
|
||||
services:
|
||||
mariadb:
|
||||
image: mariadb:latest
|
||||
container_name: phpmyadmin_testing_mariadb
|
||||
db_server:
|
||||
image: ${DB}
|
||||
container_name: phpmyadmin_testing_db
|
||||
environment:
|
||||
- MYSQL_ROOT_PASSWORD=test123
|
||||
|
||||
mysql:
|
||||
image: mysql:latest
|
||||
container_name: phpmyadmin_testing_mysql
|
||||
environment:
|
||||
- MYSQL_ROOT_PASSWORD=test123
|
||||
- MYSQL_ROOT_PASSWORD=${TESTSUITE_PASSWORD}
|
||||
volumes:
|
||||
- ./testing/testing.cnf:/etc/mysql/conf.d/testing.cnf:ro
|
||||
|
||||
phpmyadmin:
|
||||
build:
|
||||
context: testing/
|
||||
links:
|
||||
- db_server:db_server
|
||||
container_name: phpmyadmin_testing
|
||||
volumes:
|
||||
- /sessions
|
||||
@@ -23,7 +21,6 @@ services:
|
||||
- 8090:80
|
||||
environment:
|
||||
- PMA_ARBITRARY=1
|
||||
- TESTSUITE_PASSWORD=test123
|
||||
- TESTSUITE_PASSWORD=${TESTSUITE_PASSWORD}
|
||||
depends_on:
|
||||
- mariadb
|
||||
- mysql
|
||||
- db_server
|
||||
|
||||
Executable
+50
@@ -0,0 +1,50 @@
|
||||
#!/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
|
||||
|
||||
chown www-data:www-data /sessions /var/nginx/client_body_temp
|
||||
|
||||
if ! [ -e index.php -a -e db_designer.php ]; then
|
||||
echo >&2 "phpMyAdmin not found in $PWD - copying now..."
|
||||
if [ "$(ls -A)" ]; then
|
||||
echo >&2 "WARNING: $PWD is not empty - press Ctrl+C now if this is an error!"
|
||||
( set -x; ls -A; sleep 10 )
|
||||
fi
|
||||
tar --create \
|
||||
--file - \
|
||||
--one-file-system \
|
||||
--directory /usr/src/phpmyadmin \
|
||||
--owner "$user" --group "$group" \
|
||||
. | tar --extract --file -
|
||||
echo >&2 "Complete! phpMyAdmin has been successfully copied to $PWD"
|
||||
mkdir -p tmp; \
|
||||
chmod -R 777 tmp; \
|
||||
fi
|
||||
|
||||
if [ ! -f /etc/phpmyadmin/config.secret.inc.php ]; then
|
||||
cat > /etc/phpmyadmin/config.secret.inc.php <<EOT
|
||||
<?php
|
||||
\$cfg['blowfish_secret'] = '$(tr -dc 'a-zA-Z0-9~!@#$%^&*_()+}{?></";.,[]=-' < /dev/urandom | fold -w 32 | head -n 1)';
|
||||
EOT
|
||||
fi
|
||||
|
||||
if [ ! -f /etc/phpmyadmin/config.user.inc.php ]; then
|
||||
touch /etc/phpmyadmin/config.user.inc.php
|
||||
fi
|
||||
fi
|
||||
|
||||
exec "$@"
|
||||
-130
@@ -1,130 +0,0 @@
|
||||
user nobody;
|
||||
worker_processes 4;
|
||||
|
||||
daemon off;
|
||||
|
||||
pid /nginx.pid;
|
||||
|
||||
error_log /var/log/nginx-error.log;
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
types {
|
||||
text/html html htm shtml;
|
||||
text/css css;
|
||||
text/xml xml;
|
||||
image/gif gif;
|
||||
image/jpeg jpeg jpg;
|
||||
application/javascript js;
|
||||
application/atom+xml atom;
|
||||
application/rss+xml rss;
|
||||
}
|
||||
|
||||
default_type application/octet-stream;
|
||||
|
||||
sendfile on;
|
||||
tcp_nopush on;
|
||||
tcp_nodelay on;
|
||||
|
||||
client_body_timeout 12;
|
||||
client_header_timeout 12;
|
||||
keepalive_timeout 15;
|
||||
send_timeout 10;
|
||||
server_tokens off;
|
||||
|
||||
client_body_buffer_size 512K;
|
||||
client_body_temp_path /var/nginx/client_body_temp;
|
||||
client_header_buffer_size 16k;
|
||||
client_max_body_size 512M;
|
||||
large_client_header_buffers 4 8k;
|
||||
|
||||
gzip on;
|
||||
gzip_comp_level 2;
|
||||
gzip_min_length 1000;
|
||||
gzip_proxied expired no-cache no-store private auth;
|
||||
gzip_types text/plain application/x-javascript text/xml text/css application/xml;
|
||||
|
||||
access_log off;
|
||||
|
||||
server {
|
||||
listen 80 default_server;
|
||||
server_name _;
|
||||
|
||||
root /www;
|
||||
|
||||
index index.php index.html index.htm;
|
||||
|
||||
charset utf-8;
|
||||
|
||||
if ($request_method !~ ^(GET|HEAD|POST)$ ) {
|
||||
return 405;
|
||||
}
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ =404;
|
||||
}
|
||||
|
||||
location ~* .(jpg|jpeg|png|gif|ico|css|js)$ {
|
||||
expires 365d;
|
||||
}
|
||||
|
||||
location ~ \.php$ {
|
||||
fastcgi_intercept_errors on;
|
||||
fastcgi_pass unix:/var/run/php/php-fpm.sock;
|
||||
|
||||
# regex to split $uri to $fastcgi_script_name and $fastcgi_path
|
||||
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
||||
|
||||
# Check that the PHP script exists before passing it
|
||||
try_files $fastcgi_script_name =404;
|
||||
|
||||
# Bypass the fact that try_files resets $fastcgi_path_info
|
||||
# see: https://trac.nginx.org/nginx/ticket/321
|
||||
set $path_info $fastcgi_path_info;
|
||||
fastcgi_param PATH_INFO $path_info;
|
||||
|
||||
fastcgi_read_timeout 1200;
|
||||
fastcgi_buffering off;
|
||||
|
||||
fastcgi_index index.php;
|
||||
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
fastcgi_param QUERY_STRING $query_string;
|
||||
fastcgi_param REQUEST_METHOD $request_method;
|
||||
fastcgi_param CONTENT_TYPE $content_type;
|
||||
fastcgi_param CONTENT_LENGTH $content_length;
|
||||
|
||||
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
|
||||
fastcgi_param REQUEST_URI $request_uri;
|
||||
fastcgi_param DOCUMENT_URI $document_uri;
|
||||
fastcgi_param DOCUMENT_ROOT $document_root;
|
||||
fastcgi_param SERVER_PROTOCOL $server_protocol;
|
||||
fastcgi_param REQUEST_SCHEME $scheme;
|
||||
fastcgi_param HTTPS $https if_not_empty;
|
||||
|
||||
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
|
||||
fastcgi_param SERVER_SOFTWARE nginx;
|
||||
|
||||
fastcgi_param REMOTE_ADDR $remote_addr;
|
||||
fastcgi_param REMOTE_PORT $remote_port;
|
||||
fastcgi_param SERVER_ADDR $server_addr;
|
||||
fastcgi_param SERVER_PORT $server_port;
|
||||
fastcgi_param SERVER_NAME $server_name;
|
||||
|
||||
# PHP only, required if PHP was built with --enable-force-cgi-redirect
|
||||
fastcgi_param REDIRECT_STATUS 200;
|
||||
}
|
||||
|
||||
location ~ /\. {
|
||||
deny all;
|
||||
}
|
||||
|
||||
location ~ /(libraries|templates) {
|
||||
deny all;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
[global]
|
||||
error_log = /var/log/php-fpm.log
|
||||
log_level = warning
|
||||
|
||||
[www]
|
||||
user = nobody
|
||||
group = nobody
|
||||
listen = /var/run/php/php-fpm.sock
|
||||
listen.mode = 0660
|
||||
chdir = /www
|
||||
pm = dynamic
|
||||
pm.max_children = 5
|
||||
pm.start_servers = 2
|
||||
pm.min_spare_servers = 1
|
||||
pm.max_spare_servers = 3
|
||||
catch_workers_output = Yes
|
||||
clear_env = No
|
||||
-1918
File diff suppressed because it is too large
Load Diff
@@ -1,79 +0,0 @@
|
||||
<?php
|
||||
|
||||
require('/etc/phpmyadmin/config.secret.inc.php');
|
||||
|
||||
/* Ensure we got the environment */
|
||||
$vars = array(
|
||||
'PMA_ARBITRARY',
|
||||
'PMA_HOST',
|
||||
'PMA_HOSTS',
|
||||
'PMA_VERBOSE',
|
||||
'PMA_VERBOSES',
|
||||
'PMA_PORT',
|
||||
'PMA_PORTS',
|
||||
'PMA_USER',
|
||||
'PMA_PASSWORD',
|
||||
'PMA_ABSOLUTE_URI'
|
||||
);
|
||||
foreach ($vars as $var) {
|
||||
$env = getenv($var);
|
||||
if (!isset($_ENV[$var]) && $env !== false) {
|
||||
$_ENV[$var] = $env;
|
||||
}
|
||||
}
|
||||
|
||||
/* Arbitrary server connection */
|
||||
if (isset($_ENV['PMA_ARBITRARY']) && $_ENV['PMA_ARBITRARY'] === '1') {
|
||||
$cfg['AllowArbitraryServer'] = true;
|
||||
}
|
||||
|
||||
/* Play nice behind reverse proxys */
|
||||
if (isset($_ENV['PMA_ABSOLUTE_URI'])) {
|
||||
$cfg['PmaAbsoluteUri'] = trim($_ENV['PMA_ABSOLUTE_URI']);
|
||||
}
|
||||
|
||||
/* Figure out hosts */
|
||||
|
||||
/* Fallback to default linked */
|
||||
$hosts = array('db');
|
||||
|
||||
/* Set by environment */
|
||||
if (!empty($_ENV['PMA_HOST'])) {
|
||||
$hosts = array($_ENV['PMA_HOST']);
|
||||
$verbose = array($_ENV['PMA_VERBOSE']);
|
||||
$ports = array($_ENV['PMA_PORT']);
|
||||
} elseif (!empty($_ENV['PMA_HOSTS'])) {
|
||||
$hosts = explode(',', $_ENV['PMA_HOSTS']);
|
||||
$verbose = explode(',', $_ENV['PMA_VERBOSES']);
|
||||
$ports = explode(',', $_ENV['PMA_PORTS']);
|
||||
}
|
||||
|
||||
/* Server settings */
|
||||
for ($i = 1; isset($hosts[$i - 1]); $i++) {
|
||||
$cfg['Servers'][$i]['host'] = $hosts[$i - 1];
|
||||
if (isset($verbose[$i - 1])) {
|
||||
$cfg['Servers'][$i]['verbose'] = $verbose[$i - 1];
|
||||
}
|
||||
if (isset($ports[$i - 1])) {
|
||||
$cfg['Servers'][$i]['port'] = $ports[$i - 1];
|
||||
}
|
||||
if (isset($_ENV['PMA_USER'])) {
|
||||
$cfg['Servers'][$i]['auth_type'] = 'config';
|
||||
$cfg['Servers'][$i]['user'] = $_ENV['PMA_USER'];
|
||||
$cfg['Servers'][$i]['password'] = isset($_ENV['PMA_PASSWORD']) ? $_ENV['PMA_PASSWORD'] : '';
|
||||
} else {
|
||||
$cfg['Servers'][$i]['auth_type'] = 'cookie';
|
||||
}
|
||||
$cfg['Servers'][$i]['connect_type'] = 'tcp';
|
||||
$cfg['Servers'][$i]['compress'] = false;
|
||||
$cfg['Servers'][$i]['AllowNoPassword'] = true;
|
||||
}
|
||||
|
||||
/* Uploads setup */
|
||||
$cfg['UploadDir'] = '';
|
||||
$cfg['SaveDir'] = '';
|
||||
|
||||
/* Include User Defined Settings Hook */
|
||||
if (file_exists('/etc/phpmyadmin/config.user.inc.php')) {
|
||||
include('/etc/phpmyadmin/config.user.inc.php');
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
[program:nginx]
|
||||
command=nginx -c /etc/nginx.conf
|
||||
autostart=true
|
||||
autorestart=true
|
||||
priority=2
|
||||
startretries=3
|
||||
stopwaitsecs=10
|
||||
stdout_logfile=/dev/stdout
|
||||
stdout_logfile_maxbytes=0
|
||||
stderr_logfile=/dev/stderr
|
||||
stderr_logfile_maxbytes=0
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
[program:php-fpm]
|
||||
command=php-fpm7 --nodaemonize --fpm-config /etc/php-fpm.conf -c /etc/php.ini
|
||||
user=nobody
|
||||
autostart=true
|
||||
autorestart=true
|
||||
priority=1
|
||||
startretries=3
|
||||
stopwaitsecs=10
|
||||
stdout_logfile=/dev/stdout
|
||||
stdout_logfile_maxbytes=0
|
||||
stderr_logfile=/dev/stderr
|
||||
stderr_logfile_maxbytes=0
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
FROM php:7.2-fpm-alpine
|
||||
|
||||
# docker-entrypoint.sh dependencies
|
||||
RUN apk add --no-cache \
|
||||
bash
|
||||
|
||||
# Install dependencies
|
||||
RUN set -ex; \
|
||||
\
|
||||
apk add --no-cache --virtual .build-deps \
|
||||
bzip2-dev \
|
||||
freetype-dev \
|
||||
libjpeg-turbo-dev \
|
||||
libpng-dev \
|
||||
libwebp-dev \
|
||||
libxpm-dev \
|
||||
; \
|
||||
\
|
||||
docker-php-ext-configure gd --with-freetype-dir=/usr --with-jpeg-dir=/usr --with-webp-dir=/usr --with-png-dir=/usr --with-xpm-dir=/usr; \
|
||||
docker-php-ext-install bz2 gd mysqli opcache zip; \
|
||||
\
|
||||
runDeps="$( \
|
||||
scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/lib/php/extensions \
|
||||
| tr ',' '\n' \
|
||||
| sort -u \
|
||||
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
|
||||
)"; \
|
||||
apk add --virtual .phpmyadmin-phpexts-rundeps $runDeps; \
|
||||
apk del .build-deps
|
||||
|
||||
# set recommended PHP.ini settings
|
||||
# see https://secure.php.net/manual/en/opcache.installation.php
|
||||
RUN { \
|
||||
echo 'opcache.memory_consumption=128'; \
|
||||
echo 'opcache.interned_strings_buffer=8'; \
|
||||
echo 'opcache.max_accelerated_files=4000'; \
|
||||
echo 'opcache.revalidate_freq=2'; \
|
||||
echo 'opcache.fast_shutdown=1'; \
|
||||
echo 'opcache.enable_cli=1'; \
|
||||
} > /usr/local/etc/php/conf.d/opcache-recommended.ini; \
|
||||
\
|
||||
{ \
|
||||
echo 'session.cookie_httponly = 1'; \
|
||||
echo 'session.use_strict_mode = 1'; \
|
||||
} > /usr/local/etc/php/conf.d/session-strict.ini; \
|
||||
\
|
||||
{ \
|
||||
echo 'allow_url_fopen = Off'; \
|
||||
echo 'max_execution_time = 600'; \
|
||||
echo 'memory_limit = 512M'; \
|
||||
} > /usr/local/etc/php/conf.d/phpmyadmin-misc.ini
|
||||
|
||||
# Calculate download URL
|
||||
ENV VERSION 4.9.1
|
||||
ENV URL https://files.phpmyadmin.net/phpMyAdmin/${VERSION}/phpMyAdmin-${VERSION}-all-languages.tar.xz
|
||||
LABEL version=$VERSION
|
||||
|
||||
# Download tarball, verify it using gpg and extract
|
||||
RUN set -ex; \
|
||||
apk add --no-cache --virtual .fetch-deps \
|
||||
gnupg \
|
||||
; \
|
||||
\
|
||||
export GNUPGHOME="$(mktemp -d)"; \
|
||||
export GPGKEY="3D06A59ECE730EB71B511C17CE752F178259BD92"; \
|
||||
curl --output phpMyAdmin.tar.xz --location $URL; \
|
||||
curl --output phpMyAdmin.tar.xz.asc --location $URL.asc; \
|
||||
gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPGKEY" \
|
||||
|| gpg --batch --keyserver ipv4.pool.sks-keyservers.net --recv-keys "$GPGKEY" \
|
||||
|| gpg --batch --keyserver keys.gnupg.net --recv-keys "$GPGKEY" \
|
||||
|| gpg --batch --keyserver pgp.mit.edu --recv-keys "$GPGKEY" \
|
||||
|| gpg --batch --keyserver keyserver.pgp.com --recv-keys "$GPGKEY"; \
|
||||
gpg --batch --verify phpMyAdmin.tar.xz.asc phpMyAdmin.tar.xz; \
|
||||
tar -xf phpMyAdmin.tar.xz -C /usr/src; \
|
||||
gpgconf --kill all; \
|
||||
rm -r "$GNUPGHOME" phpMyAdmin.tar.xz phpMyAdmin.tar.xz.asc; \
|
||||
mv /usr/src/phpMyAdmin-$VERSION-all-languages /usr/src/phpmyadmin; \
|
||||
rm -rf /usr/src/phpmyadmin/setup/ /usr/src/phpmyadmin/examples/ /usr/src/phpmyadmin/test/ /usr/src/phpmyadmin/po/ /usr/src/phpmyadmin/composer.json /usr/src/phpmyadmin/RELEASE-DATE-$VERSION; \
|
||||
sed -i "s@define('CONFIG_DIR'.*@define('CONFIG_DIR', '/etc/phpmyadmin/');@" /usr/src/phpmyadmin/libraries/vendor_config.php; \
|
||||
# Add directory for sessions to allow session persistence
|
||||
mkdir /sessions; \
|
||||
mkdir -p /var/nginx/client_body_temp; \
|
||||
apk del .fetch-deps
|
||||
|
||||
# Copy configuration
|
||||
COPY config.inc.php /etc/phpmyadmin/config.inc.php
|
||||
|
||||
# Copy main script
|
||||
COPY docker-entrypoint.sh /docker-entrypoint.sh
|
||||
|
||||
ENTRYPOINT [ "/docker-entrypoint.sh" ]
|
||||
CMD ["php-fpm"]
|
||||
@@ -0,0 +1,137 @@
|
||||
<?php
|
||||
|
||||
require('/etc/phpmyadmin/config.secret.inc.php');
|
||||
|
||||
/* Ensure we got the environment */
|
||||
$vars = array(
|
||||
'PMA_ARBITRARY',
|
||||
'PMA_HOST',
|
||||
'PMA_HOSTS',
|
||||
'PMA_VERBOSE',
|
||||
'PMA_VERBOSES',
|
||||
'PMA_PORT',
|
||||
'PMA_PORTS',
|
||||
'PMA_SOCKET',
|
||||
'PMA_SOCKETS',
|
||||
'PMA_USER',
|
||||
'PMA_PASSWORD',
|
||||
'PMA_ABSOLUTE_URI',
|
||||
'PMA_CONTROLHOST',
|
||||
'PMA_CONTROLPORT',
|
||||
'PMA_PMADB',
|
||||
'PMA_CONTROLUSER',
|
||||
'PMA_CONTROLPASS',
|
||||
'PMA_QUERYHISTORYDB'
|
||||
);
|
||||
foreach ($vars as $var) {
|
||||
$env = getenv($var);
|
||||
if (!isset($_ENV[$var]) && $env !== false) {
|
||||
$_ENV[$var] = $env;
|
||||
}
|
||||
}
|
||||
if (isset($_ENV['PMA_QUERYHISTORYDB'])) {
|
||||
$cfg['QueryHistoryDB'] = boolval($_ENV['PMA_QUERYHISTORYDB']);
|
||||
}
|
||||
|
||||
/* Arbitrary server connection */
|
||||
if (isset($_ENV['PMA_ARBITRARY']) && $_ENV['PMA_ARBITRARY'] === '1') {
|
||||
$cfg['AllowArbitraryServer'] = true;
|
||||
}
|
||||
|
||||
/* Play nice behind reverse proxys */
|
||||
if (isset($_ENV['PMA_ABSOLUTE_URI'])) {
|
||||
$cfg['PmaAbsoluteUri'] = trim($_ENV['PMA_ABSOLUTE_URI']);
|
||||
}
|
||||
|
||||
/* Figure out hosts */
|
||||
|
||||
/* Fallback to default linked */
|
||||
$hosts = array('db');
|
||||
|
||||
/* Set by environment */
|
||||
if (!empty($_ENV['PMA_HOST'])) {
|
||||
$hosts = array($_ENV['PMA_HOST']);
|
||||
$verbose = array($_ENV['PMA_VERBOSE']);
|
||||
$ports = array($_ENV['PMA_PORT']);
|
||||
} elseif (!empty($_ENV['PMA_HOSTS'])) {
|
||||
$hosts = array_map('trim', explode(',', $_ENV['PMA_HOSTS']));
|
||||
$verbose = array_map('trim', explode(',', $_ENV['PMA_VERBOSES']));
|
||||
$ports = array_map('trim', explode(',', $_ENV['PMA_PORTS']));
|
||||
}
|
||||
if (!empty($_ENV['PMA_SOCKET'])) {
|
||||
$sockets = array($_ENV['PMA_SOCKET']);
|
||||
} elseif (!empty($_ENV['PMA_SOCKETS'])) {
|
||||
$sockets = explode(',', $_ENV['PMA_SOCKETS']);
|
||||
}
|
||||
|
||||
/* Server settings */
|
||||
for ($i = 1; isset($hosts[$i - 1]); $i++) {
|
||||
$cfg['Servers'][$i]['host'] = $hosts[$i - 1];
|
||||
if (isset($verbose[$i - 1])) {
|
||||
$cfg['Servers'][$i]['verbose'] = $verbose[$i - 1];
|
||||
}
|
||||
if (isset($ports[$i - 1])) {
|
||||
$cfg['Servers'][$i]['port'] = $ports[$i - 1];
|
||||
}
|
||||
if (isset($_ENV['PMA_USER'])) {
|
||||
$cfg['Servers'][$i]['auth_type'] = 'config';
|
||||
$cfg['Servers'][$i]['user'] = $_ENV['PMA_USER'];
|
||||
$cfg['Servers'][$i]['password'] = isset($_ENV['PMA_PASSWORD']) ? $_ENV['PMA_PASSWORD'] : '';
|
||||
} else {
|
||||
$cfg['Servers'][$i]['auth_type'] = 'cookie';
|
||||
}
|
||||
if (isset($_ENV['PMA_PMADB'])) {
|
||||
$cfg['Servers'][$i]['pmadb'] = $_ENV['PMA_PMADB'];
|
||||
$cfg['Servers'][$i]['relation'] = 'pma__relation';
|
||||
$cfg['Servers'][$i]['table_info'] = 'pma__table_info';
|
||||
$cfg['Servers'][$i]['table_coords'] = 'pma__table_coords';
|
||||
$cfg['Servers'][$i]['pdf_pages'] = 'pma__pdf_pages';
|
||||
$cfg['Servers'][$i]['column_info'] = 'pma__column_info';
|
||||
$cfg['Servers'][$i]['bookmarktable'] = 'pma__bookmark';
|
||||
$cfg['Servers'][$i]['history'] = 'pma__history';
|
||||
$cfg['Servers'][$i]['recent'] = 'pma__recent';
|
||||
$cfg['Servers'][$i]['favorite'] = 'pma__favorite';
|
||||
$cfg['Servers'][$i]['table_uiprefs'] = 'pma__table_uiprefs';
|
||||
$cfg['Servers'][$i]['tracking'] = 'pma__tracking';
|
||||
$cfg['Servers'][$i]['userconfig'] = 'pma__userconfig';
|
||||
$cfg['Servers'][$i]['users'] = 'pma__users';
|
||||
$cfg['Servers'][$i]['usergroups'] = 'pma__usergroups';
|
||||
$cfg['Servers'][$i]['navigationhiding'] = 'pma__navigationhiding';
|
||||
$cfg['Servers'][$i]['savedsearches'] = 'pma__savedsearches';
|
||||
$cfg['Servers'][$i]['central_columns'] = 'pma__central_columns';
|
||||
$cfg['Servers'][$i]['designer_settings'] = 'pma__designer_settings';
|
||||
$cfg['Servers'][$i]['export_templates'] = 'pma__export_templates';
|
||||
}
|
||||
if (isset($_ENV['PMA_CONTROLHOST'])) {
|
||||
$cfg['Servers'][$i]['controlhost'] = $_ENV['PMA_CONTROLHOST'];
|
||||
}
|
||||
if (isset($_ENV['PMA_CONTROLPORT'])) {
|
||||
$cfg['Servers'][$i]['controlport'] = $_ENV['PMA_CONTROLPORT'];
|
||||
}
|
||||
if (isset($_ENV['PMA_CONTROLUSER'])) {
|
||||
$cfg['Servers'][$i]['controluser'] = $_ENV['PMA_CONTROLUSER'];
|
||||
}
|
||||
if (isset($_ENV['PMA_CONTROLPASS'])) {
|
||||
$cfg['Servers'][$i]['controlpass'] = $_ENV['PMA_CONTROLPASS'];
|
||||
}
|
||||
$cfg['Servers'][$i]['compress'] = false;
|
||||
$cfg['Servers'][$i]['AllowNoPassword'] = true;
|
||||
}
|
||||
for ($i = 1; isset($sockets[$i - 1]); $i++) {
|
||||
$cfg['Servers'][$i]['socket'] = $sockets[$i - 1];
|
||||
$cfg['Servers'][$i]['host'] = 'localhost';
|
||||
}
|
||||
/*
|
||||
* Revert back to last configured server to make
|
||||
* it easier in config.user.inc.php
|
||||
*/
|
||||
$i--;
|
||||
|
||||
/* Uploads setup */
|
||||
$cfg['UploadDir'] = '';
|
||||
$cfg['SaveDir'] = '';
|
||||
|
||||
/* Include User Defined Settings Hook */
|
||||
if (file_exists('/etc/phpmyadmin/config.user.inc.php')) {
|
||||
include('/etc/phpmyadmin/config.user.inc.php');
|
||||
}
|
||||
Executable
+50
@@ -0,0 +1,50 @@
|
||||
#!/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
|
||||
|
||||
chown www-data:www-data /sessions /var/nginx/client_body_temp
|
||||
|
||||
if ! [ -e index.php -a -e db_designer.php ]; then
|
||||
echo >&2 "phpMyAdmin not found in $PWD - copying now..."
|
||||
if [ "$(ls -A)" ]; then
|
||||
echo >&2 "WARNING: $PWD is not empty - press Ctrl+C now if this is an error!"
|
||||
( set -x; ls -A; sleep 10 )
|
||||
fi
|
||||
tar --create \
|
||||
--file - \
|
||||
--one-file-system \
|
||||
--directory /usr/src/phpmyadmin \
|
||||
--owner "$user" --group "$group" \
|
||||
. | tar --extract --file -
|
||||
echo >&2 "Complete! phpMyAdmin has been successfully copied to $PWD"
|
||||
mkdir -p tmp; \
|
||||
chmod -R 777 tmp; \
|
||||
fi
|
||||
|
||||
if [ ! -f /etc/phpmyadmin/config.secret.inc.php ]; then
|
||||
cat > /etc/phpmyadmin/config.secret.inc.php <<EOT
|
||||
<?php
|
||||
\$cfg['blowfish_secret'] = '$(tr -dc 'a-zA-Z0-9~!@#$%^&*_()+}{?></";.,[]=-' < /dev/urandom | fold -w 32 | head -n 1)';
|
||||
EOT
|
||||
fi
|
||||
|
||||
if [ ! -f /etc/phpmyadmin/config.user.inc.php ]; then
|
||||
touch /etc/phpmyadmin/config.user.inc.php
|
||||
fi
|
||||
fi
|
||||
|
||||
exec "$@"
|
||||
+100
@@ -0,0 +1,100 @@
|
||||
FROM php:7.2-fpm
|
||||
|
||||
# Install dependencies
|
||||
RUN set -ex; \
|
||||
\
|
||||
savedAptMark="$(apt-mark showmanual)"; \
|
||||
\
|
||||
apt-get update; \
|
||||
apt-get install -y --no-install-recommends \
|
||||
libbz2-dev \
|
||||
libfreetype6-dev \
|
||||
libjpeg-dev \
|
||||
libpng-dev \
|
||||
libwebp-dev \
|
||||
libxpm-dev \
|
||||
; \
|
||||
\
|
||||
docker-php-ext-configure gd --with-freetype-dir=/usr --with-jpeg-dir=/usr --with-webp-dir=/usr --with-png-dir=/usr --with-xpm-dir=/usr; \
|
||||
docker-php-ext-install bz2 gd mysqli opcache zip; \
|
||||
\
|
||||
apt-mark auto '.*' > /dev/null; \
|
||||
apt-mark manual $savedAptMark; \
|
||||
ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \
|
||||
| awk '/=>/ { print $3 }' \
|
||||
| sort -u \
|
||||
| xargs -r dpkg-query -S \
|
||||
| cut -d: -f1 \
|
||||
| sort -u \
|
||||
| xargs -rt apt-mark manual; \
|
||||
\
|
||||
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# set recommended PHP.ini settings
|
||||
# see https://secure.php.net/manual/en/opcache.installation.php
|
||||
RUN { \
|
||||
echo 'opcache.memory_consumption=128'; \
|
||||
echo 'opcache.interned_strings_buffer=8'; \
|
||||
echo 'opcache.max_accelerated_files=4000'; \
|
||||
echo 'opcache.revalidate_freq=2'; \
|
||||
echo 'opcache.fast_shutdown=1'; \
|
||||
echo 'opcache.enable_cli=1'; \
|
||||
} > /usr/local/etc/php/conf.d/opcache-recommended.ini; \
|
||||
\
|
||||
{ \
|
||||
echo 'session.cookie_httponly = 1'; \
|
||||
echo 'session.use_strict_mode = 1'; \
|
||||
} > /usr/local/etc/php/conf.d/session-strict.ini; \
|
||||
\
|
||||
{ \
|
||||
echo 'allow_url_fopen = Off'; \
|
||||
echo 'max_execution_time = 600'; \
|
||||
echo 'memory_limit = 512M'; \
|
||||
} > /usr/local/etc/php/conf.d/phpmyadmin-misc.ini
|
||||
|
||||
# Calculate download URL
|
||||
ENV VERSION 4.9.1
|
||||
ENV URL https://files.phpmyadmin.net/phpMyAdmin/${VERSION}/phpMyAdmin-${VERSION}-all-languages.tar.xz
|
||||
LABEL version=$VERSION
|
||||
|
||||
# Download tarball, verify it using gpg and extract
|
||||
RUN set -ex; \
|
||||
fetchDeps=" \
|
||||
gnupg \
|
||||
dirmngr \
|
||||
"; \
|
||||
apt-get update; \
|
||||
apt-get install -y --no-install-recommends $fetchDeps; \
|
||||
\
|
||||
export GNUPGHOME="$(mktemp -d)"; \
|
||||
export GPGKEY="3D06A59ECE730EB71B511C17CE752F178259BD92"; \
|
||||
curl --output phpMyAdmin.tar.xz --location $URL; \
|
||||
curl --output phpMyAdmin.tar.xz.asc --location $URL.asc; \
|
||||
gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPGKEY" \
|
||||
|| gpg --batch --keyserver ipv4.pool.sks-keyservers.net --recv-keys "$GPGKEY" \
|
||||
|| gpg --batch --keyserver keys.gnupg.net --recv-keys "$GPGKEY" \
|
||||
|| gpg --batch --keyserver pgp.mit.edu --recv-keys "$GPGKEY" \
|
||||
|| gpg --batch --keyserver keyserver.pgp.com --recv-keys "$GPGKEY"; \
|
||||
gpg --batch --verify phpMyAdmin.tar.xz.asc phpMyAdmin.tar.xz; \
|
||||
tar -xf phpMyAdmin.tar.xz -C /usr/src; \
|
||||
gpgconf --kill all; \
|
||||
rm -r "$GNUPGHOME" phpMyAdmin.tar.xz phpMyAdmin.tar.xz.asc; \
|
||||
mv /usr/src/phpMyAdmin-$VERSION-all-languages /usr/src/phpmyadmin; \
|
||||
rm -rf /usr/src/phpmyadmin/setup/ /usr/src/phpmyadmin/examples/ /usr/src/phpmyadmin/test/ /usr/src/phpmyadmin/po/ /usr/src/phpmyadmin/composer.json /usr/src/phpmyadmin/RELEASE-DATE-$VERSION; \
|
||||
sed -i "s@define('CONFIG_DIR'.*@define('CONFIG_DIR', '/etc/phpmyadmin/');@" /usr/src/phpmyadmin/libraries/vendor_config.php; \
|
||||
# Add directory for sessions to allow session persistence
|
||||
mkdir /sessions; \
|
||||
mkdir -p /var/nginx/client_body_temp; \
|
||||
\
|
||||
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $fetchDeps; \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Copy configuration
|
||||
COPY config.inc.php /etc/phpmyadmin/config.inc.php
|
||||
|
||||
# Copy main script
|
||||
COPY docker-entrypoint.sh /docker-entrypoint.sh
|
||||
|
||||
ENTRYPOINT [ "/docker-entrypoint.sh" ]
|
||||
CMD ["php-fpm"]
|
||||
@@ -0,0 +1,137 @@
|
||||
<?php
|
||||
|
||||
require('/etc/phpmyadmin/config.secret.inc.php');
|
||||
|
||||
/* Ensure we got the environment */
|
||||
$vars = array(
|
||||
'PMA_ARBITRARY',
|
||||
'PMA_HOST',
|
||||
'PMA_HOSTS',
|
||||
'PMA_VERBOSE',
|
||||
'PMA_VERBOSES',
|
||||
'PMA_PORT',
|
||||
'PMA_PORTS',
|
||||
'PMA_SOCKET',
|
||||
'PMA_SOCKETS',
|
||||
'PMA_USER',
|
||||
'PMA_PASSWORD',
|
||||
'PMA_ABSOLUTE_URI',
|
||||
'PMA_CONTROLHOST',
|
||||
'PMA_CONTROLPORT',
|
||||
'PMA_PMADB',
|
||||
'PMA_CONTROLUSER',
|
||||
'PMA_CONTROLPASS',
|
||||
'PMA_QUERYHISTORYDB'
|
||||
);
|
||||
foreach ($vars as $var) {
|
||||
$env = getenv($var);
|
||||
if (!isset($_ENV[$var]) && $env !== false) {
|
||||
$_ENV[$var] = $env;
|
||||
}
|
||||
}
|
||||
if (isset($_ENV['PMA_QUERYHISTORYDB'])) {
|
||||
$cfg['QueryHistoryDB'] = boolval($_ENV['PMA_QUERYHISTORYDB']);
|
||||
}
|
||||
|
||||
/* Arbitrary server connection */
|
||||
if (isset($_ENV['PMA_ARBITRARY']) && $_ENV['PMA_ARBITRARY'] === '1') {
|
||||
$cfg['AllowArbitraryServer'] = true;
|
||||
}
|
||||
|
||||
/* Play nice behind reverse proxys */
|
||||
if (isset($_ENV['PMA_ABSOLUTE_URI'])) {
|
||||
$cfg['PmaAbsoluteUri'] = trim($_ENV['PMA_ABSOLUTE_URI']);
|
||||
}
|
||||
|
||||
/* Figure out hosts */
|
||||
|
||||
/* Fallback to default linked */
|
||||
$hosts = array('db');
|
||||
|
||||
/* Set by environment */
|
||||
if (!empty($_ENV['PMA_HOST'])) {
|
||||
$hosts = array($_ENV['PMA_HOST']);
|
||||
$verbose = array($_ENV['PMA_VERBOSE']);
|
||||
$ports = array($_ENV['PMA_PORT']);
|
||||
} elseif (!empty($_ENV['PMA_HOSTS'])) {
|
||||
$hosts = array_map('trim', explode(',', $_ENV['PMA_HOSTS']));
|
||||
$verbose = array_map('trim', explode(',', $_ENV['PMA_VERBOSES']));
|
||||
$ports = array_map('trim', explode(',', $_ENV['PMA_PORTS']));
|
||||
}
|
||||
if (!empty($_ENV['PMA_SOCKET'])) {
|
||||
$sockets = array($_ENV['PMA_SOCKET']);
|
||||
} elseif (!empty($_ENV['PMA_SOCKETS'])) {
|
||||
$sockets = explode(',', $_ENV['PMA_SOCKETS']);
|
||||
}
|
||||
|
||||
/* Server settings */
|
||||
for ($i = 1; isset($hosts[$i - 1]); $i++) {
|
||||
$cfg['Servers'][$i]['host'] = $hosts[$i - 1];
|
||||
if (isset($verbose[$i - 1])) {
|
||||
$cfg['Servers'][$i]['verbose'] = $verbose[$i - 1];
|
||||
}
|
||||
if (isset($ports[$i - 1])) {
|
||||
$cfg['Servers'][$i]['port'] = $ports[$i - 1];
|
||||
}
|
||||
if (isset($_ENV['PMA_USER'])) {
|
||||
$cfg['Servers'][$i]['auth_type'] = 'config';
|
||||
$cfg['Servers'][$i]['user'] = $_ENV['PMA_USER'];
|
||||
$cfg['Servers'][$i]['password'] = isset($_ENV['PMA_PASSWORD']) ? $_ENV['PMA_PASSWORD'] : '';
|
||||
} else {
|
||||
$cfg['Servers'][$i]['auth_type'] = 'cookie';
|
||||
}
|
||||
if (isset($_ENV['PMA_PMADB'])) {
|
||||
$cfg['Servers'][$i]['pmadb'] = $_ENV['PMA_PMADB'];
|
||||
$cfg['Servers'][$i]['relation'] = 'pma__relation';
|
||||
$cfg['Servers'][$i]['table_info'] = 'pma__table_info';
|
||||
$cfg['Servers'][$i]['table_coords'] = 'pma__table_coords';
|
||||
$cfg['Servers'][$i]['pdf_pages'] = 'pma__pdf_pages';
|
||||
$cfg['Servers'][$i]['column_info'] = 'pma__column_info';
|
||||
$cfg['Servers'][$i]['bookmarktable'] = 'pma__bookmark';
|
||||
$cfg['Servers'][$i]['history'] = 'pma__history';
|
||||
$cfg['Servers'][$i]['recent'] = 'pma__recent';
|
||||
$cfg['Servers'][$i]['favorite'] = 'pma__favorite';
|
||||
$cfg['Servers'][$i]['table_uiprefs'] = 'pma__table_uiprefs';
|
||||
$cfg['Servers'][$i]['tracking'] = 'pma__tracking';
|
||||
$cfg['Servers'][$i]['userconfig'] = 'pma__userconfig';
|
||||
$cfg['Servers'][$i]['users'] = 'pma__users';
|
||||
$cfg['Servers'][$i]['usergroups'] = 'pma__usergroups';
|
||||
$cfg['Servers'][$i]['navigationhiding'] = 'pma__navigationhiding';
|
||||
$cfg['Servers'][$i]['savedsearches'] = 'pma__savedsearches';
|
||||
$cfg['Servers'][$i]['central_columns'] = 'pma__central_columns';
|
||||
$cfg['Servers'][$i]['designer_settings'] = 'pma__designer_settings';
|
||||
$cfg['Servers'][$i]['export_templates'] = 'pma__export_templates';
|
||||
}
|
||||
if (isset($_ENV['PMA_CONTROLHOST'])) {
|
||||
$cfg['Servers'][$i]['controlhost'] = $_ENV['PMA_CONTROLHOST'];
|
||||
}
|
||||
if (isset($_ENV['PMA_CONTROLPORT'])) {
|
||||
$cfg['Servers'][$i]['controlport'] = $_ENV['PMA_CONTROLPORT'];
|
||||
}
|
||||
if (isset($_ENV['PMA_CONTROLUSER'])) {
|
||||
$cfg['Servers'][$i]['controluser'] = $_ENV['PMA_CONTROLUSER'];
|
||||
}
|
||||
if (isset($_ENV['PMA_CONTROLPASS'])) {
|
||||
$cfg['Servers'][$i]['controlpass'] = $_ENV['PMA_CONTROLPASS'];
|
||||
}
|
||||
$cfg['Servers'][$i]['compress'] = false;
|
||||
$cfg['Servers'][$i]['AllowNoPassword'] = true;
|
||||
}
|
||||
for ($i = 1; isset($sockets[$i - 1]); $i++) {
|
||||
$cfg['Servers'][$i]['socket'] = $sockets[$i - 1];
|
||||
$cfg['Servers'][$i]['host'] = 'localhost';
|
||||
}
|
||||
/*
|
||||
* Revert back to last configured server to make
|
||||
* it easier in config.user.inc.php
|
||||
*/
|
||||
$i--;
|
||||
|
||||
/* Uploads setup */
|
||||
$cfg['UploadDir'] = '';
|
||||
$cfg['SaveDir'] = '';
|
||||
|
||||
/* Include User Defined Settings Hook */
|
||||
if (file_exists('/etc/phpmyadmin/config.user.inc.php')) {
|
||||
include('/etc/phpmyadmin/config.user.inc.php');
|
||||
}
|
||||
Executable
+50
@@ -0,0 +1,50 @@
|
||||
#!/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
|
||||
|
||||
chown www-data:www-data /sessions /var/nginx/client_body_temp
|
||||
|
||||
if ! [ -e index.php -a -e db_designer.php ]; then
|
||||
echo >&2 "phpMyAdmin not found in $PWD - copying now..."
|
||||
if [ "$(ls -A)" ]; then
|
||||
echo >&2 "WARNING: $PWD is not empty - press Ctrl+C now if this is an error!"
|
||||
( set -x; ls -A; sleep 10 )
|
||||
fi
|
||||
tar --create \
|
||||
--file - \
|
||||
--one-file-system \
|
||||
--directory /usr/src/phpmyadmin \
|
||||
--owner "$user" --group "$group" \
|
||||
. | tar --extract --file -
|
||||
echo >&2 "Complete! phpMyAdmin has been successfully copied to $PWD"
|
||||
mkdir -p tmp; \
|
||||
chmod -R 777 tmp; \
|
||||
fi
|
||||
|
||||
if [ ! -f /etc/phpmyadmin/config.secret.inc.php ]; then
|
||||
cat > /etc/phpmyadmin/config.secret.inc.php <<EOT
|
||||
<?php
|
||||
\$cfg['blowfish_secret'] = '$(tr -dc 'a-zA-Z0-9~!@#$%^&*_()+}{?></";.,[]=-' < /dev/urandom | fold -w 32 | head -n 1)';
|
||||
EOT
|
||||
fi
|
||||
|
||||
if [ ! -f /etc/phpmyadmin/config.user.inc.php ]; then
|
||||
touch /etc/phpmyadmin/config.user.inc.php
|
||||
fi
|
||||
fi
|
||||
|
||||
exec "$@"
|
||||
Executable
+97
@@ -0,0 +1,97 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
self="$(basename "$BASH_SOURCE")"
|
||||
cd "$(dirname "$(readlink -f "$BASH_SOURCE")")"
|
||||
|
||||
# Get the most recent commit which modified any of "$@".
|
||||
fileCommit() {
|
||||
git log -1 --format='format:%H' HEAD -- "$@"
|
||||
}
|
||||
|
||||
# Get the most recent commit which modified "$1/Dockerfile" or any file that
|
||||
# the Dockerfile copies into the rootfs (with COPY).
|
||||
dockerfileCommit() {
|
||||
local dir="$1"; shift
|
||||
(
|
||||
cd "$dir";
|
||||
fileCommit Dockerfile \
|
||||
$(git show HEAD:./Dockerfile | awk '
|
||||
toupper($1) == "COPY" {
|
||||
for (i = 2; i < NF; i++)
|
||||
print $i;
|
||||
}
|
||||
')
|
||||
)
|
||||
}
|
||||
|
||||
# depends on docker library
|
||||
#getArches() {
|
||||
# local repo="$1"; shift
|
||||
# local officialImagesUrl='https://github.com/docker-library/official-images/raw/master/library/'
|
||||
#
|
||||
# eval "declare -g -A parentRepoToArches=( $(
|
||||
# find -name 'Dockerfile' -exec awk '
|
||||
# toupper($1) == "FROM" && $2 !~ /^('"$repo"'|scratch|microsoft\/[^:]+)(:|$)/ {
|
||||
# print "'"$officialImagesUrl"'" $2
|
||||
# }
|
||||
# ' '{}' + \
|
||||
# | sort -u \
|
||||
# | xargs bashbrew cat --format '[{{ .RepoName }}:{{ .TagName }}]="{{ join " " .TagEntry.Architectures }}"'
|
||||
# ) )"
|
||||
#}
|
||||
#getArches 'phpmyadmin'
|
||||
|
||||
# Header.
|
||||
cat <<-EOH
|
||||
# This file is generated via https://github.com/phpmyadmin/docker/blob/$(fileCommit "$self")/$self
|
||||
Maintainers: Isaac Bennetch <bennetch@gmail.com>
|
||||
Michal Čihař <michal@cihar.com>
|
||||
GitRepo: https://github.com/phpmyadmin/docker.git
|
||||
EOH
|
||||
|
||||
# prints "$2$1$3$1...$N"
|
||||
join() {
|
||||
local sep="$1"; shift
|
||||
local out; printf -v out "${sep//%/%%}%s" "$@"
|
||||
echo "${out#$sep}"
|
||||
}
|
||||
|
||||
latest="$(
|
||||
git ls-remote --tags https://github.com/phpmyadmin/phpmyadmin.git \
|
||||
| cut -d/ -f3 \
|
||||
| grep -vE -- '-rc|-b' \
|
||||
| sort -V \
|
||||
| tail -1
|
||||
)"
|
||||
|
||||
for variant in apache fpm fpm-alpine; do
|
||||
commit="$(dockerfileCommit "$variant")"
|
||||
fullversion="$(git show "$commit":"$variant/Dockerfile" | awk '$1 == "ENV" && $2 == "VERSION" { print $3; exit }')"
|
||||
|
||||
versionAliases=( "$fullversion" "${fullversion%.*}" "${fullversion%.*.*}" )
|
||||
if [ "$fullversion" = "$latest" ]; then
|
||||
versionAliases+=( "latest" )
|
||||
fi
|
||||
|
||||
variantAliases=( "${versionAliases[@]/%/-$variant}" )
|
||||
variantAliases=( "${variantAliases[@]//latest-}" )
|
||||
|
||||
if [ "$variant" = "apache" ]; then
|
||||
variantAliases+=( "${versionAliases[@]}" )
|
||||
fi
|
||||
|
||||
variantParent="$(awk 'toupper($1) == "FROM" { print $2 }' "$variant/Dockerfile")"
|
||||
|
||||
# depends on docker library
|
||||
#variantArches="${parentRepoToArches[$variantParent]}"
|
||||
variantArches="amd64 arm32v7 arm64v8 i386 ppc64le"
|
||||
|
||||
cat <<-EOE
|
||||
|
||||
Tags: $(join ', ' "${variantAliases[@]}")
|
||||
Architectures: $(join ', ' $variantArches)
|
||||
GitCommit: $commit
|
||||
Directory: $variant
|
||||
EOE
|
||||
done
|
||||
Binary file not shown.
@@ -1,22 +0,0 @@
|
||||
#!/bin/sh
|
||||
if [ ! -f /etc/phpmyadmin/config.secret.inc.php ] ; then
|
||||
cat > /etc/phpmyadmin/config.secret.inc.php <<EOT
|
||||
<?php
|
||||
\$cfg['blowfish_secret'] = '$(tr -dc 'a-zA-Z0-9~!@#$%^&*_()+}{?></";.,[]=-' < /dev/urandom | fold -w 32 | head -n 1)';
|
||||
EOT
|
||||
fi
|
||||
|
||||
if [ ! -f /etc/phpmyadmin/config.user.inc.php ] ; then
|
||||
touch /etc/phpmyadmin/config.user.inc.php
|
||||
fi
|
||||
|
||||
mkdir -p /var/nginx/client_body_temp
|
||||
chown nobody:nobody /sessions /var/nginx/client_body_temp
|
||||
mkdir -p /var/run/php/
|
||||
chown nobody:nobody /var/run/php/
|
||||
touch /var/log/php-fpm.log
|
||||
chown nobody:nobody /var/log/php-fpm.log
|
||||
|
||||
if [ "$1" = 'phpmyadmin' ]; then
|
||||
exec supervisord --nodaemon --configuration="/etc/supervisord.conf" --loglevel=info
|
||||
fi
|
||||
+9
-3
@@ -3,8 +3,14 @@
|
||||
FROM phpmyadmin/phpmyadmin
|
||||
|
||||
# Install test dependencies
|
||||
RUN apk add --no-cache curl py2-pip
|
||||
RUN pip install mechanize html5lib
|
||||
RUN set -ex; \
|
||||
\
|
||||
apt-get update; \
|
||||
apt-get install -y --no-install-recommends \
|
||||
curl \
|
||||
python-pip \
|
||||
; \
|
||||
pip install mechanize html5lib; \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY test-mariadb.ini test-mysql.ini /etc/supervisor.d/
|
||||
COPY phpmyadmin_test.py test-docker.sh world.sql /
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python2
|
||||
import argparse
|
||||
import os
|
||||
import re
|
||||
@@ -15,7 +15,9 @@ def test_content(match, content):
|
||||
|
||||
def test_phpmyadmin(url, username, password, server=None, sqlfile=None):
|
||||
if sqlfile is None:
|
||||
if os.path.exists('./world.sql'):
|
||||
if os.path.exists('/world.sql'):
|
||||
sqlfile = '/world.sql'
|
||||
elif os.path.exists('./world.sql'):
|
||||
sqlfile = './world.sql'
|
||||
else:
|
||||
sqlfile = './testing/world.sql'
|
||||
|
||||
+37
-40
@@ -19,72 +19,69 @@ PHPMYADMIN_HOSTNAME=${TESTSUITE_HOSTNAME:=localhost}
|
||||
PHPMYADMIN_PORT=${TESTSUITE_PORT:=80}
|
||||
PHPMYADMIN_URL=http://$PHPMYADMIN_HOSTNAME:$PORT/
|
||||
|
||||
# Set database environment
|
||||
PHPMYADMIN_DB_HOSTNAME=${PMA_HOST:=localhost}
|
||||
PHPMYADMIN_DB_PORT=${PMA_PORT:=3306}
|
||||
|
||||
# Color text output
|
||||
GREEN="\033[0;32m"
|
||||
RED="\033[0;31m"
|
||||
NC="\033[0m" # No Color
|
||||
|
||||
ret=0
|
||||
# Check if script is running inside container
|
||||
if [ -f /.dockerenv ] ; then
|
||||
echo "Tests running inside container..."
|
||||
# Find test script
|
||||
if [ -f ./phpmyadmin_test.py ] ; then
|
||||
FILENAME=./phpmyadmin_test.py
|
||||
else
|
||||
FILENAME=./testing/phpmyadmin_test.py
|
||||
fi
|
||||
|
||||
# Set database environment
|
||||
PHPMYADMIN_DB_HOSTNAME=${PMA_HOST:=localhost}
|
||||
PHPMYADMIN_DB_PORT=${PMA_PORT:=3306}
|
||||
PHPMYADMIN_DB_URL=http://$PHPMYADMIN_DB_HOSTNAME:$PHPMYADMIN_DB_PORT/
|
||||
# Check if script is running inside container
|
||||
if ! [ -f /.dockerenv ] ; then
|
||||
echo "Tests running outside container..."
|
||||
COMMAND_HOST="docker exec ${NAME}"
|
||||
docker ps -a
|
||||
|
||||
# Wait for database to start
|
||||
TIMEOUT=0
|
||||
while ! curl "$PHPMYADMIN_DB_URL" &>/dev/null; do
|
||||
while [ $(docker logs db_server 2>&1 | fgrep -c "mysqld: ready for connections.") -le 0 ] ; do
|
||||
echo "Waiting for ${PHPMYADMIN_DB_HOSTNAME} database start..."
|
||||
sleep 10
|
||||
TIMEOUT=$((TIMEOUT + 1))
|
||||
if [ $TIMEOUT -gt 3 ] ; then
|
||||
echo "Failed to connect ${PHPMYADMIN_DB_HOSTNAME} database!"
|
||||
echo "Result of ${PHPMYADMIN_DB_HOSTNAME} tests: ${RED}FAILED${NC}"
|
||||
ret=1
|
||||
docker logs ${NAME}
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
# Wait for container to start
|
||||
TIMEOUT=0
|
||||
while [ $(docker logs ${NAME} 2>&1 | fgrep -c "Command line: 'apache2 -D FOREGROUND'") -le 0 ] ; do
|
||||
echo "Waiting for PHPMyAdmin start..."
|
||||
sleep 1
|
||||
TIMEOUT=$((TIMEOUT + 1))
|
||||
if [ $TIMEOUT -gt 10 ] ; then
|
||||
echo "Failed to connect PHPMyAdmin!"
|
||||
echo "Result of ${PHPMYADMIN_DB_HOSTNAME} tests: ${RED}FAILED${NC}"
|
||||
docker logs ${NAME}
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
else
|
||||
echo "Tests running outside container..."
|
||||
docker ps -a
|
||||
COMMAND_HOST="docker exec ${NAME}"
|
||||
echo "Tests running inside container..."
|
||||
FILENAME=/phpmyadmin_test.py
|
||||
fi
|
||||
|
||||
# Wait for container to start
|
||||
TIMEOUT=0
|
||||
while ! $COMMAND_HOST ps aux | grep -q nginx ; do
|
||||
echo "Waiting for PHPMyAdmin start..."
|
||||
sleep 1
|
||||
TIMEOUT=$((TIMEOUT + 1))
|
||||
if [ $TIMEOUT -gt 10 ] ; then
|
||||
echo "Failed to connect PHPMyAdmin!"
|
||||
echo "Result of ${PHPMYADMIN_DB_HOSTNAME} tests: ${RED}FAILED${NC}"
|
||||
ret=1
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
# Perform tests
|
||||
if [ $ret -eq 0 ] ; then
|
||||
if [ -f ./phpmyadmin_test.py ] ; then
|
||||
FILENAME=./phpmyadmin_test.py
|
||||
else
|
||||
FILENAME=./testing/phpmyadmin_test.py
|
||||
fi
|
||||
python $FILENAME --url "$PHPMYADMIN_URL" --username root --password $TESTSUITE_PASSWORD $SERVER
|
||||
ret=$?
|
||||
fi
|
||||
ret=0
|
||||
$FILENAME --url "$PHPMYADMIN_URL" --username root --password $TESTSUITE_PASSWORD $SERVER
|
||||
ret=$?
|
||||
|
||||
# Show debug output in case of failure
|
||||
if [ $ret -ne 0 ] ; then
|
||||
curl "$PHPMYADMIN_URL"
|
||||
$COMMAND_HOST ps faux
|
||||
$COMMAND_HOST cat /var/log/php-fpm.log
|
||||
$COMMAND_HOST cat /var/log/nginx-error.log
|
||||
$COMMAND_HOST cat /var/log/supervisord.log
|
||||
${COMMAND_HOST} ps faux
|
||||
echo "Result of ${PHPMYADMIN_DB_HOSTNAME} tests: ${RED}FAILED${NC}"
|
||||
exit $ret
|
||||
fi
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
[program:test-mysql]
|
||||
command=/test-docker.sh test 80 mysql
|
||||
command=/test-docker.sh test 80 db_server
|
||||
autostart=true
|
||||
autorestart=false
|
||||
priority=3
|
||||
@@ -0,0 +1,2 @@
|
||||
[mysqld]
|
||||
default_authentication_plugin = mysql_native_password
|
||||
@@ -1,32 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Helper script to wait for testing inside container completes
|
||||
# Needs running docker-compose container based on docker-compose.testing.yml
|
||||
|
||||
GREEN="\033[0;32m"
|
||||
RED="\033[0;31m"
|
||||
NC="\033[0m" # No Color
|
||||
|
||||
TIMEOUT=0
|
||||
|
||||
sleep 5
|
||||
|
||||
while [ `docker-compose -f docker-compose.testing.yml logs phpmyadmin | grep -c 'Result of \(mysql\|mariadb\) tests'` -lt 2 ] ; do
|
||||
sleep 1
|
||||
TIMEOUT=$(($TIMEOUT + 1))
|
||||
if [ $TIMEOUT -gt 20 ] ; then
|
||||
docker-compose -f docker-compose.testing.yml logs phpmyadmin
|
||||
echo "${RED}Timeout!${NC}"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
if [ `docker-compose -f docker-compose.testing.yml logs phpmyadmin | grep -c 'Result of \(mysql\|mariadb\) tests.*SUCCESS'` -lt 2 ] ; then
|
||||
docker-compose -f docker-compose.testing.yml logs phpmyadmin
|
||||
echo "${RED}Failed${NC}"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
docker-compose -f docker-compose.testing.yml logs phpmyadmin
|
||||
echo "${GREEN}Success${NC}"
|
||||
exit 0
|
||||
@@ -0,0 +1,36 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Check for dependencies
|
||||
command -v curl >/dev/null 2>&1 || { echo >&2 "'curl' is required but not found. Aborting."; exit 1; }
|
||||
command -v jq >/dev/null 2>&1 || { echo >&2 "'jq' is required but not found. Aborting."; exit 1; }
|
||||
if [ -z "${BASH_VERSINFO}" ] || [ -z "${BASH_VERSINFO[0]}" ] || [ ${BASH_VERSINFO[0]} -lt 4 ]; then
|
||||
echo "BASH version 4.0 or greater is required. Aborting."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
declare -A cmd=(
|
||||
[apache]='apache2-foreground'
|
||||
[fpm]='php-fpm'
|
||||
[fpm-alpine]='php-fpm'
|
||||
)
|
||||
|
||||
declare -A base=(
|
||||
[apache]='debian'
|
||||
[fpm]='debian'
|
||||
[fpm-alpine]='alpine'
|
||||
)
|
||||
|
||||
latest="$(curl -fsSL 'https://www.phpmyadmin.net/home_page/version.json' | jq -r '.version')"
|
||||
|
||||
for variant in apache fpm fpm-alpine; do
|
||||
template="Dockerfile-${base[$variant]}.template"
|
||||
cp $template "$variant/Dockerfile"
|
||||
cp config.inc.php "$variant/config.inc.php"
|
||||
cp docker-entrypoint.sh "$variant/docker-entrypoint.sh"
|
||||
sed -ri -e '
|
||||
s/%%VERSION%%/'"$latest"'/;
|
||||
s/%%VARIANT%%/'"$variant"'/;
|
||||
s/%%CMD%%/'"${cmd[$variant]}"'/;
|
||||
' "$variant/Dockerfile"
|
||||
done
|
||||
Reference in New Issue
Block a user