├── .editorconfig ├── .gitattributes ├── .gitignore ├── LICENSE ├── Makefile ├── README.md ├── docker-compose.yml └── docker ├── Dockerfile ├── config ├── caddy │ └── Caddyfile └── php-fpm.d │ └── zzz-php-fpm_custom.conf └── etc └── docker-entrypoint.sh /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig is awesome: http://EditorConfig.org 2 | 3 | # top-most EditorConfig file 4 | root = true 5 | 6 | # Unix-style newlines with a newline ending every file 7 | [*] 8 | charset = utf-8 9 | end_of_line = lf 10 | insert_final_newline = true 11 | 12 | [*.{yml,yaml}] 13 | indent_style = space 14 | indent_size = 2 15 | 16 | [*.{neon,neon.dist}] 17 | indent_style = tab 18 | indent_size = 4 19 | 20 | [*.{md,txt}] 21 | indent_style = space 22 | indent_size = 4 23 | trim_trailing_whitespace = false 24 | 25 | [{Makefile,Caddyfile,*.Caddyfile}] 26 | indent_style = tab 27 | tab_width = 4 28 | 29 | [{Dockerfile,Dockerfile.template.erb,Dockerfile-alpine}] 30 | indent_style = space 31 | indent_size = 4 32 | 33 | [*.env] 34 | insert_final_newline = false 35 | trim_trailing_whitespace = false 36 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto eol=lf 2 | /.github export-ignore 3 | /docs export-ignore 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /.vscode 2 | /.idea 3 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) Alexander Tebiev / alexander.tebiev@gmail.com / https://github.com/beeyev 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # Alexander Tebiev - https://github.com/beeyev 2 | 3 | .EXPORT_ALL_VARIABLES: 4 | .PHONY: * 5 | .DEFAULT_GOAL := help 6 | 7 | ifeq (,$(shell command docker compose 2> /dev/null)) 8 | DOCKER_COMPOSE_COMMAND = docker-compose 9 | else 10 | DOCKER_COMPOSE_COMMAND = docker compose 11 | endif 12 | 13 | help: ## Show this help 14 | @echo "Make Application Docker Images and Containers using Docker-Compose files in 'docker' Dir." 15 | @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m (default: help)\n\nTargets:\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-12s\033[0m %s\n", $$1, $$2 }' $(MAKEFILE_LIST) 16 | 17 | up: ## Docker compose up 18 | $(DOCKER_COMPOSE_COMMAND) up --build --no-deps --detach --remove-orphans 19 | 20 | start: 21 | make up 22 | 23 | down: ## Docker compose down 24 | $(DOCKER_COMPOSE_COMMAND) down --remove-orphans 25 | 26 | stop: ## Docker compose stop 27 | $(DOCKER_COMPOSE_COMMAND) stop 28 | 29 | restart: ## Restart containers 30 | make down 31 | make up 32 | $(info Restart completed) 33 | 34 | update: ## Update containers 35 | $(DOCKER_COMPOSE_COMMAND) pull 36 | make up 37 | 38 | destroy: ## Destroy containers/volumes (keep sources app folders) 39 | make stop 40 | $(DOCKER_COMPOSE_COMMAND) down --rmi all --remove-orphans 41 | 42 | rebuild: ## Rebuild docker container (destroy & upgrade) 43 | make destroy 44 | make up 45 | 46 | state: ## Show current state 47 | docker ps --format=table 48 | 49 | logs: ## Show docker logs 50 | $(DOCKER_COMPOSE_COMMAND) logs -f --tail=100 $(ARGS) 51 | 52 | phpmyadmin: 53 | $(DOCKER_COMPOSE_COMMAND) exec phpmyadmin bash 54 | @printf "\n http://localhost:8080/ \n" 55 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # phpMyAdmin Docker Lightweight 2 | 3 | > Super lightweight and fully function phpMyAdmin Docker image, it includes webserver and everything needed to work out of the box. 4 | 5 |

6 | 7 | This project is built on top of the official phpMyAdmin fpm-alpine image, it includes Caddy webserver and extra dark themes. 8 | The image is automatically updated, so the latests phpMyAdmin version is always supported. 9 | 10 |
11 | Extra themes included into the image ▼ 12 | 13 | `blueberry` 14 | 15 | ![](https://github.com/beeyev/phpmyadmin-docker-lightweight/raw/master/docs/theme-blueberry.png) 16 | 17 | 18 | `BooDark` 19 | 20 | ![](https://github.com/beeyev/phpmyadmin-docker-lightweight/raw/master/docs/theme-BooDark.png) 21 | 22 |
23 | 24 | ## Docker repository 25 | [Docker Hub](https://hub.docker.com/r/beeyev/phpmyadmin-lightweight) 26 | `docker pull beeyev/phpmyadmin-lightweight:latest` 27 | 28 | [GitHub Packages](https://github.com/beeyev/phpmyadmin-docker-lightweight/pkgs/container/phpmyadmin-docker-lightweight) 29 | `docker pull ghcr.io/beeyev/phpmyadmin-docker-lightweight:latest` 30 | 31 | ## How to use 32 | 33 | Example: [`docker-compose.yml`](https://github.com/beeyev/phpmyadmin-docker-lightweight/raw/master/docker-compose.yml) 34 | 35 | ### Custom Configuration & environment variables 36 | 37 | Follow the [official phpmyadmin documentation](https://github.com/phpmyadmin/docker#adding-custom-configuration) 38 | 39 | ## License 40 | 41 | The MIT License (MIT). Please see [License File](https://github.com/beeyev/phpmyadmin-docker-lightweight/blob/master/LICENSE) for more information. 42 | 43 | --- 44 | If you like this project, please consider giving me a ⭐ 45 | 46 | ![](https://visitor-badge.laobi.icu/badge?page_id=beeyev.phpmyadmin-docker-lightweight) [![Docker Pulls](https://img.shields.io/docker/pulls/beeyev/phpmyadmin-lightweight)](https://hub.docker.com/r/beeyev/phpmyadmin-lightweight) 47 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | # Alexander Tebiev - https://github.com/beeyev 2 | 3 | services: 4 | phpmyadmin: 5 | image: beeyev/phpmyadmin-lightweight:latest 6 | container_name: 'phpmyadmin' 7 | restart: unless-stopped 8 | tty: true 9 | environment: 10 | - 'TZ=CET' 11 | - 'PMA_HOST=mysql' 12 | - 'PMA_USER=root' 13 | - 'PMA_PASSWORD=TestRootPassword' 14 | ports: 15 | - '8080:80' 16 | depends_on: 17 | - mysql 18 | networks: 19 | - network1 20 | 21 | mysql: 22 | image: bitnami/mysql:8.0 23 | container_name: 'mysql' 24 | restart: unless-stopped 25 | tty: true 26 | environment: 27 | - 'TZ=CET' 28 | - 'MYSQL_ROOT_PASSWORD=TestRootPassword' 29 | networks: 30 | - network1 31 | 32 | networks: 33 | network1: 34 | driver: bridge 35 | -------------------------------------------------------------------------------- /docker/Dockerfile: -------------------------------------------------------------------------------- 1 | # syntax=docker/dockerfile:1 2 | # Author: Alexander Tebiev - https://github.com/beeyev/phpmyadmin-docker-lightweight 3 | # docker buildx build --build-arg=BASE_IMAGE_VERSION=5.2-fpm-alpine --cache-to=type=inline --pull --tag phpmyadmin-fpm-alpine-caddy --file ./docker/Dockerfile ./ && docker run -p 9090:80 -it --rm phpmyadmin-fpm-alpine-caddy 4 | ARG BASE_IMAGE_VERSION 5 | FROM phpmyadmin:${BASE_IMAGE_VERSION} AS phpmyadmin 6 | 7 | FROM alpine:3 AS phpmyadmin-themes 8 | WORKDIR /src/ 9 | RUN set -eux \ 10 | && apk add --quiet --no-cache \ 11 | curl \ 12 | unzip \ 13 | && curl -fsSL https://github.com/phpmyadmin/themes/archive/refs/heads/master.zip --output /src/phpmyadmin-themes.zip \ 14 | && unzip -uoq /src/phpmyadmin-themes.zip -d /src/ \ 15 | && mkdir /src/selected-themes/ \ 16 | && cp -r /src/themes-master/blueberry/ /src/themes-master/boodark/ -t /src/selected-themes/ 17 | 18 | 19 | FROM phpmyadmin 20 | 21 | ENV TERM="xterm-256color" \ 22 | LANGUAGE="en_US.UTF-8" \ 23 | LANG="en_US.UTF-8" \ 24 | LC_TIME="en_DK.UTF-8" \ 25 | TIME_STYLE="long-iso" 26 | 27 | RUN --mount=type=cache,sharing=locked,target=/var/cache/apk/ set -eux \ 28 | && apk add --quiet --update --no-cache \ 29 | iputils \ 30 | # `fcgi` - Healthcheck | https://github.com/renatomefi/php-fpm-healthcheck 31 | fcgi \ 32 | tini 33 | 34 | # Caddy | https://caddyserver.com/ 35 | COPY --from=caddy:2-alpine /usr/bin/caddy /usr/local/bin/caddy 36 | COPY ./docker/config/caddy/Caddyfile /etc/caddy/Caddyfile 37 | ENV ACME_AGREE=true 38 | RUN set -eux \ 39 | && caddy validate --config /etc/caddy/Caddyfile \ 40 | && caddy version 41 | 42 | ## Healthcheck | https://github.com/renatomefi/php-fpm-healthcheck 43 | ADD --chmod=0705 --link https://raw.githubusercontent.com/renatomefi/php-fpm-healthcheck/master/php-fpm-healthcheck /usr/local/bin/php-fpm-healthcheck 44 | RUN set -eux \ 45 | && echo "pm.status_path = /status" >> /usr/local/etc/php-fpm.d/zz-docker.conf 46 | # Cheching Caddy & php-fpm 47 | HEALTHCHECK --interval=1m --timeout=1s --start-period=10s CMD (curl --fail http://localhost:9999/health && php-fpm-healthcheck) || exit 1 48 | 49 | COPY ./docker/config/php-fpm.d/zzz-php-fpm_custom.conf /usr/local/etc/php-fpm.d/zzz-php-fpm_custom.conf 50 | 51 | # Install themes 52 | COPY --from=phpmyadmin-themes /src/selected-themes/ /var/www/html/themes/ 53 | 54 | LABEL org.opencontainers.image.title="phpMyAdmin Docker image" \ 55 | org.opencontainers.image.description="Run phpMyAdmin with Alpine, PHP FPM and Caddy" \ 56 | org.opencontainers.image.authors="https://github.com/beeyev/" \ 57 | org.opencontainers.image.vendor="phpMyAdmin" \ 58 | org.opencontainers.image.documentation="https://github.com/beeyev/phpmyadmin-docker-lightweight" \ 59 | org.opencontainers.image.url="https://github.com/beeyev/phpmyadmin-docker-lightweight" \ 60 | org.opencontainers.image.source="https://github.com/beeyev/phpmyadmin-docker-lightweight" 61 | 62 | ARG TZ='UTC' 63 | ENV TZ=$TZ 64 | 65 | #These params meant to be set by CI 66 | ARG BUILD_DATE=undefined 67 | ENV BUILD_DATE=$BUILD_DATE 68 | RUN echo $BUILD_DATE 69 | ARG BUILD_FINGERPRINT=undefined 70 | ENV BUILD_FINGERPRINT=$BUILD_FINGERPRINT 71 | RUN echo $BUILD_FINGERPRINT 72 | ARG BRANCH_NAME=undefined 73 | ENV BRANCH_NAME=$BRANCH_NAME 74 | RUN echo $BRANCH_NAME 75 | 76 | RUN set -eux \ 77 | && mv /docker-entrypoint.sh /phpmyadmin-docker-entrypoint.sh 78 | 79 | COPY --chmod=0755 ./docker/etc/docker-entrypoint.sh /docker-entrypoint.sh 80 | ENTRYPOINT ["tini", "--", "/docker-entrypoint.sh"] 81 | EXPOSE 80 82 | -------------------------------------------------------------------------------- /docker/config/caddy/Caddyfile: -------------------------------------------------------------------------------- 1 | { 2 | auto_https off 3 | admin off 4 | log { 5 | level WARN 6 | } 7 | servers { 8 | trusted_proxies static 0.0.0.0/0 ::/0 9 | } 10 | } 11 | 12 | :80 { 13 | root * /var/www/html/ 14 | php_fastcgi localhost:9000 15 | file_server 16 | encode zstd gzip 17 | } 18 | 19 | # Internal healthcheck 20 | :9999 { 21 | handle /health { 22 | respond "OK" 200 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /docker/config/php-fpm.d/zzz-php-fpm_custom.conf: -------------------------------------------------------------------------------- 1 | [global] 2 | ; global config goes here 3 | 4 | [www] 5 | ; www config goes here 6 | ; Uncomment the line below if you want to store logs in a file instead of sending them into `stderr` 7 | ; php_admin_value[error_log] = /var/log/php/php-fpm-errors.log 8 | 9 | access.log = /dev/null 10 | -------------------------------------------------------------------------------- /docker/etc/docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Alexander Tebiev - https://github.com/beeyev 3 | 4 | #String Colors 5 | NC='\033[0;m' # Default Color 6 | GRN='\033[32;1m' 7 | RED='\033[31;1m' 8 | BLK='\033[30;1m' 9 | 10 | # Set the number of cpu cores 11 | export NUM_CPUS=`nproc` 12 | 13 | # Run custom script before the main docker process gets started 14 | for f in /docker-entrypoint.init.d/*; do 15 | case "$f" in 16 | *.sh) # this should match the set of files we check for below 17 | echo "⚙ Executing entrypoint.init file: ${f}" 18 | . $f 19 | break 20 | ;; 21 | esac 22 | done 23 | 24 | printf "\n${GRN}--->${NC} 🚀 Starting ${GRN}beeyev phpMyAdmin v.${VERSION} lightweight${NC} container..." 25 | printf "\n${GRN}--->${NC} Docker image build date: ${GRN}${BUILD_DATE}${NC}, fingerprint: ${GRN}${BUILD_FINGERPRINT}${NC}" 26 | printf "\n${GRN}--->${NC} Subscribe to the project updates: ${GRN}https://github.com/beeyev/phpmyadmin-docker-lightweight${NC}" 27 | 28 | printf "\n\nCaddy version:\n" 29 | caddy version 30 | 31 | printf "\nPHP-FPM version:\n" 32 | php-fpm --version 33 | printf "\n" 34 | 35 | caddy start --adapter caddyfile --config /etc/caddy/Caddyfile 36 | 37 | exec /phpmyadmin-docker-entrypoint.sh php-fpm 38 | --------------------------------------------------------------------------------