Skip to content
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

Add Adminer official image #2252

Merged
merged 1 commit into from
Jan 27, 2017
Merged

Conversation

TimWolla
Copy link
Contributor

@TimWolla TimWolla commented Oct 13, 2016

Quick link to the source repository

This adds an official image for the adminer database management tool.

The FastCGI version of this image received significant testing by myself, as I use it for my local development setup. The standalone version is new, but fairly similar to the FastCGI one and thus should work just fine.

As this image should not receive production like traffic levels the default standalone version uses the PHP internal develoment web server, which should work fine for any local usage. For developers running a FastCGI-capable web server anyway the FastCGI version might be preferred.

This image is opiniated in so far as it uses the host name db by default for the database, instead of localhost which obviously does not work in context of Docker.

This image differs from the very popular clue/adminer image in the following points:

  • It does proper Dockerization, by not including supervisord
  • It allows for repeatable builds
  • It sets a default database host
  • It does not modify php.ini to disable the various limits of PHP
  • It does not include support for MSSQL
  • It is based on Alpine

There is a PR on clue/adminer that remedies some of the points, but it heavily discussed, so I refrained from proposing my own opiniated solution there: clue/docker-adminer#21

Checklist for Review

NOTE: This checklist is intended for the use of the Official Images maintainers both to track the status of your PR and to help inform you and others of where we're at. As such, please leave the "checking" of items to the repository maintainers. If there is a point below for which you would like to provide additional information or note completion, please do so by commenting on the PR. Thanks! (and thanks for staying patient with us ❤️)

  • associated with or contacted upstream?
    Not yet.
  • does it fit into one of the common categories? ("service", "language stack", "base distribution")
  • is it reasonably popular, or does it solve a particular use case well?
  • does a documentation PR exist? (should be reviewed and merged at roughly the same time so that we don't have an empty image page on the Hub for very long)
    Yup, Add Adminer official image docs#722
  • dockerization review for best practices and cache gotchas/improvements (ala the official review guidelines)?
  • 2+ dockerization review?
  • existing official images have been considered as a base? (ie, if foobar needs Node.js, has FROM node:... instead of grabbing node via other means been considered?)
    Yup. Based on the alpine versions of PHP.
  • if FROM scratch, tarballs only exist in a single commit within the associated history?
    Does not apply
  • passes current tests? any simple new tests that might be appropriate to add? (https://github.com/docker-library/official-images/tree/master/test)

@tianon
Copy link
Member

tianon commented Nov 8, 2016

Any contact with upstream yet? 🙏 (to either see if they're interested in collaboration, or to ensure that they're not opposed to the creation of this image/possibly provide their blessing for you doing so ❤️)

@TimWolla
Copy link
Contributor Author

As a short heads up: Not yet, I'm busy at the moment. This has not been forgotten.

@TimWolla
Copy link
Contributor Author

TimWolla commented Dec 19, 2016

@tianon I just wanted to contact upstream via the official adminer forum in SourceForge. I even bit the bullet to register a SourceForge account, unfortunately SourceForge does not want my account and is unable to configure their mail servers properly (i.e. the activation mail does not arrive).

To be honest it looks like the adminer developer does not even frequent that discussion board any more, anyway.

Please advice on how to proceed 🙏

@tianon
Copy link
Member

tianon commented Jan 27, 2017

@TimWolla I suppose we probably are fine to move forward 👍 (but I'll say explicitly here that if upstream comes around later and is reading this, we'll be ecstatic to help coordinate the cooperation ❤️)

@yosifkit
Copy link
Member

diff --git a/adminer_fastcgi/Dockerfile b/adminer_fastcgi/Dockerfile
new file mode 100644
index 0000000..fbe1954
--- /dev/null
+++ b/adminer_fastcgi/Dockerfile
@@ -0,0 +1,25 @@
+FROM php:7.0-fpm-alpine
+MAINTAINER Tim Düsterhus
+
+RUN	addgroup -S adminer \
+&&	adduser -S -G adminer adminer \
+&&	mkdir -p /var/www/html
+
+RUN	apk add --no-cache libpq
+
+RUN	set -x \
+&&	apk add --no-cache --virtual .build-deps \
+	postgresql-dev \
+	sqlite-dev \
+&&	docker-php-ext-install pdo_mysql pdo_pgsql pdo_sqlite \
+&&	apk del .build-deps
+
+COPY	index.php .
+
+ENV	ADMINER_VERSION 4.2.5
+ENV	ADMINER_DOWNLOAD_SHA256 a8d9f5df8a604e75e87670bc1d797bb49cc1047f722a8630bda514fdc407f84f
+
+RUN	curl -fsSL https://www.adminer.org/static/download/$ADMINER_VERSION/adminer-$ADMINER_VERSION-en.php -o adminer.php \
+&&	echo "$ADMINER_DOWNLOAD_SHA256  adminer.php" |sha256sum -c -
+
+USER	adminer
diff --git a/adminer_fastcgi/index.php b/adminer_fastcgi/index.php
new file mode 100644
index 0000000..6384334
--- /dev/null
+++ b/adminer_fastcgi/index.php
@@ -0,0 +1,26 @@
+<?php
+namespace docker {
+	function adminer_object() {
+		class Adminer extends \Adminer {
+			function loginForm() {
+				ob_start();
+				$return = parent::loginForm();
+				$form = ob_get_clean();
+
+				echo str_replace('name="auth[server]" value="" title="hostname[:port]"', 'name="auth[server]" value="db" title="hostname[:port]"', $form);
+
+				return $return;
+			}
+		}
+
+		return new Adminer();
+	}
+}
+
+namespace {
+	function adminer_object() {
+		return \docker\adminer_object();
+	}
+
+	require('adminer.php');
+}
diff --git a/adminer_latest/Dockerfile b/adminer_latest/Dockerfile
new file mode 100644
index 0000000..3ed815f
--- /dev/null
+++ b/adminer_latest/Dockerfile
@@ -0,0 +1,30 @@
+FROM php:7.0-alpine
+MAINTAINER Tim Düsterhus
+
+RUN	addgroup -S adminer \
+&&	adduser -S -G adminer adminer \
+&&	mkdir -p /var/www/html
+
+WORKDIR /var/www/html
+
+RUN	apk add --no-cache libpq
+
+RUN	set -x \
+&&	apk add --no-cache --virtual .build-deps \
+	postgresql-dev \
+	sqlite-dev \
+&&	docker-php-ext-install pdo_mysql pdo_pgsql pdo_sqlite \
+&&	apk del .build-deps
+
+COPY	index.php .
+
+ENV	ADMINER_VERSION 4.2.5
+ENV	ADMINER_DOWNLOAD_SHA256 a8d9f5df8a604e75e87670bc1d797bb49cc1047f722a8630bda514fdc407f84f
+
+RUN	curl -fsSL https://www.adminer.org/static/download/$ADMINER_VERSION/adminer-$ADMINER_VERSION-en.php -o adminer.php \
+&&	echo "$ADMINER_DOWNLOAD_SHA256  adminer.php" |sha256sum -c -
+
+USER	adminer
+CMD	php -S 0.0.0.0:8080 -t /var/www/html
+
+EXPOSE 8080
diff --git a/adminer_latest/index.php b/adminer_latest/index.php
new file mode 100644
index 0000000..6384334
--- /dev/null
+++ b/adminer_latest/index.php
@@ -0,0 +1,26 @@
+<?php
+namespace docker {
+	function adminer_object() {
+		class Adminer extends \Adminer {
+			function loginForm() {
+				ob_start();
+				$return = parent::loginForm();
+				$form = ob_get_clean();
+
+				echo str_replace('name="auth[server]" value="" title="hostname[:port]"', 'name="auth[server]" value="db" title="hostname[:port]"', $form);
+
+				return $return;
+			}
+		}
+
+		return new Adminer();
+	}
+}
+
+namespace {
+	function adminer_object() {
+		return \docker\adminer_object();
+	}
+
+	require('adminer.php');
+}

Build test of #2252; 07b3b8c (adminer):

$ bashbrew build adminer:4.2.5-standalone
Building bashbrew/cache:b2eb6597f11cb73925724b84104dded6cb85d9acb8e0fa0ff50186918cee5def (adminer:4.2.5-standalone)
Tagging adminer:4.2.5-standalone
Tagging adminer:4.2-standalone
Tagging adminer:4-standalone
Tagging adminer:standalone
Tagging adminer:4.2.5
Tagging adminer:4.2
Tagging adminer:4
Tagging adminer:latest

$ test/run.sh adminer:4.2.5-standalone
testing adminer:4.2.5-standalone
	'utc' [1/4]...passed
	'cve-2014--shellshock' [2/4]...passed
	'no-hard-coded-passwords' [3/4]...passed
	'override-cmd' [4/4]...passed


$ bashbrew build adminer:4.2.5-fastcgi
Building bashbrew/cache:1bc77403f9819340ed87d879ad76b3c0599493867de8c7189f01f2df73a46241 (adminer:4.2.5-fastcgi)
Tagging adminer:4.2.5-fastcgi
Tagging adminer:4.2-fastcgi
Tagging adminer:4-fastcgi
Tagging adminer:fastcgi

$ test/run.sh adminer:4.2.5-fastcgi
testing adminer:4.2.5-fastcgi
	'utc' [1/4]...passed
	'cve-2014--shellshock' [2/4]...passed
	'no-hard-coded-passwords' [3/4]...passed
	'override-cmd' [4/4]...passed

@yosifkit yosifkit merged commit d1964d3 into docker-library:master Jan 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants