Skip to content

Commit a4071cd

Browse files
committed
Merge #274 - apply some feedback from docker-library team
Pull-request: #274
2 parents 6cd68f9 + e05baec commit a4071cd

File tree

9 files changed

+66
-71
lines changed

9 files changed

+66
-71
lines changed

Dockerfile-alpine.template

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,13 @@ RUN set -ex; \
3333
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
3434
)"; \
3535
apk add --virtual .phpmyadmin-phpexts-rundeps $runDeps; \
36-
apk del .build-deps
36+
apk del --no-network .build-deps
3737

3838
# set recommended PHP.ini settings
3939
# see https://secure.php.net/manual/en/opcache.installation.php
40-
RUN { \
40+
RUN set -ex; \
41+
\
42+
{ \
4143
echo 'opcache.memory_consumption=128'; \
4244
echo 'opcache.interned_strings_buffer=8'; \
4345
echo 'opcache.max_accelerated_files=4000'; \
@@ -59,7 +61,6 @@ RUN { \
5961
# Calculate download URL
6062
ENV VERSION %%VERSION%%
6163
ENV URL https://files.phpmyadmin.net/phpMyAdmin/${VERSION}/phpMyAdmin-${VERSION}-all-languages.tar.xz
62-
LABEL version=$VERSION
6364

6465
# Download tarball, verify it using gpg and extract
6566
RUN set -ex; \
@@ -69,24 +70,22 @@ RUN set -ex; \
6970
\
7071
export GNUPGHOME="$(mktemp -d)"; \
7172
export GPGKEY="3D06A59ECE730EB71B511C17CE752F178259BD92"; \
72-
curl --output phpMyAdmin.tar.xz --location $URL; \
73-
curl --output phpMyAdmin.tar.xz.asc --location $URL.asc; \
73+
curl -fsSL -o phpMyAdmin.tar.xz $URL; \
74+
curl -fsSL -o phpMyAdmin.tar.xz.asc $URL.asc; \
7475
gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPGKEY" \
7576
|| gpg --batch --keyserver ipv4.pool.sks-keyservers.net --recv-keys "$GPGKEY" \
7677
|| gpg --batch --keyserver keys.gnupg.net --recv-keys "$GPGKEY" \
7778
|| gpg --batch --keyserver pgp.mit.edu --recv-keys "$GPGKEY" \
7879
|| gpg --batch --keyserver keyserver.pgp.com --recv-keys "$GPGKEY"; \
7980
gpg --batch --verify phpMyAdmin.tar.xz.asc phpMyAdmin.tar.xz; \
80-
tar -xf phpMyAdmin.tar.xz -C /usr/src; \
81+
mkdir /usr/src/phpmyadmin; \
82+
tar -xf phpMyAdmin.tar.xz -C /usr/src/phpmyadmin --strip-components=1; \
8183
gpgconf --kill all; \
8284
rm -r "$GNUPGHOME" phpMyAdmin.tar.xz phpMyAdmin.tar.xz.asc; \
83-
mv /usr/src/phpMyAdmin-$VERSION-all-languages /usr/src/phpmyadmin; \
8485
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; \
8586
sed -i "s@define('CONFIG_DIR'.*@define('CONFIG_DIR', '/etc/phpmyadmin/');@" /usr/src/phpmyadmin/libraries/vendor_config.php; \
8687
# Add directory for sessions to allow session persistence
87-
mkdir /sessions; \
88-
mkdir -p /var/nginx/client_body_temp; \
89-
apk del .fetch-deps
88+
apk del --no-network .fetch-deps
9089

9190
# Copy configuration
9291
COPY config.inc.php /etc/phpmyadmin/config.inc.php

Dockerfile-debian.template

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ RUN set -ex; \
4040

4141
# set recommended PHP.ini settings
4242
# see https://secure.php.net/manual/en/opcache.installation.php
43-
RUN { \
43+
RUN set -ex; \
44+
\
45+
{ \
4446
echo 'opcache.memory_consumption=128'; \
4547
echo 'opcache.interned_strings_buffer=8'; \
4648
echo 'opcache.max_accelerated_files=4000'; \
@@ -62,38 +64,39 @@ RUN { \
6264
# Calculate download URL
6365
ENV VERSION %%VERSION%%
6466
ENV URL https://files.phpmyadmin.net/phpMyAdmin/${VERSION}/phpMyAdmin-${VERSION}-all-languages.tar.xz
65-
LABEL version=$VERSION
6667

6768
# Download tarball, verify it using gpg and extract
6869
RUN set -ex; \
69-
fetchDeps=" \
70+
\
71+
savedAptMark="$(apt-mark showmanual)"; \
72+
\
73+
apt-get update; \
74+
apt-get install -y --no-install-recommends \
7075
gnupg \
7176
dirmngr \
72-
"; \
73-
apt-get update; \
74-
apt-get install -y --no-install-recommends $fetchDeps; \
77+
; \
7578
\
7679
export GNUPGHOME="$(mktemp -d)"; \
7780
export GPGKEY="3D06A59ECE730EB71B511C17CE752F178259BD92"; \
78-
curl --output phpMyAdmin.tar.xz --location $URL; \
79-
curl --output phpMyAdmin.tar.xz.asc --location $URL.asc; \
81+
curl -fsSL -o phpMyAdmin.tar.xz $URL; \
82+
curl -fsSL -o phpMyAdmin.tar.xz.asc $URL.asc; \
8083
gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPGKEY" \
8184
|| gpg --batch --keyserver ipv4.pool.sks-keyservers.net --recv-keys "$GPGKEY" \
8285
|| gpg --batch --keyserver keys.gnupg.net --recv-keys "$GPGKEY" \
8386
|| gpg --batch --keyserver pgp.mit.edu --recv-keys "$GPGKEY" \
8487
|| gpg --batch --keyserver keyserver.pgp.com --recv-keys "$GPGKEY"; \
8588
gpg --batch --verify phpMyAdmin.tar.xz.asc phpMyAdmin.tar.xz; \
86-
tar -xf phpMyAdmin.tar.xz -C /usr/src; \
89+
mkdir /usr/src/phpmyadmin; \
90+
tar -xf phpMyAdmin.tar.xz -C /usr/src/phpmyadmin --strip-components=1; \
8791
gpgconf --kill all; \
8892
rm -r "$GNUPGHOME" phpMyAdmin.tar.xz phpMyAdmin.tar.xz.asc; \
89-
mv /usr/src/phpMyAdmin-$VERSION-all-languages /usr/src/phpmyadmin; \
9093
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; \
9194
sed -i "s@define('CONFIG_DIR'.*@define('CONFIG_DIR', '/etc/phpmyadmin/');@" /usr/src/phpmyadmin/libraries/vendor_config.php; \
9295
# Add directory for sessions to allow session persistence
93-
mkdir /sessions; \
94-
mkdir -p /var/nginx/client_body_temp; \
9596
\
96-
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $fetchDeps; \
97+
apt-mark auto '.*' > /dev/null; \
98+
apt-mark manual $savedAptMark; \
99+
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
97100
rm -rf /var/lib/apt/lists/*
98101

99102
# Copy configuration

apache/Dockerfile

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ RUN set -ex; \
4040

4141
# set recommended PHP.ini settings
4242
# see https://secure.php.net/manual/en/opcache.installation.php
43-
RUN { \
43+
RUN set -ex; \
44+
\
45+
{ \
4446
echo 'opcache.memory_consumption=128'; \
4547
echo 'opcache.interned_strings_buffer=8'; \
4648
echo 'opcache.max_accelerated_files=4000'; \
@@ -62,38 +64,39 @@ RUN { \
6264
# Calculate download URL
6365
ENV VERSION 5.0.1
6466
ENV URL https://files.phpmyadmin.net/phpMyAdmin/${VERSION}/phpMyAdmin-${VERSION}-all-languages.tar.xz
65-
LABEL version=$VERSION
6667

6768
# Download tarball, verify it using gpg and extract
6869
RUN set -ex; \
69-
fetchDeps=" \
70+
\
71+
savedAptMark="$(apt-mark showmanual)"; \
72+
\
73+
apt-get update; \
74+
apt-get install -y --no-install-recommends \
7075
gnupg \
7176
dirmngr \
72-
"; \
73-
apt-get update; \
74-
apt-get install -y --no-install-recommends $fetchDeps; \
77+
; \
7578
\
7679
export GNUPGHOME="$(mktemp -d)"; \
7780
export GPGKEY="3D06A59ECE730EB71B511C17CE752F178259BD92"; \
78-
curl --output phpMyAdmin.tar.xz --location $URL; \
79-
curl --output phpMyAdmin.tar.xz.asc --location $URL.asc; \
81+
curl -fsSL -o phpMyAdmin.tar.xz $URL; \
82+
curl -fsSL -o phpMyAdmin.tar.xz.asc $URL.asc; \
8083
gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPGKEY" \
8184
|| gpg --batch --keyserver ipv4.pool.sks-keyservers.net --recv-keys "$GPGKEY" \
8285
|| gpg --batch --keyserver keys.gnupg.net --recv-keys "$GPGKEY" \
8386
|| gpg --batch --keyserver pgp.mit.edu --recv-keys "$GPGKEY" \
8487
|| gpg --batch --keyserver keyserver.pgp.com --recv-keys "$GPGKEY"; \
8588
gpg --batch --verify phpMyAdmin.tar.xz.asc phpMyAdmin.tar.xz; \
86-
tar -xf phpMyAdmin.tar.xz -C /usr/src; \
89+
mkdir /usr/src/phpmyadmin; \
90+
tar -xf phpMyAdmin.tar.xz -C /usr/src/phpmyadmin --strip-components=1; \
8791
gpgconf --kill all; \
8892
rm -r "$GNUPGHOME" phpMyAdmin.tar.xz phpMyAdmin.tar.xz.asc; \
89-
mv /usr/src/phpMyAdmin-$VERSION-all-languages /usr/src/phpmyadmin; \
9093
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; \
9194
sed -i "s@define('CONFIG_DIR'.*@define('CONFIG_DIR', '/etc/phpmyadmin/');@" /usr/src/phpmyadmin/libraries/vendor_config.php; \
9295
# Add directory for sessions to allow session persistence
93-
mkdir /sessions; \
94-
mkdir -p /var/nginx/client_body_temp; \
9596
\
96-
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $fetchDeps; \
97+
apt-mark auto '.*' > /dev/null; \
98+
apt-mark manual $savedAptMark; \
99+
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
97100
rm -rf /var/lib/apt/lists/*
98101

99102
# Copy configuration

apache/docker-entrypoint.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
1616
group="$(id -g)"
1717
fi
1818

19-
# Custom folders for sessions
20-
chown ${user}:${group} /sessions /var/nginx/client_body_temp
21-
2219
if ! [ -e index.php -a -e url.php ]; then
2320
echo >&2 "phpMyAdmin not found in $PWD - copying now..."
2421
if [ "$(ls -A)" ]; then

docker-entrypoint.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
1616
group="$(id -g)"
1717
fi
1818

19-
# Custom folders for sessions
20-
chown ${user}:${group} /sessions /var/nginx/client_body_temp
21-
2219
if ! [ -e index.php -a -e url.php ]; then
2320
echo >&2 "phpMyAdmin not found in $PWD - copying now..."
2421
if [ "$(ls -A)" ]; then

fpm-alpine/Dockerfile

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,13 @@ RUN set -ex; \
3333
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
3434
)"; \
3535
apk add --virtual .phpmyadmin-phpexts-rundeps $runDeps; \
36-
apk del .build-deps
36+
apk del --no-network .build-deps
3737

3838
# set recommended PHP.ini settings
3939
# see https://secure.php.net/manual/en/opcache.installation.php
40-
RUN { \
40+
RUN set -ex; \
41+
\
42+
{ \
4143
echo 'opcache.memory_consumption=128'; \
4244
echo 'opcache.interned_strings_buffer=8'; \
4345
echo 'opcache.max_accelerated_files=4000'; \
@@ -59,7 +61,6 @@ RUN { \
5961
# Calculate download URL
6062
ENV VERSION 5.0.1
6163
ENV URL https://files.phpmyadmin.net/phpMyAdmin/${VERSION}/phpMyAdmin-${VERSION}-all-languages.tar.xz
62-
LABEL version=$VERSION
6364

6465
# Download tarball, verify it using gpg and extract
6566
RUN set -ex; \
@@ -69,24 +70,22 @@ RUN set -ex; \
6970
\
7071
export GNUPGHOME="$(mktemp -d)"; \
7172
export GPGKEY="3D06A59ECE730EB71B511C17CE752F178259BD92"; \
72-
curl --output phpMyAdmin.tar.xz --location $URL; \
73-
curl --output phpMyAdmin.tar.xz.asc --location $URL.asc; \
73+
curl -fsSL -o phpMyAdmin.tar.xz $URL; \
74+
curl -fsSL -o phpMyAdmin.tar.xz.asc $URL.asc; \
7475
gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPGKEY" \
7576
|| gpg --batch --keyserver ipv4.pool.sks-keyservers.net --recv-keys "$GPGKEY" \
7677
|| gpg --batch --keyserver keys.gnupg.net --recv-keys "$GPGKEY" \
7778
|| gpg --batch --keyserver pgp.mit.edu --recv-keys "$GPGKEY" \
7879
|| gpg --batch --keyserver keyserver.pgp.com --recv-keys "$GPGKEY"; \
7980
gpg --batch --verify phpMyAdmin.tar.xz.asc phpMyAdmin.tar.xz; \
80-
tar -xf phpMyAdmin.tar.xz -C /usr/src; \
81+
mkdir /usr/src/phpmyadmin; \
82+
tar -xf phpMyAdmin.tar.xz -C /usr/src/phpmyadmin --strip-components=1; \
8183
gpgconf --kill all; \
8284
rm -r "$GNUPGHOME" phpMyAdmin.tar.xz phpMyAdmin.tar.xz.asc; \
83-
mv /usr/src/phpMyAdmin-$VERSION-all-languages /usr/src/phpmyadmin; \
8485
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; \
8586
sed -i "s@define('CONFIG_DIR'.*@define('CONFIG_DIR', '/etc/phpmyadmin/');@" /usr/src/phpmyadmin/libraries/vendor_config.php; \
8687
# Add directory for sessions to allow session persistence
87-
mkdir /sessions; \
88-
mkdir -p /var/nginx/client_body_temp; \
89-
apk del .fetch-deps
88+
apk del --no-network .fetch-deps
9089

9190
# Copy configuration
9291
COPY config.inc.php /etc/phpmyadmin/config.inc.php

fpm-alpine/docker-entrypoint.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
1616
group="$(id -g)"
1717
fi
1818

19-
# Custom folders for sessions
20-
chown ${user}:${group} /sessions /var/nginx/client_body_temp
21-
2219
if ! [ -e index.php -a -e url.php ]; then
2320
echo >&2 "phpMyAdmin not found in $PWD - copying now..."
2421
if [ "$(ls -A)" ]; then

fpm/Dockerfile

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ RUN set -ex; \
4040

4141
# set recommended PHP.ini settings
4242
# see https://secure.php.net/manual/en/opcache.installation.php
43-
RUN { \
43+
RUN set -ex; \
44+
\
45+
{ \
4446
echo 'opcache.memory_consumption=128'; \
4547
echo 'opcache.interned_strings_buffer=8'; \
4648
echo 'opcache.max_accelerated_files=4000'; \
@@ -62,38 +64,39 @@ RUN { \
6264
# Calculate download URL
6365
ENV VERSION 5.0.1
6466
ENV URL https://files.phpmyadmin.net/phpMyAdmin/${VERSION}/phpMyAdmin-${VERSION}-all-languages.tar.xz
65-
LABEL version=$VERSION
6667

6768
# Download tarball, verify it using gpg and extract
6869
RUN set -ex; \
69-
fetchDeps=" \
70+
\
71+
savedAptMark="$(apt-mark showmanual)"; \
72+
\
73+
apt-get update; \
74+
apt-get install -y --no-install-recommends \
7075
gnupg \
7176
dirmngr \
72-
"; \
73-
apt-get update; \
74-
apt-get install -y --no-install-recommends $fetchDeps; \
77+
; \
7578
\
7679
export GNUPGHOME="$(mktemp -d)"; \
7780
export GPGKEY="3D06A59ECE730EB71B511C17CE752F178259BD92"; \
78-
curl --output phpMyAdmin.tar.xz --location $URL; \
79-
curl --output phpMyAdmin.tar.xz.asc --location $URL.asc; \
81+
curl -fsSL -o phpMyAdmin.tar.xz $URL; \
82+
curl -fsSL -o phpMyAdmin.tar.xz.asc $URL.asc; \
8083
gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPGKEY" \
8184
|| gpg --batch --keyserver ipv4.pool.sks-keyservers.net --recv-keys "$GPGKEY" \
8285
|| gpg --batch --keyserver keys.gnupg.net --recv-keys "$GPGKEY" \
8386
|| gpg --batch --keyserver pgp.mit.edu --recv-keys "$GPGKEY" \
8487
|| gpg --batch --keyserver keyserver.pgp.com --recv-keys "$GPGKEY"; \
8588
gpg --batch --verify phpMyAdmin.tar.xz.asc phpMyAdmin.tar.xz; \
86-
tar -xf phpMyAdmin.tar.xz -C /usr/src; \
89+
mkdir /usr/src/phpmyadmin; \
90+
tar -xf phpMyAdmin.tar.xz -C /usr/src/phpmyadmin --strip-components=1; \
8791
gpgconf --kill all; \
8892
rm -r "$GNUPGHOME" phpMyAdmin.tar.xz phpMyAdmin.tar.xz.asc; \
89-
mv /usr/src/phpMyAdmin-$VERSION-all-languages /usr/src/phpmyadmin; \
9093
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; \
9194
sed -i "s@define('CONFIG_DIR'.*@define('CONFIG_DIR', '/etc/phpmyadmin/');@" /usr/src/phpmyadmin/libraries/vendor_config.php; \
9295
# Add directory for sessions to allow session persistence
93-
mkdir /sessions; \
94-
mkdir -p /var/nginx/client_body_temp; \
9596
\
96-
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $fetchDeps; \
97+
apt-mark auto '.*' > /dev/null; \
98+
apt-mark manual $savedAptMark; \
99+
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
97100
rm -rf /var/lib/apt/lists/*
98101

99102
# Copy configuration

fpm/docker-entrypoint.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
1616
group="$(id -g)"
1717
fi
1818

19-
# Custom folders for sessions
20-
chown ${user}:${group} /sessions /var/nginx/client_body_temp
21-
2219
if ! [ -e index.php -a -e url.php ]; then
2320
echo >&2 "phpMyAdmin not found in $PWD - copying now..."
2421
if [ "$(ls -A)" ]; then

0 commit comments

Comments
 (0)