mirror of
https://github.com/bckelley/phpmyadmin-docker-lightweight.git
synced 2026-08-24 03:24:11 -05:00
small refactor
This commit is contained in:
@@ -1,90 +0,0 @@
|
||||
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 ]
|
||||
|
||||
schedule:
|
||||
- cron: "23 1 2 * *"
|
||||
|
||||
# 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@v4
|
||||
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 }}
|
||||
IMAGE_TAG=${{ matrix.release_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,50 @@
|
||||
# Alexander Tebiev - https://github.com/beeyev
|
||||
name: Build Production Docker Images
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
|
||||
schedule:
|
||||
- cron: "23 1 2 * *"
|
||||
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
docker-image-deploy:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
SOURCE_IMAGE_VERSION: [ '5.2-fpm-alpine' ]
|
||||
TARGET_IMAGE_VERSION: [ '5.2' ]
|
||||
uses: ./.github/workflows/callable-build-docker-image.yml
|
||||
name: Build Production Docker Images / ${{ matrix.SOURCE_IMAGE_VERSION }}-${{ matrix.TARGET_IMAGE_VERSION }}
|
||||
with:
|
||||
BASE_IMAGE_VERSION: ${{ matrix.SOURCE_IMAGE_VERSION }}
|
||||
DOCKER_REGISTRY_IMAGE: |
|
||||
beeyev/phpmyadmin-lightweight:latest
|
||||
beeyev/phpmyadmin-lightweight:${{ matrix.TARGET_IMAGE_VERSION }}
|
||||
ghcr.io/beeyev/phpmyadmin-docker-lightweight:latest
|
||||
ghcr.io/beeyev/phpmyadmin-docker-lightweight:${{ matrix.TARGET_IMAGE_VERSION }}
|
||||
DOCKERFILE_PATH: ./docker/Dockerfile
|
||||
secrets: inherit
|
||||
|
||||
update-docker-hub-repo-description:
|
||||
name: Update Docker Hub repo description
|
||||
runs-on: ubuntu-latest
|
||||
needs: docker-image-deploy
|
||||
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 }}
|
||||
@@ -22,11 +22,6 @@ jobs:
|
||||
# (github.event.action == 'labeled' && github.event.label.name == 'make-test-build') ||
|
||||
# (github.event.action == 'synchronize' && contains(github.event.pull_request.labels.*.name, 'make-test-build'))
|
||||
steps:
|
||||
- name: Remove `test-build` label
|
||||
uses: actions-ecosystem/action-remove-labels@v1
|
||||
with:
|
||||
labels: make-test-build
|
||||
|
||||
- name: Sticky Pull Request Comment
|
||||
uses: marocchino/sticky-pull-request-comment@v2
|
||||
with:
|
||||
@@ -34,10 +29,28 @@ jobs:
|
||||
> [Building test docker images...](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})
|
||||
|
||||
docker-image-deploy:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
SOURCE_IMAGE_VERSION: [ '5.2-fpm-alpine' ]
|
||||
TARGET_IMAGE_VERSION: [ 'test' ]
|
||||
uses: ./.github/workflows/callable-build-docker-image.yml
|
||||
name: Build Test Docker Images / ${{ matrix.baseDist }}-test
|
||||
if: contains(github.event.label.name, 'make-test-build')
|
||||
with:
|
||||
BASE_IMAGE_VERSION: 5.2-fpm-alpine
|
||||
DOCKER_REGISTRY_IMAGE: ghcr.io/beeyev/phpmyadmin-docker-lightweight:test
|
||||
BASE_IMAGE_VERSION: ${{ matrix.SOURCE_IMAGE_VERSION }}
|
||||
DOCKER_REGISTRY_IMAGE: ghcr.io/beeyev/phpmyadmin-docker-lightweight:${{ matrix.TARGET_IMAGE_VERSION }}
|
||||
DOCKERFILE_PATH: ./docker/Dockerfile
|
||||
secrets: inherit
|
||||
|
||||
finalize:
|
||||
name: Finalize
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
pull-requests: write
|
||||
needs: docker-image-deploy
|
||||
steps:
|
||||
- name: Remove `test-build` label
|
||||
uses: actions-ecosystem/action-remove-labels@v1
|
||||
with:
|
||||
labels: make-test-build
|
||||
|
||||
@@ -1,27 +1,54 @@
|
||||
THIS_FILE := $(abspath $(lastword $(MAKEFILE_LIST)))
|
||||
CURRENT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
|
||||
# Alexander Tebiev - https://github.com/beeyev
|
||||
|
||||
up:
|
||||
docker-compose up --build --no-deps --detach --remove-orphans
|
||||
.EXPORT_ALL_VARIABLES:
|
||||
.PHONY: *
|
||||
.DEFAULT_GOAL := help
|
||||
|
||||
down:
|
||||
docker-compose down --remove-orphans
|
||||
ifeq (,$(shell command docker compose 2> /dev/null))
|
||||
DOCKER_COMPOSE_COMMAND = docker-compose
|
||||
else
|
||||
DOCKER_COMPOSE_COMMAND = docker compose
|
||||
endif
|
||||
|
||||
stop:
|
||||
docker-compose stop
|
||||
help: ## Show this help
|
||||
@echo "Make Application Docker Images and Containers using Docker-Compose files in 'docker' Dir."
|
||||
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m (default: help)\n\nTargets:\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-12s\033[0m %s\n", $$1, $$2 }' $(MAKEFILE_LIST)
|
||||
|
||||
update:
|
||||
docker-compose pull
|
||||
up: ## Docker compose up
|
||||
$(DOCKER_COMPOSE_COMMAND) up --build --no-deps --detach --remove-orphans
|
||||
|
||||
start:
|
||||
make up
|
||||
|
||||
restart: down up
|
||||
down: ## Docker compose down
|
||||
$(DOCKER_COMPOSE_COMMAND) down --remove-orphans
|
||||
|
||||
stop: ## Docker compose stop
|
||||
$(DOCKER_COMPOSE_COMMAND) stop
|
||||
|
||||
restart: ## Restart containers
|
||||
make down
|
||||
make up
|
||||
$(info Restart completed)
|
||||
|
||||
state:
|
||||
update: ## Update containers
|
||||
$(DOCKER_COMPOSE_COMMAND) pull
|
||||
make up
|
||||
|
||||
destroy: ## Destroy containers/volumes (keep sources app folders)
|
||||
make stop
|
||||
$(DOCKER_COMPOSE_COMMAND) down --rmi all --remove-orphans
|
||||
|
||||
rebuild: ## Rebuild docker container (destroy & upgrade)
|
||||
make destroy
|
||||
make up
|
||||
|
||||
state: ## Show current state
|
||||
docker ps --format=table
|
||||
|
||||
logs: ## Show docker logs
|
||||
docker-compose logs -f --tail=100 $(ARGS)
|
||||
$(DOCKER_COMPOSE_COMMAND) logs -f --tail=100 $(ARGS)
|
||||
|
||||
phpmyadmin:
|
||||
docker-compose exec phpmyadmin bash
|
||||
$(DOCKER_COMPOSE_COMMAND) exec phpmyadmin bash
|
||||
@printf "\n http://localhost:8080/ \n"
|
||||
|
||||
+4
-2
@@ -1,8 +1,8 @@
|
||||
version: "3"
|
||||
# Alexander Tebiev - https://github.com/beeyev
|
||||
|
||||
services:
|
||||
phpmyadmin:
|
||||
image: beeyev/phpmyadmin-lightweight:latest
|
||||
image: ghcr.io/beeyev/phpmyadmin-docker-lightweight:test
|
||||
container_name: 'phpmyadmin'
|
||||
restart: unless-stopped
|
||||
tty: true
|
||||
@@ -13,6 +13,8 @@ services:
|
||||
- 'PMA_PASSWORD=TestRootPassword'
|
||||
ports:
|
||||
- '8080:80'
|
||||
depends_on:
|
||||
- mysql
|
||||
networks:
|
||||
- network1
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/bin/sh
|
||||
# Alexander Tebiev - https://github.com/beeyev
|
||||
|
||||
#String Colors
|
||||
NC='\033[0;m' # Default Color
|
||||
|
||||
Reference in New Issue
Block a user