├── 4 ├── Dockerfile ├── entrypoint.sh ├── fastcgi │ ├── Dockerfile │ ├── entrypoint.sh │ ├── index.php │ └── plugin-loader.php ├── index.php └── plugin-loader.php ├── 5 ├── Dockerfile ├── entrypoint.sh ├── fastcgi │ ├── Dockerfile │ ├── entrypoint.sh │ ├── index.php │ └── plugin-loader.php ├── index.php └── plugin-loader.php ├── .github ├── dependabot.yml └── workflows │ └── image.yml ├── README.md ├── generate-stackbrew-library.sh └── update.sh /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "github-actions" 4 | directory: "/" 5 | schedule: 6 | interval: "monthly" 7 | -------------------------------------------------------------------------------- /.github/workflows/image.yml: -------------------------------------------------------------------------------- 1 | name: Build Docker Image 2 | 3 | on: 4 | - push 5 | - pull_request 6 | 7 | jobs: 8 | build: 9 | runs-on: ubuntu-latest 10 | strategy: 11 | matrix: 12 | variant: 13 | - "4" 14 | - "4/fastcgi" 15 | - "5" 16 | - "5/fastcgi" 17 | steps: 18 | - uses: actions/checkout@v4 19 | - name: Build the image. 20 | id: build 21 | run: | 22 | printf "::group::Sending context\n" 23 | IMAGE=adminer:${VARIANT/\//-}-$(date +%s) 24 | docker build "$VARIANT" --tag "$IMAGE" |sed 's/^Step/::endgroup::\n::group::Step/' 25 | printf "::endgroup::\n" 26 | printf "image=%s\n" "$IMAGE" >> $GITHUB_OUTPUT 27 | printf "version=%s\n" "$(awk '/^ENV\s+ADMINER_VERSION/{print $3}' "$VARIANT/Dockerfile")" >> $GITHUB_OUTPUT 28 | env: 29 | VARIANT: ${{ matrix.variant }} 30 | - name: Smoketest 31 | run: | 32 | docker run --name $container_name -d ${{ steps.build.outputs.image }} 33 | env: 34 | container_name: adminer_smoke 35 | - name: Verify a restart works. 36 | if: ${{ ! contains(steps.build.outputs.image, 'fastcgi') }} 37 | run: | 38 | docker run --name $container_name -d ${{ steps.build.outputs.image }} 39 | docker run -i --rm --link $container_name:$container_name buildpack-deps:curl \ 40 | curl -fsSL http://$container_name:8080/ 41 | docker restart $container_name 42 | docker run -i --rm --link $container_name:$container_name buildpack-deps:curl \ 43 | curl -fsSL http://$container_name:8080/ 44 | env: 45 | container_name: adminer_restart 46 | - name: Verify version. 47 | if: ${{ ! contains(steps.build.outputs.image, 'fastcgi') }} 48 | run: | 49 | docker run --name $container_name -d ${{ steps.build.outputs.image }} 50 | docker run -i --rm --link $container_name:$container_name buildpack-deps:curl \ 51 | curl -fsSL http://$container_name:8080/ \ 52 | |grep '${{ steps.build.outputs.version }}' 53 | env: 54 | container_name: adminer_version 55 | - name: Verify that no warnings appear. 56 | if: ${{ ! contains(steps.build.outputs.image, 'fastcgi') }} 57 | run: | 58 | docker run --name $container_name -d ${{ steps.build.outputs.image }} 59 | ! docker run -i --rm --link $container_name:$container_name buildpack-deps:curl \ 60 | curl -fsSL http://$container_name:8080/ \ 61 | |grep 'Warning:' 62 | env: 63 | container_name: adminer_warnings 64 | - name: Verify that the design works. 65 | if: ${{ ! contains(steps.build.outputs.image, 'fastcgi') }} 66 | run: | 67 | docker run --name $container_name -d -e ADMINER_DESIGN=nette ${{ steps.build.outputs.image }} 68 | docker run -i --rm --link $container_name:$container_name buildpack-deps:curl \ 69 | curl -fsSL http://$container_name:8080/ \ 70 | |grep 'adminer.css' 71 | docker run -i --rm --link $container_name:$container_name buildpack-deps:curl \ 72 | curl -fsSL http://$container_name:8080/adminer.css \ 73 | |grep 'Nette' 74 | env: 75 | container_name: adminer_design 76 | - name: Verify that the default server works. 77 | if: ${{ ! contains(steps.build.outputs.image, 'fastcgi') }} 78 | run: | 79 | docker run --name $container_name -d -e ADMINER_DEFAULT_SERVER=ADMINER_DEFAULT_SERVER_WORKS ${{ steps.build.outputs.image }} 80 | docker run -i --rm --link $container_name:$container_name buildpack-deps:curl \ 81 | curl -fsSL http://$container_name:8080/ \ 82 | |grep 'ADMINER_DEFAULT_SERVER_WORKS' 83 | env: 84 | container_name: adminer_defaultserver 85 | - name: Verify that loading plugins work. 86 | if: ${{ ! contains(steps.build.outputs.image, 'fastcgi') }} 87 | run: | 88 | docker run --name $container_name -d -e ADMINER_PLUGINS="tables-filter version-noverify" ${{ steps.build.outputs.image }} 89 | docker run -i --rm --link $container_name:$container_name buildpack-deps:curl \ 90 | curl -fsSL http://$container_name:8080/ \ 91 | |grep 'verifyVersion =' 92 | env: 93 | container_name: adminer_plugins 94 | - name: Show Containers and Images 95 | run: | 96 | printf "::group::docker ps -a\n" 97 | docker ps -a 98 | printf "::endgroup::\n" 99 | printf "::group::docker images\n" 100 | docker images 101 | printf "::endgroup::\n" 102 | -------------------------------------------------------------------------------- /4/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM php:8.4-alpine 2 | 3 | RUN echo "upload_max_filesize = 128M" >> /usr/local/etc/php/conf.d/0-upload_large_dumps.ini \ 4 | && echo "post_max_size = 128M" >> /usr/local/etc/php/conf.d/0-upload_large_dumps.ini \ 5 | && echo "memory_limit = 1G" >> /usr/local/etc/php/conf.d/0-upload_large_dumps.ini \ 6 | && echo "max_execution_time = 600" >> /usr/local/etc/php/conf.d/0-upload_large_dumps.ini \ 7 | && echo "max_input_vars = 5000" >> /usr/local/etc/php/conf.d/0-upload_large_dumps.ini 8 | 9 | STOPSIGNAL SIGINT 10 | 11 | RUN addgroup -S adminer \ 12 | && adduser -S -G adminer adminer \ 13 | && mkdir -p /var/www/html \ 14 | && mkdir /var/www/html/plugins-enabled \ 15 | && chown -R adminer:adminer /var/www/html 16 | 17 | WORKDIR /var/www/html 18 | 19 | RUN set -x \ 20 | && apk add --no-cache --virtual .build-deps \ 21 | postgresql-dev \ 22 | sqlite-dev \ 23 | unixodbc-dev \ 24 | freetds-dev \ 25 | && docker-php-ext-configure pdo_odbc --with-pdo-odbc=unixODBC,/usr \ 26 | && docker-php-ext-install \ 27 | mysqli \ 28 | pdo_pgsql \ 29 | pdo_sqlite \ 30 | pdo_odbc \ 31 | pdo_dblib \ 32 | && runDeps="$( \ 33 | scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/lib/php/extensions \ 34 | | tr ',' '\n' \ 35 | | sort -u \ 36 | | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ 37 | )" \ 38 | && apk add --virtual .phpexts-rundeps $runDeps \ 39 | && apk del --no-network .build-deps 40 | 41 | COPY *.php /var/www/html/ 42 | 43 | ENV ADMINER_VERSION=4.17.1 44 | ENV ADMINER_DOWNLOAD_SHA256=58956bc021b6b260b1a2ef32d03517f6f88f5ad4aa03ff2d0092c6f509e26d0a 45 | ENV ADMINER_SRC_DOWNLOAD_SHA256=6e006c514a3f189dd14ee10fa98977141a00fe79beb2a515966c98f0914cbdd0 46 | 47 | RUN set -x \ 48 | && curl -fsSL https://github.com/vrana/adminer/releases/download/v$ADMINER_VERSION/adminer-$ADMINER_VERSION.php -o adminer.php \ 49 | && echo "$ADMINER_DOWNLOAD_SHA256 adminer.php" |sha256sum -c - \ 50 | && curl -fsSL https://github.com/vrana/adminer/archive/v$ADMINER_VERSION.tar.gz -o source.tar.gz \ 51 | && echo "$ADMINER_SRC_DOWNLOAD_SHA256 source.tar.gz" |sha256sum -c - \ 52 | && tar xzf source.tar.gz --strip-components=1 "adminer-$ADMINER_VERSION/designs/" "adminer-$ADMINER_VERSION/plugins/" \ 53 | && rm source.tar.gz 54 | 55 | COPY entrypoint.sh /usr/local/bin/ 56 | ENTRYPOINT [ "entrypoint.sh", "docker-php-entrypoint" ] 57 | 58 | USER adminer 59 | CMD [ "php", "-S", "[::]:8080", "-t", "/var/www/html" ] 60 | 61 | EXPOSE 8080 62 | -------------------------------------------------------------------------------- /4/entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | if [ -n "$ADMINER_DESIGN" ]; then 5 | # Only create link on initial start, to ensure that explicit changes to 6 | # adminer.css after the container was started once are preserved. 7 | if [ ! -e .adminer-init ]; then 8 | ln -sf "designs/$ADMINER_DESIGN/adminer.css" . 9 | fi 10 | fi 11 | 12 | number=1 13 | for PLUGIN in $ADMINER_PLUGINS; do 14 | php plugin-loader.php "$PLUGIN" > plugins-enabled/$(printf "%03d" $number)-$PLUGIN.php 15 | number=$(($number+1)) 16 | done 17 | 18 | touch .adminer-init || true 19 | 20 | exec "$@" 21 | -------------------------------------------------------------------------------- /4/fastcgi/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM php:8.4-fpm-alpine 2 | 3 | RUN echo "upload_max_filesize = 128M" >> /usr/local/etc/php/conf.d/0-upload_large_dumps.ini \ 4 | && echo "post_max_size = 128M" >> /usr/local/etc/php/conf.d/0-upload_large_dumps.ini \ 5 | && echo "memory_limit = 1G" >> /usr/local/etc/php/conf.d/0-upload_large_dumps.ini \ 6 | && echo "max_execution_time = 600" >> /usr/local/etc/php/conf.d/0-upload_large_dumps.ini \ 7 | && echo "max_input_vars = 5000" >> /usr/local/etc/php/conf.d/0-upload_large_dumps.ini 8 | 9 | RUN addgroup -S adminer \ 10 | && adduser -S -G adminer adminer \ 11 | && mkdir -p /var/www/html \ 12 | && mkdir /var/www/html/plugins-enabled \ 13 | && chown -R adminer:adminer /var/www/html 14 | 15 | RUN set -x \ 16 | && apk add --no-cache --virtual .build-deps \ 17 | postgresql-dev \ 18 | sqlite-dev \ 19 | unixodbc-dev \ 20 | freetds-dev \ 21 | && docker-php-ext-configure pdo_odbc --with-pdo-odbc=unixODBC,/usr \ 22 | && docker-php-ext-install \ 23 | mysqli \ 24 | pdo_pgsql \ 25 | pdo_sqlite \ 26 | pdo_odbc \ 27 | pdo_dblib \ 28 | && runDeps="$( \ 29 | scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/lib/php/extensions \ 30 | | tr ',' '\n' \ 31 | | sort -u \ 32 | | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ 33 | )" \ 34 | && apk add --virtual .phpexts-rundeps $runDeps \ 35 | && apk del --no-network .build-deps 36 | 37 | COPY *.php /var/www/html/ 38 | 39 | ENV ADMINER_VERSION=4.17.1 40 | ENV ADMINER_DOWNLOAD_SHA256=58956bc021b6b260b1a2ef32d03517f6f88f5ad4aa03ff2d0092c6f509e26d0a 41 | ENV ADMINER_SRC_DOWNLOAD_SHA256=6e006c514a3f189dd14ee10fa98977141a00fe79beb2a515966c98f0914cbdd0 42 | 43 | RUN set -x \ 44 | && curl -fsSL https://github.com/vrana/adminer/releases/download/v$ADMINER_VERSION/adminer-$ADMINER_VERSION.php -o adminer.php \ 45 | && echo "$ADMINER_DOWNLOAD_SHA256 adminer.php" |sha256sum -c - \ 46 | && curl -fsSL https://github.com/vrana/adminer/archive/v$ADMINER_VERSION.tar.gz -o source.tar.gz \ 47 | && echo "$ADMINER_SRC_DOWNLOAD_SHA256 source.tar.gz" |sha256sum -c - \ 48 | && tar xzf source.tar.gz --strip-components=1 "adminer-$ADMINER_VERSION/designs/" "adminer-$ADMINER_VERSION/plugins/" \ 49 | && rm source.tar.gz 50 | 51 | COPY entrypoint.sh /usr/local/bin/ 52 | ENTRYPOINT [ "entrypoint.sh", "docker-php-entrypoint" ] 53 | 54 | USER adminer 55 | CMD [ "php-fpm" ] 56 | -------------------------------------------------------------------------------- /4/fastcgi/entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | if [ -n "$ADMINER_DESIGN" ]; then 5 | # Only create link on initial start, to ensure that explicit changes to 6 | # adminer.css after the container was started once are preserved. 7 | if [ ! -e .adminer-init ]; then 8 | ln -sf "designs/$ADMINER_DESIGN/adminer.css" . 9 | fi 10 | fi 11 | 12 | number=1 13 | for PLUGIN in $ADMINER_PLUGINS; do 14 | php plugin-loader.php "$PLUGIN" > plugins-enabled/$(printf "%03d" $number)-$PLUGIN.php 15 | number=$(($number+1)) 16 | done 17 | 18 | touch .adminer-init || true 19 | 20 | exec "$@" 21 | -------------------------------------------------------------------------------- /4/fastcgi/index.php: -------------------------------------------------------------------------------- 1 | 1) { 38 | fwrite(STDERR, 'Unable to load plugin file "'.$name.'", because it defines multiple classes.'."\n"); 39 | exit(1); 40 | } 41 | 42 | // Check constructor. 43 | $class = $classes[0]; 44 | require($file); 45 | 46 | $constructor = (new \ReflectionClass($class))->getConstructor(); 47 | 48 | if ($constructor && $constructor->getNumberOfRequiredParameters() > 0) { 49 | $requiredParameters = array_slice($constructor->getParameters(), 0, $constructor->getNumberOfRequiredParameters()); 50 | 51 | fwrite(STDERR, 'Unable to load plugin file "'.$name.'", because it has required parameters: '.implode(', ', array_map(function ($item) { 52 | return $item->getName(); 53 | }, $requiredParameters))."\n". 54 | 'Create a file "'.getcwd().'/plugins-enabled/'.$name.'.php" with the following contents to load the plugin:'."\n\n". 55 | 'getDocComment().' 59 | return new '.$class.'( 60 | '.implode(",\n\t", array_map(function ($item) { 61 | return '$'.$item->getName()." = ".($item->isOptional() ? var_export($item->getDefaultValue(), true) : '???'); 62 | }, $constructor->getParameters())).' 63 | ); 64 | '); 65 | exit(1); 66 | } 67 | 68 | echo ' 1) { 38 | fwrite(STDERR, 'Unable to load plugin file "'.$name.'", because it defines multiple classes.'."\n"); 39 | exit(1); 40 | } 41 | 42 | // Check constructor. 43 | $class = $classes[0]; 44 | require($file); 45 | 46 | $constructor = (new \ReflectionClass($class))->getConstructor(); 47 | 48 | if ($constructor && $constructor->getNumberOfRequiredParameters() > 0) { 49 | $requiredParameters = array_slice($constructor->getParameters(), 0, $constructor->getNumberOfRequiredParameters()); 50 | 51 | fwrite(STDERR, 'Unable to load plugin file "'.$name.'", because it has required parameters: '.implode(', ', array_map(function ($item) { 52 | return $item->getName(); 53 | }, $requiredParameters))."\n". 54 | 'Create a file "'.getcwd().'/plugins-enabled/'.$name.'.php" with the following contents to load the plugin:'."\n\n". 55 | 'getDocComment().' 59 | return new '.$class.'( 60 | '.implode(",\n\t", array_map(function ($item) { 61 | return '$'.$item->getName()." = ".($item->isOptional() ? var_export($item->getDefaultValue(), true) : '???'); 62 | }, $constructor->getParameters())).' 63 | ); 64 | '); 65 | exit(1); 66 | } 67 | 68 | echo '> /usr/local/etc/php/conf.d/0-upload_large_dumps.ini \ 4 | && echo "post_max_size = 128M" >> /usr/local/etc/php/conf.d/0-upload_large_dumps.ini \ 5 | && echo "memory_limit = 1G" >> /usr/local/etc/php/conf.d/0-upload_large_dumps.ini \ 6 | && echo "max_execution_time = 600" >> /usr/local/etc/php/conf.d/0-upload_large_dumps.ini \ 7 | && echo "max_input_vars = 5000" >> /usr/local/etc/php/conf.d/0-upload_large_dumps.ini 8 | 9 | STOPSIGNAL SIGINT 10 | 11 | RUN addgroup -S adminer \ 12 | && adduser -S -G adminer adminer \ 13 | && mkdir -p /var/www/html \ 14 | && mkdir /var/www/html/plugins-enabled \ 15 | && chown -R adminer:adminer /var/www/html 16 | 17 | WORKDIR /var/www/html 18 | 19 | RUN set -x \ 20 | && apk add --no-cache --virtual .build-deps \ 21 | postgresql-dev \ 22 | sqlite-dev \ 23 | unixodbc-dev \ 24 | freetds-dev \ 25 | && docker-php-ext-configure pdo_odbc --with-pdo-odbc=unixODBC,/usr \ 26 | && docker-php-ext-install \ 27 | mysqli \ 28 | pdo_pgsql \ 29 | pdo_sqlite \ 30 | pdo_odbc \ 31 | pdo_dblib \ 32 | && runDeps="$( \ 33 | scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/lib/php/extensions \ 34 | | tr ',' '\n' \ 35 | | sort -u \ 36 | | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ 37 | )" \ 38 | && apk add --virtual .phpexts-rundeps $runDeps \ 39 | && apk del --no-network .build-deps 40 | 41 | COPY *.php /var/www/html/ 42 | 43 | ENV ADMINER_VERSION=5.3.0 44 | ENV ADMINER_DOWNLOAD_SHA256=7dcc196e941b18b74635afe1740dcd86970ab08b8eba0f00f149925aea3972ed 45 | ENV ADMINER_SRC_DOWNLOAD_SHA256=b929336214ab94583dc35e7d492879d1de6e3ab75888a2ad2c86166651f2c6d8 46 | 47 | RUN set -x \ 48 | && curl -fsSL https://github.com/vrana/adminer/releases/download/v$ADMINER_VERSION/adminer-$ADMINER_VERSION.php -o adminer.php \ 49 | && echo "$ADMINER_DOWNLOAD_SHA256 adminer.php" |sha256sum -c - \ 50 | && curl -fsSL https://github.com/vrana/adminer/archive/v$ADMINER_VERSION.tar.gz -o source.tar.gz \ 51 | && echo "$ADMINER_SRC_DOWNLOAD_SHA256 source.tar.gz" |sha256sum -c - \ 52 | && tar xzf source.tar.gz --strip-components=1 "adminer-$ADMINER_VERSION/designs/" "adminer-$ADMINER_VERSION/plugins/" \ 53 | && rm source.tar.gz 54 | 55 | COPY entrypoint.sh /usr/local/bin/ 56 | ENTRYPOINT [ "entrypoint.sh", "docker-php-entrypoint" ] 57 | 58 | USER adminer 59 | CMD [ "php", "-S", "[::]:8080", "-t", "/var/www/html" ] 60 | 61 | EXPOSE 8080 62 | -------------------------------------------------------------------------------- /5/entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | if [ -n "$ADMINER_DESIGN" ]; then 5 | # Only create link on initial start, to ensure that explicit changes to 6 | # adminer.css after the container was started once are preserved. 7 | if [ ! -e .adminer-init ]; then 8 | ln -sf "designs/$ADMINER_DESIGN/adminer.css" . 9 | fi 10 | fi 11 | 12 | number=1 13 | for PLUGIN in $ADMINER_PLUGINS; do 14 | php plugin-loader.php "$PLUGIN" > plugins-enabled/$(printf "%03d" $number)-$PLUGIN.php 15 | number=$(($number+1)) 16 | done 17 | 18 | touch .adminer-init || true 19 | 20 | exec "$@" 21 | -------------------------------------------------------------------------------- /5/fastcgi/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM php:8.4-fpm-alpine 2 | 3 | RUN echo "upload_max_filesize = 128M" >> /usr/local/etc/php/conf.d/0-upload_large_dumps.ini \ 4 | && echo "post_max_size = 128M" >> /usr/local/etc/php/conf.d/0-upload_large_dumps.ini \ 5 | && echo "memory_limit = 1G" >> /usr/local/etc/php/conf.d/0-upload_large_dumps.ini \ 6 | && echo "max_execution_time = 600" >> /usr/local/etc/php/conf.d/0-upload_large_dumps.ini \ 7 | && echo "max_input_vars = 5000" >> /usr/local/etc/php/conf.d/0-upload_large_dumps.ini 8 | 9 | RUN addgroup -S adminer \ 10 | && adduser -S -G adminer adminer \ 11 | && mkdir -p /var/www/html \ 12 | && mkdir /var/www/html/plugins-enabled \ 13 | && chown -R adminer:adminer /var/www/html 14 | 15 | RUN set -x \ 16 | && apk add --no-cache --virtual .build-deps \ 17 | postgresql-dev \ 18 | sqlite-dev \ 19 | unixodbc-dev \ 20 | freetds-dev \ 21 | && docker-php-ext-configure pdo_odbc --with-pdo-odbc=unixODBC,/usr \ 22 | && docker-php-ext-install \ 23 | mysqli \ 24 | pdo_pgsql \ 25 | pdo_sqlite \ 26 | pdo_odbc \ 27 | pdo_dblib \ 28 | && runDeps="$( \ 29 | scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/lib/php/extensions \ 30 | | tr ',' '\n' \ 31 | | sort -u \ 32 | | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ 33 | )" \ 34 | && apk add --virtual .phpexts-rundeps $runDeps \ 35 | && apk del --no-network .build-deps 36 | 37 | COPY *.php /var/www/html/ 38 | 39 | ENV ADMINER_VERSION=5.3.0 40 | ENV ADMINER_DOWNLOAD_SHA256=7dcc196e941b18b74635afe1740dcd86970ab08b8eba0f00f149925aea3972ed 41 | ENV ADMINER_SRC_DOWNLOAD_SHA256=b929336214ab94583dc35e7d492879d1de6e3ab75888a2ad2c86166651f2c6d8 42 | 43 | RUN set -x \ 44 | && curl -fsSL https://github.com/vrana/adminer/releases/download/v$ADMINER_VERSION/adminer-$ADMINER_VERSION.php -o adminer.php \ 45 | && echo "$ADMINER_DOWNLOAD_SHA256 adminer.php" |sha256sum -c - \ 46 | && curl -fsSL https://github.com/vrana/adminer/archive/v$ADMINER_VERSION.tar.gz -o source.tar.gz \ 47 | && echo "$ADMINER_SRC_DOWNLOAD_SHA256 source.tar.gz" |sha256sum -c - \ 48 | && tar xzf source.tar.gz --strip-components=1 "adminer-$ADMINER_VERSION/designs/" "adminer-$ADMINER_VERSION/plugins/" \ 49 | && rm source.tar.gz 50 | 51 | COPY entrypoint.sh /usr/local/bin/ 52 | ENTRYPOINT [ "entrypoint.sh", "docker-php-entrypoint" ] 53 | 54 | USER adminer 55 | CMD [ "php-fpm" ] 56 | -------------------------------------------------------------------------------- /5/fastcgi/entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | if [ -n "$ADMINER_DESIGN" ]; then 5 | # Only create link on initial start, to ensure that explicit changes to 6 | # adminer.css after the container was started once are preserved. 7 | if [ ! -e .adminer-init ]; then 8 | ln -sf "designs/$ADMINER_DESIGN/adminer.css" . 9 | fi 10 | fi 11 | 12 | number=1 13 | for PLUGIN in $ADMINER_PLUGINS; do 14 | php plugin-loader.php "$PLUGIN" > plugins-enabled/$(printf "%03d" $number)-$PLUGIN.php 15 | number=$(($number+1)) 16 | done 17 | 18 | touch .adminer-init || true 19 | 20 | exec "$@" 21 | -------------------------------------------------------------------------------- /5/fastcgi/index.php: -------------------------------------------------------------------------------- 1 | loginFormField(...$args); 15 | 16 | return \str_replace( 17 | 'name="auth[server]" value="" title="hostname[:port]"', 18 | \sprintf('name="auth[server]" value="%s" title="hostname[:port]"', ($_ENV['ADMINER_DEFAULT_SERVER'] ?: 'db')), 19 | $field, 20 | ); 21 | })->call($this->adminer, ...$args); 22 | } 23 | } 24 | 25 | $plugins = []; 26 | foreach (glob('plugins-enabled/*.php') as $plugin) { 27 | $plugins[] = require($plugin); 28 | } 29 | 30 | $adminer = new \Adminer\Plugins($plugins); 31 | 32 | (function () { 33 | $last = &$this->hooks['loginFormField'][\array_key_last($this->hooks['loginFormField'])]; 34 | if ($last instanceof \Adminer\Adminer) { 35 | $defaultServerPlugin = new DefaultServerPlugin($last); 36 | $this->plugins[] = $defaultServerPlugin; 37 | $last = $defaultServerPlugin; 38 | } 39 | })->call($adminer); 40 | 41 | return $adminer; 42 | } 43 | } 44 | 45 | namespace { 46 | if (basename($_SERVER['DOCUMENT_URI'] ?? $_SERVER['REQUEST_URI']) === 'adminer.css' && is_readable('adminer.css')) { 47 | header('Content-Type: text/css'); 48 | readfile('adminer.css'); 49 | exit; 50 | } 51 | 52 | function adminer_object() { 53 | return \docker\adminer_object(); 54 | } 55 | 56 | require('adminer.php'); 57 | } 58 | -------------------------------------------------------------------------------- /5/fastcgi/plugin-loader.php: -------------------------------------------------------------------------------- 1 | 1) { 39 | fwrite(STDERR, 'Unable to load plugin file "'.$name.'", because it defines multiple classes.'."\n"); 40 | exit(1); 41 | } 42 | 43 | if (!class_exists(\Adminer\Plugin::class)) { 44 | class_alias(stdClass::class, \Adminer\Plugin::class); 45 | } 46 | 47 | // Check constructor. 48 | $class = $classes[0]; 49 | require($file); 50 | 51 | $constructor = (new \ReflectionClass($class))->getConstructor(); 52 | 53 | if ($constructor && $constructor->getNumberOfRequiredParameters() > 0) { 54 | $requiredParameters = array_slice($constructor->getParameters(), 0, $constructor->getNumberOfRequiredParameters()); 55 | 56 | fwrite(STDERR, 'Unable to load plugin file "'.$name.'", because it has required parameters: '.implode(', ', array_map(function ($item) { 57 | return $item->getName(); 58 | }, $requiredParameters))."\n". 59 | 'Create a file "'.getcwd().'/plugins-enabled/'.$name.'.php" with the following contents to load the plugin:'."\n\n". 60 | 'getDocComment().' 64 | return new '.$class.'( 65 | '.implode(",\n\t", array_map(function ($item) { 66 | return '$'.$item->getName()." = ".($item->isOptional() ? var_export($item->getDefaultValue(), true) : '???'); 67 | }, $constructor->getParameters())).' 68 | ); 69 | '); 70 | exit(1); 71 | } 72 | 73 | echo 'loginFormField(...$args); 15 | 16 | return \str_replace( 17 | 'name="auth[server]" value="" title="hostname[:port]"', 18 | \sprintf('name="auth[server]" value="%s" title="hostname[:port]"', ($_ENV['ADMINER_DEFAULT_SERVER'] ?: 'db')), 19 | $field, 20 | ); 21 | })->call($this->adminer, ...$args); 22 | } 23 | } 24 | 25 | $plugins = []; 26 | foreach (glob('plugins-enabled/*.php') as $plugin) { 27 | $plugins[] = require($plugin); 28 | } 29 | 30 | $adminer = new \Adminer\Plugins($plugins); 31 | 32 | (function () { 33 | $last = &$this->hooks['loginFormField'][\array_key_last($this->hooks['loginFormField'])]; 34 | if ($last instanceof \Adminer\Adminer) { 35 | $defaultServerPlugin = new DefaultServerPlugin($last); 36 | $this->plugins[] = $defaultServerPlugin; 37 | $last = $defaultServerPlugin; 38 | } 39 | })->call($adminer); 40 | 41 | return $adminer; 42 | } 43 | } 44 | 45 | namespace { 46 | if (basename($_SERVER['DOCUMENT_URI'] ?? $_SERVER['REQUEST_URI']) === 'adminer.css' && is_readable('adminer.css')) { 47 | header('Content-Type: text/css'); 48 | readfile('adminer.css'); 49 | exit; 50 | } 51 | 52 | function adminer_object() { 53 | return \docker\adminer_object(); 54 | } 55 | 56 | require('adminer.php'); 57 | } 58 | -------------------------------------------------------------------------------- /5/plugin-loader.php: -------------------------------------------------------------------------------- 1 | 1) { 39 | fwrite(STDERR, 'Unable to load plugin file "'.$name.'", because it defines multiple classes.'."\n"); 40 | exit(1); 41 | } 42 | 43 | if (!class_exists(\Adminer\Plugin::class)) { 44 | class_alias(stdClass::class, \Adminer\Plugin::class); 45 | } 46 | 47 | // Check constructor. 48 | $class = $classes[0]; 49 | require($file); 50 | 51 | $constructor = (new \ReflectionClass($class))->getConstructor(); 52 | 53 | if ($constructor && $constructor->getNumberOfRequiredParameters() > 0) { 54 | $requiredParameters = array_slice($constructor->getParameters(), 0, $constructor->getNumberOfRequiredParameters()); 55 | 56 | fwrite(STDERR, 'Unable to load plugin file "'.$name.'", because it has required parameters: '.implode(', ', array_map(function ($item) { 57 | return $item->getName(); 58 | }, $requiredParameters))."\n". 59 | 'Create a file "'.getcwd().'/plugins-enabled/'.$name.'.php" with the following contents to load the plugin:'."\n\n". 60 | 'getDocComment().' 64 | return new '.$class.'( 65 | '.implode(",\n\t", array_map(function ($item) { 66 | return '$'.$item->getName()." = ".($item->isOptional() ? var_export($item->getDefaultValue(), true) : '???'); 67 | }, $constructor->getParameters())).' 68 | ); 69 | '); 70 | exit(1); 71 | } 72 | 73 | echo ' 16 | -------------------------------------------------------------------------------- /generate-stackbrew-library.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -Eeuo pipefail 3 | 4 | declare -A aliases=( 5 | [5]='latest' 6 | ) 7 | 8 | self="$(basename "$BASH_SOURCE")" 9 | cd "$(dirname "$(readlink -f "$BASH_SOURCE")")" 10 | 11 | if [ "$#" -eq 0 ]; then 12 | versions=( */ ) 13 | versions=( "${versions[@]%/}" ) 14 | eval "set -- ${versions[@]}" 15 | fi 16 | 17 | # sort version numbers with highest first 18 | IFS=$'\n'; set -- $(sort -rV <<<"$*"); unset IFS 19 | 20 | # get the most recent commit which modified any of "$@" 21 | fileCommit() { 22 | git log -1 --format='format:%H' HEAD -- "$@" 23 | } 24 | 25 | # get the most recent commit which modified "$1/Dockerfile" or any file COPY'd from "$1/Dockerfile" 26 | dirCommit() { 27 | local dir="$1"; shift 28 | ( 29 | cd "$dir" 30 | fileCommit \ 31 | Dockerfile \ 32 | $(git show HEAD:./Dockerfile | awk ' 33 | toupper($1) == "COPY" { 34 | for (i = 2; i < NF; i++) { 35 | print $i 36 | } 37 | } 38 | ') 39 | ) 40 | } 41 | 42 | getArches() { 43 | local repo="$1"; shift 44 | local officialImagesBase="${BASHBREW_LIBRARY:-https://github.com/docker-library/official-images/raw/HEAD/library}/" 45 | 46 | local parentRepoToArchesStr 47 | parentRepoToArchesStr="$( 48 | find -name 'Dockerfile' -exec awk -v officialImagesBase="$officialImagesBase" ' 49 | toupper($1) == "FROM" && $2 !~ /^('"$repo"'|scratch|.*\/.*)(:|$)/ { 50 | printf "%s%s\n", officialImagesBase, $2 51 | } 52 | ' '{}' + \ 53 | | sort -u \ 54 | | xargs -r bashbrew cat --format '["{{ .RepoName }}:{{ .TagName }}"]="{{ join " " .TagEntry.Architectures }}"' 55 | )" 56 | eval "declare -g -A parentRepoToArches=( $parentRepoToArchesStr )" 57 | } 58 | getArches 'adminer' 59 | 60 | cat <<-EOH 61 | # this file is generated via https://github.com/TimWolla/docker-adminer/blob/$(fileCommit "$self")/$self 62 | 63 | Maintainers: Tim Düsterhus (@TimWolla) 64 | GitRepo: https://github.com/TimWolla/docker-adminer.git 65 | EOH 66 | 67 | # prints "$2$1$3$1...$N" 68 | join() { 69 | local sep="$1"; shift 70 | local out; printf -v out "${sep//%/%%}%s" "$@" 71 | echo "${out#$sep}" 72 | } 73 | 74 | for version; do 75 | export version 76 | 77 | commit="$(dirCommit "$version")" 78 | 79 | fullVersion="$(git show "$commit":"$version/Dockerfile" | awk ' 80 | $1 == "ENV" { env=1 } 81 | env { 82 | for (i=1; i <= NF; i++) { 83 | split($i, a, "="); 84 | if (a[1] == "ADMINER_VERSION") { print a[2]; exit } 85 | } 86 | } 87 | env && !/\\$/ { env=0 } 88 | ')" 89 | 90 | versionAliases=( 91 | $fullVersion 92 | $version 93 | ${aliases[$version]:-} 94 | ) 95 | 96 | for variant in '' fastcgi; do 97 | export variant 98 | dir="$version${variant:+/$variant}" 99 | if [ ! -d "$dir" ]; then 100 | continue 101 | fi 102 | 103 | commit="$(dirCommit "$dir")" 104 | 105 | if [ -n "$variant" ]; then 106 | variantAliases=( "${versionAliases[@]/%/-$variant}" ) 107 | variantAliases=( "${variantAliases[@]//latest-/}" ) 108 | else 109 | variantAliases=( "${versionAliases[@]}" ) 110 | variantAliases+=( "${versionAliases[@]/%/-standalone}" ) 111 | variantAliases=( "${variantAliases[@]//latest-/}" ) 112 | fi 113 | 114 | parent="$(awk 'toupper($1) == "FROM" { print $2 }' "$dir/Dockerfile")" 115 | arches="${parentRepoToArches[$parent]}" 116 | 117 | echo 118 | cat <<-EOE 119 | Tags: $(join ', ' "${variantAliases[@]}") 120 | Architectures: $(join ', ' $arches) 121 | GitCommit: $commit 122 | Directory: $dir 123 | EOE 124 | done 125 | done 126 | -------------------------------------------------------------------------------- /update.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -Eeuo pipefail 3 | 4 | cd "$(dirname "$(readlink -f "$BASH_SOURCE")")" 5 | 6 | versions=( "$@" ) 7 | if [ ${#versions[@]} -eq 0 ]; then 8 | versions=( */ ) 9 | fi 10 | versions=( "${versions[@]%/}" ) 11 | 12 | allVersions="$( 13 | git ls-remote --tags https://github.com/vrana/adminer.git \ 14 | | cut -d$'\t' -f2 \ 15 | | grep -E '^refs/tags/v[0-9]+\.[0-9]+' \ 16 | | cut -dv -f2 \ 17 | | sort -rV 18 | )" 19 | 20 | for version in "${versions[@]}"; do 21 | fullVersion="$( 22 | grep -E "^${version}([.-]|$)" <<<"$allVersions" \ 23 | | head -1 24 | )" 25 | if [ -z "$fullVersion" ]; then 26 | echo >&2 "error: cannot determine full version for '$version'" 27 | fi 28 | 29 | echo "$version: $fullVersion" 30 | 31 | downloadSha256="$( 32 | curl -fsSL "https://github.com/vrana/adminer/releases/download/v${fullVersion}/adminer-${fullVersion}.php" \ 33 | | sha256sum \ 34 | | cut -d' ' -f1 35 | )" 36 | echo " - adminer-${fullVersion}.php: $downloadSha256" 37 | 38 | srcDownloadSha256="$( 39 | curl -fsSL "https://github.com/vrana/adminer/archive/v${fullVersion}.tar.gz" \ 40 | | sha256sum \ 41 | | cut -d' ' -f1 42 | )" 43 | echo " - v${fullVersion}.tar.gz: $srcDownloadSha256" 44 | 45 | sed -ri \ 46 | -e 's/^(ENV\s+ADMINER_VERSION=).*/\1'"$fullVersion"'/' \ 47 | -e 's/^(ENV\s+ADMINER_DOWNLOAD_SHA256=).*/\1'"$downloadSha256"'/' \ 48 | -e 's/^(ENV\s+ADMINER_SRC_DOWNLOAD_SHA256=).*/\1'"$srcDownloadSha256"'/' \ 49 | "$version/fastcgi/Dockerfile" \ 50 | "$version/Dockerfile" 51 | done 52 | --------------------------------------------------------------------------------