diff --git a/docker/Dockerfile b/docker/Dockerfile deleted file mode 100644 index e346516a..00000000 --- a/docker/Dockerfile +++ /dev/null @@ -1,34 +0,0 @@ -FROM php:7.0-apache -MAINTAINER David Goodwin - -ARG POSTFIXADMIN_VERSION=3.1 -ARG POSTFIXADMIN_SHA512=3bda4e9d4a7308d22edca30d181af76b7153e57b19bda878e32f5eeeb49127f46581c966706bcca13cd31740cadacc584e15830aa157b4655e60d44d66f45ddd - -# Install required PHP extensions -RUN buildDeps='libpq-dev libsqlite3-dev' \ - && apt-get update && apt-get install -y --no-install-recommends $buildDeps \ - && docker-php-ext-install mysqli pdo pdo_mysql pdo_pgsql pdo_sqlite pgsql \ - && apt-mark manual libpq5 \ - && apt-get purge -y --auto-remove $buildDeps \ - && apt-get clean && rm -rf /var/lib/apt/lists/* - -VOLUME /var/www/html - -ENV POSTFIXADMIN_VERSION $POSTFIXADMIN_VERSION -ENV POSTFIXADMIN_SHA512 $POSTFIXADMIN_SHA512 - -RUN set -eu; \ - curl -o postfixadmin.tar.gz -SL "https://github.com/postfixadmin/postfixadmin/archive/postfixadmin-${POSTFIXADMIN_VERSION}.tar.gz"; \ - echo "$POSTFIXADMIN_SHA512 *postfixadmin.tar.gz" | sha512sum -c -; \ - # upstream tarball include ./postfixadmin-postfixadmin-${POSTFIXADMIN_VERSION}/ - tar -xzf postfixadmin.tar.gz -C /usr/src/; \ - mv /usr/src/postfixadmin-postfixadmin-${POSTFIXADMIN_VERSION} /usr/src/postfixadmin; \ - rm postfixadmin.tar.gz; \ - # Does not exist in tarball but is required - mkdir -p /usr/src/postfixadmin/templates_c; \ - chown -R www-data:www-data /usr/src/postfixadmin - -COPY docker-entrypoint.sh /usr/local/bin/ - -ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"] -CMD ["apache2-foreground"] diff --git a/docker/README.md b/docker/README.md deleted file mode 100644 index 0c4e5498..00000000 --- a/docker/README.md +++ /dev/null @@ -1,69 +0,0 @@ -# Building - -cd docker ; docker build --pull --rm -t postfixadmin-image . - -# Running - -## No config.local.php / no existing setup - -If you do not have a config.local.php, then we fall back to look for environment variables to generate one. - -POSTFIXADMIN\_DB\_TYPE can be one of : - - * mysqli - * pgsql - * sqlite - -```bash -docker run -e POSTFIXADMIN_DB_TYPE=mysqli \ - -e POSTFIXADMIN_DB_HOST=whatever \ - -e POSTFIXADMIN_DB_USER=user \ - -e POSTFIXADMIN_DB_PASSWORD=topsecret \ - -e POSTFIXADMIN_DB_NAME=postfixadmin \ - --name postfixadmin \ - -p 8080:80 \ - postfixadmin-image -``` - -Note: An sqlite database is used as a fallback if you do not have a config.local.php and do not specify the above variables. - - -## Existing config.local.php - -```bash -docker run --name postfixadmin -p 8080:80 postfixadmin-image -``` - -# Docker Compose - -Try something like the below; changing the usernames/passwords as required. - - -``` -version: '3' - -services: - db: - image: mysql:5.7 - restart: always - environment: - MYSQL_ROOT_PASSWORD: notSecureChangeMe - MYSQL_DATABASE: postfixadmin - MYSQL_USER: postfixadmin - MYSQL_PASSWORD: postfixadminPassword - - postfixadmin: - depends_on: - - db - image: postfixadmin-image:latest - ports: - - "8000:80" - restart: always - environment: - POSTFIXADMIN_DB_TYPE: mysqli - POSTFIXADMIN_DB_HOST: db - POSTFIXADMIN_DB_USER: postfixadmin - POSTFIXADMIN_DB_NAME: postfixadmin - POSTFIXADMIN_DB_PASSWORD: postfixadminPassword -``` - diff --git a/docker/docker-entrypoint.sh b/docker/docker-entrypoint.sh deleted file mode 100755 index 0a167b3e..00000000 --- a/docker/docker-entrypoint.sh +++ /dev/null @@ -1,74 +0,0 @@ -#!/bin/bash -set -ex - -POSTFIXADMIN_DB_TYPE=${POSTFIXADMIN_DB_TYPE:=sqlite} -POSTFIXADMIN_DB_HOST=${POSTFIXADMIN_DB_HOST:=""} -POSTFIXADMIN_DB_USER=${POSTFIXADMIN_DB_USER:=""} -POSTFIXADMIN_DB_PASSWORD=${POSTFIXADMIN_DB_PASSWORD:=""} - -if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then - if ! [ -e index.php -a -e scripts/postfixadmin-cli.php ]; then - echo >&2 "Postfixadmin 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 cf - --one-file-system -C /usr/src/postfixadmin . | tar xf - - echo >&2 "Complete! Postfixadmin has been successfully copied to $PWD" - fi - - case "${POSTFIXADMIN_DB_TYPE}" in - sqlite) - ;; - mysqli) - : "${POSTFIXADMIN_DB_PORT:=3306}" - ;; - pgsql) - : "${POSTFIXADMIN_DB_PORT:=5432}" - ;; - *) - echo >&2 "${POSTFIXADMIN_DB_TYPE} is not a supported value." - exit 1 - ;; - esac - - if [ "${POSTFIXADMIN_DB_TYPE}" != "sqlite" ]; then - if [ -z "${POSTFIXADMIN_DB_USER}" -o -z "${POSTFIXADMIN_DB_PASSWORD}" ]; then - echo >&2 'Error: POSTFIXADMIN_DB_USER and POSTFIXADMIN_DB_PASSWORD must be specified. ' - exit 1 - fi - timeout 15 bash -c "until echo > /dev/tcp/${POSTFIXADMIN_DB_HOST}/${POSTFIXADMIN_DB_PORT}; do sleep 0.5; done" - fi - - if [ "$POSTFIXADMIN_DB_TYPE" = 'sqlite' ]; then - : "${POSTFIXADMIN_DB_NAME:=/var/local/postfixadmin.db}" - - if [ ! -e "$POSTFIXADMIN_DB_NAME" ]; then - touch $POSTFIXADMIN_DB_NAME - fi - fi - - if [ ! -e config.local.php ]; then - touch config.local.php - echo "Write config to $PWD/config.local.php" - echo "" | tee config.local.php - else - echo "WARNING: $PWD/config.local.php already exists." - echo "Postfixadmin related environment variables have been ignored." - fi - - if [ -f upgrade.php ]; then - echo " ** Running database / environment upgrade.php " - php upgrade.php - fi -fi - -exec "$@"