Skip to content

Fetch GnuPG key from keyserver #149

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 28 additions & 23 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
FROM php:7.2-fpm-alpine

RUN apk add --no-cache \
nginx \
supervisor

# Install dependencies
RUN apk add --no-cache --virtual .build-deps \
RUN set -ex; \
\
apk add --no-cache --virtual .build-deps \
bzip2-dev \
freetype-dev \
libjpeg-turbo-dev \
Expand All @@ -20,11 +26,7 @@ RUN apk add --no-cache --virtual .build-deps \
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
)"; \
apk add --virtual .phpmyadmin-phpexts-rundeps $runDeps; \
apk del .build-deps; \
apk add --no-cache nginx supervisor

# Include keyring to verify download
COPY phpmyadmin.keyring /
apk del .build-deps

# Copy configuration
COPY etc /etc/
Expand All @@ -39,23 +41,26 @@ ENV URL https://files.phpmyadmin.net/phpMyAdmin/${VERSION}/phpMyAdmin-${VERSION}
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 {} \;
RUN set -ex; \
apk add --no-cache --virtual .fetch-deps \
gnupg \
; \
\
export GNUPGHOME="$(mktemp -d)"; \
curl --output phpMyAdmin.tar.gz --location $URL; \
curl --output phpMyAdmin.tar.gz.asc --location $URL.asc; \
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys 3D06A59ECE730EB71B511C17CE752F178259BD92; \
gpg --batch --verify phpMyAdmin.tar.gz.asc phpMyAdmin.tar.gz; \
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 {} \; ; \
apk del .fetch-deps

# Add directory for sessions to allow session persistence
RUN mkdir /sessions
Expand Down
Binary file removed phpmyadmin.keyring
Binary file not shown.