mirror of
https://github.com/bckelley/phpmyadmin-docker-lightweight.git
synced 2026-08-24 03:24:11 -05:00
First commit
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
# EditorConfig is awesome: http://EditorConfig.org
|
||||
|
||||
# top-most EditorConfig file
|
||||
root = true
|
||||
|
||||
# Unix-style newlines with a newline ending every file
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
|
||||
[*.{yml,yaml}]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
[*.{neon,neon.dist}]
|
||||
indent_style = tab
|
||||
indent_size = 4
|
||||
|
||||
[*.{md,txt}]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
[{Makefile,Caddyfile,*.Caddyfile}]
|
||||
indent_style = tab
|
||||
tab_width = 4
|
||||
|
||||
[{Dockerfile,Dockerfile.template.erb,Dockerfile-alpine}]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
[*.env]
|
||||
insert_final_newline = false
|
||||
trim_trailing_whitespace = false
|
||||
@@ -0,0 +1 @@
|
||||
* text=auto eol=lf
|
||||
@@ -0,0 +1,19 @@
|
||||
# To get started with Dependabot version updates, you'll need to specify which
|
||||
# package ecosystems to update and where the package manifests are located.
|
||||
# Please see the documentation for all configuration options:
|
||||
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
|
||||
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: "docker"
|
||||
directory: "/docker/"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
|
||||
# Enable version updates for Actions
|
||||
- package-ecosystem: "github-actions"
|
||||
# Look for `.github/workflows` in the `root` directory
|
||||
directory: "/"
|
||||
# Check for updates once a week
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
@@ -0,0 +1,99 @@
|
||||
name: CI
|
||||
|
||||
# Controls when the workflow will run
|
||||
on:
|
||||
# Triggers the workflow on push or pull request events but only for the master branch
|
||||
push:
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
|
||||
schedule:
|
||||
- cron: "0 0 * * 6"
|
||||
|
||||
# Allows you to run this workflow manually from the Actions tab
|
||||
workflow_dispatch:
|
||||
|
||||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
|
||||
jobs:
|
||||
|
||||
build-gearman:
|
||||
name: Build, test and publish - ${{ matrix.release_image_version }}
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
base_image_version: [ '5.2-fpm-alpine', 'fpm-alpine' ]
|
||||
include:
|
||||
- base_image_version: '5.2-fpm-alpine'
|
||||
release_image_version: '5.2'
|
||||
- base_image_version: 'fpm-alpine'
|
||||
release_image_version: 'latest'
|
||||
|
||||
steps:
|
||||
-
|
||||
name: Prepare env variables
|
||||
run: |
|
||||
echo "BUILD_DATE=$(TZ=':UTC' date +'%Y-%m-%d %H:%M:%S (%Z)')" >> ${GITHUB_ENV}
|
||||
echo "BUILD_FINGERPRINT=${GITHUB_SHA::7}" >> ${GITHUB_ENV}
|
||||
|
||||
-
|
||||
name: Check out code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
-
|
||||
name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
-
|
||||
name: Login to DockerHub
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
-
|
||||
name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GH_TOKEN }}
|
||||
|
||||
-
|
||||
name: Build images and push to registry
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
platforms: linux/amd64
|
||||
cache-from: type=gha, scope=${{ github.workflow }}-${{ matrix.version }}
|
||||
cache-to: type=gha, scope=${{ github.workflow }}-${{ matrix.version }}, mode=max
|
||||
context: .
|
||||
file: ./docker/Dockerfile
|
||||
build-args: |
|
||||
BUILD_DATE=${{ env.BUILD_DATE }}
|
||||
BUILD_FINGERPRINT=${{ env.BUILD_FINGERPRINT }}
|
||||
BASE_IMAGE_VERSION=${{ matrix.base_image_version }}
|
||||
tags: |
|
||||
beeyev/phpmyadmin-lightweight:${{ matrix.release_image_version }}
|
||||
ghcr.io/beeyev/phpmyadmin-docker-lightweight:${{ matrix.release_image_version }}
|
||||
pull: true
|
||||
push: true
|
||||
|
||||
|
||||
Update-Docker-Hub-repo-description:
|
||||
name: Update Docker Hub repo description
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
-
|
||||
name: Check out code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
-
|
||||
name: Update Docker Hub repo description
|
||||
uses: peter-evans/dockerhub-description@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
||||
repository: beeyev/phpmyadmin-lightweight
|
||||
#short-description: ${{ github.event.repository.description }}
|
||||
@@ -0,0 +1,2 @@
|
||||
/.vscode
|
||||
/.idea
|
||||
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Alexander Tebiev / tebiev@mail.com / https://github.com/beeyev
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -0,0 +1,27 @@
|
||||
THIS_FILE := $(abspath $(lastword $(MAKEFILE_LIST)))
|
||||
CURRENT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
|
||||
|
||||
up:
|
||||
docker-compose up --build --no-deps --detach --remove-orphans
|
||||
|
||||
down:
|
||||
docker-compose down --remove-orphans
|
||||
|
||||
stop:
|
||||
docker-compose stop
|
||||
|
||||
update:
|
||||
docker-compose pull
|
||||
make up
|
||||
|
||||
restart: down up
|
||||
$(info Restart completed)
|
||||
|
||||
state:
|
||||
docker ps --format=table
|
||||
|
||||
logs: ## Show docker logs
|
||||
docker-compose logs -f --tail=100 $(ARGS)
|
||||
|
||||
phpmyadmin:
|
||||
docker-compose exec phpmyadmin bash
|
||||
@@ -0,0 +1,32 @@
|
||||
version: "3"
|
||||
|
||||
services:
|
||||
phpmyadmin:
|
||||
image: beeyev/phpmyadmin-lightweight:latest
|
||||
container_name: 'phpmyadmin'
|
||||
restart: unless-stopped
|
||||
tty: true
|
||||
environment:
|
||||
- 'TZ=CET'
|
||||
- 'PMA_HOST=mysql'
|
||||
- 'PMA_USER=root'
|
||||
- 'PMA_PASSWORD=TestRootPassword'
|
||||
ports:
|
||||
- '8080:80'
|
||||
networks:
|
||||
- network1
|
||||
|
||||
mysql:
|
||||
image: bitnami/mysql:8.0
|
||||
container_name: 'mysql'
|
||||
restart: unless-stopped
|
||||
tty: true
|
||||
environment:
|
||||
- 'TZ=CET'
|
||||
- 'MYSQL_ROOT_PASSWORD=TestRootPassword'
|
||||
networks:
|
||||
- network1
|
||||
|
||||
networks:
|
||||
network1:
|
||||
driver: bridge
|
||||
@@ -0,0 +1,75 @@
|
||||
# docker build -t phpmyadmin-fpm-alpine-caddy --build-arg BUILDKIT_INLINE_CACHE=1 -f ./docker/Dockerfile . && docker run --rm -it -p 8080:80 phpmyadmin-fpm-alpine-caddy
|
||||
FROM alpine:3 as phpmyadmin-themes
|
||||
WORKDIR /src/
|
||||
RUN set -eux \
|
||||
&& apk add --quiet --no-cache \
|
||||
curl \
|
||||
unzip \
|
||||
&& curl -fsSL https://github.com/phpmyadmin/themes/archive/refs/heads/master.zip --output /src/phpmyadmin-themes.zip \
|
||||
&& unzip -uoq /src/phpmyadmin-themes.zip -d /src/
|
||||
|
||||
FROM phpmyadmin/phpmyadmin:${BASE_IMAGE_VERSION}
|
||||
|
||||
ENV TERM="xterm-256color" \
|
||||
LANGUAGE="en_US.UTF-8" \
|
||||
LANG="en_US.UTF-8" \
|
||||
LC_TIME="en_DK.UTF-8" \
|
||||
TIME_STYLE="long-iso"
|
||||
|
||||
RUN set -eux \
|
||||
&& apk add --quiet --no-cache \
|
||||
iputils \
|
||||
# `fcgi` - Healthcheck | https://github.com/renatomefi/php-fpm-healthcheck
|
||||
fcgi \
|
||||
tini
|
||||
|
||||
# Caddy | https://caddyserver.com/
|
||||
COPY --from=caddy:2-alpine /usr/bin/caddy /usr/local/bin/caddy
|
||||
COPY ./docker/config/caddy/Caddyfile /etc/caddy/Caddyfile
|
||||
RUN set -eux \
|
||||
# && setcap 'cap_net_bind_service=+ep' /usr/local/bin/caddy \
|
||||
&& caddy fmt --overwrite /etc/caddy/Caddyfile \
|
||||
&& caddy version
|
||||
|
||||
# Healthcheck | https://github.com/renatomefi/php-fpm-healthcheck
|
||||
RUN set -eux \
|
||||
&& curl -fsSL https://raw.githubusercontent.com/renatomefi/php-fpm-healthcheck/master/php-fpm-healthcheck --output /usr/local/bin/php-fpm-healthcheck \
|
||||
&& chmod +x /usr/local/bin/php-fpm-healthcheck \
|
||||
&& echo "pm.status_path = /status" >> /usr/local/etc/php-fpm.d/zz-docker.conf
|
||||
HEALTHCHECK --interval=1m --timeout=1s --start-period=10s CMD (curl --fail http://localhost/LICENSE && php-fpm-healthcheck) || exit 1
|
||||
|
||||
COPY ./docker/config/php-fpm.d/zzz-php-fpm_custom.conf /usr/local/etc/php-fpm.d/zzz-php-fpm_custom.conf
|
||||
|
||||
# Install themes
|
||||
COPY --from=phpmyadmin-themes /src/themes-master/blueberry/ /var/www/html/themes/blueberry/
|
||||
COPY --from=phpmyadmin-themes /src/themes-master/boodark/ /var/www/html/themes/boodark/
|
||||
|
||||
RUN set -eux \
|
||||
&& rm -R themes/metro/ themes/bootstrap/ themes/original/
|
||||
|
||||
LABEL org.opencontainers.image.title="phpMyAdmin Docker image" \
|
||||
org.opencontainers.image.description="Run phpMyAdmin with Alpine, PHP FPM and Caddy" \
|
||||
org.opencontainers.image.authors="https://github.com/beeyev/phpmyadmin-docker-lightweight" \
|
||||
org.opencontainers.image.vendor="phpMyAdmin" \
|
||||
org.opencontainers.image.documentation="https://github.com/beeyev/phpmyadmin-docker-lightweight" \
|
||||
org.opencontainers.image.url="https://github.com/beeyev/phpmyadmin-docker-lightweight" \
|
||||
org.opencontainers.image.source="https://github.com/beeyev/phpmyadmin-docker-lightweight"
|
||||
|
||||
ARG TZ='UTC'
|
||||
ENV TZ=$TZ
|
||||
|
||||
#These params meant to be set by CI
|
||||
ARG BUILD_DATE
|
||||
ENV BUILD_DATE=$BUILD_DATE
|
||||
RUN echo $BUILD_DATE
|
||||
ARG BUILD_FINGERPRINT
|
||||
ENV BUILD_FINGERPRINT=$BUILD_FINGERPRINT
|
||||
RUN echo $BUILD_FINGERPRINT
|
||||
|
||||
RUN set -eux \
|
||||
&& mv /docker-entrypoint.sh /phpmyadmin-docker-entrypoint.sh
|
||||
|
||||
COPY --chmod=0755 ./docker/etc/docker-entrypoint.sh /docker-entrypoint.sh
|
||||
ENTRYPOINT ["tini", "--", "/docker-entrypoint.sh"]
|
||||
EXPOSE 80
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
(proxyheaders) {
|
||||
trusted_proxies 0.0.0.0/0
|
||||
}
|
||||
|
||||
{
|
||||
auto_https off
|
||||
admin off
|
||||
log {
|
||||
level WARN
|
||||
}
|
||||
}
|
||||
|
||||
:80 {
|
||||
root * /var/www/html/
|
||||
php_fastcgi 127.0.0.1:9000 {
|
||||
trusted_proxies 0.0.0.0/0
|
||||
}
|
||||
file_server browse
|
||||
encode zstd gzip
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
[global]
|
||||
; global config goes here
|
||||
|
||||
[www]
|
||||
; www config goes here
|
||||
; Uncomment the line below if you want to store logs in a file instead of sending them into `stderr`
|
||||
; php_admin_value[error_log] = /var/log/php/php-fpm-errors.log
|
||||
|
||||
access.log = /dev/null
|
||||
@@ -0,0 +1,29 @@
|
||||
#!/bin/sh
|
||||
|
||||
#String Colors
|
||||
NC='\033[0;m' # Default Color
|
||||
GRN='\033[32;1m'
|
||||
RED='\033[31;1m'
|
||||
BLK='\033[30;1m'
|
||||
|
||||
# Set the number of cpu cores
|
||||
export NUM_CPUS=`nproc`
|
||||
|
||||
# Run custom script before the main docker process gets started
|
||||
for f in /docker-entrypoint.init.d/*; do
|
||||
case "$f" in
|
||||
*.sh) # this should match the set of files we check for below
|
||||
echo "⚙ Executing entrypoint.init file: ${f}"
|
||||
. $f
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
printf "\n${GRN}--->${NC} 🚀️️ Welcome to ${GRN}beeyev phpMyAdmin lightweight${NC} container..."
|
||||
printf "\n${GRN}--->${NC} Docker image build date: ${GRN}${BUILD_DATE}${NC}, fingerprint: ${GRN}${BUILD_FINGERPRINT}${NC}"
|
||||
printf "\n${GRN}--->${NC} Subscribe to project updates: ${GRN}https://github.com/beeyev/phpmyadmin-docker-lightweight${NC}\n\n"
|
||||
|
||||
caddy start --adapter caddyfile --config /etc/caddy/Caddyfile
|
||||
|
||||
exec /phpmyadmin-docker-entrypoint.sh php-fpm
|
||||
Reference in New Issue
Block a user