From 05a3e0d255a6225d53ae2f32165dc9edd22175eb Mon Sep 17 00:00:00 2001 From: Vitor Mattos <1079143+vitormattos@users.noreply.github.com> Date: Wed, 13 May 2026 15:59:16 -0300 Subject: [PATCH 1/2] Standardize local override and add image publish workflow Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com> --- .github/workflows/docker-publish.yml | 93 ++++++++++++++++++++++++++++ .gitignore | 1 + README.md | 32 ++++++++++ common-services.yml | 11 ++-- docker-compose.dev.yml | 24 ------- 5 files changed, 132 insertions(+), 29 deletions(-) create mode 100644 .github/workflows/docker-publish.yml delete mode 100644 docker-compose.dev.yml diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml new file mode 100644 index 0000000..0c8edd8 --- /dev/null +++ b/.github/workflows/docker-publish.yml @@ -0,0 +1,93 @@ +name: Docker WordPress Publish + +on: + push: + branches: + - main + workflow_dispatch: + schedule: + - cron: '0 2 * * *' + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + build-and-push: + name: Build and push image + runs-on: ubuntu-latest + env: + VERSION_WORDPRESS: "6.9" + VERSION_PHP: "8.3" + permissions: + contents: read + packages: write + steps: + - name: Check out the repo + uses: actions/checkout@v4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Cache Docker layers + id: docker-cache + uses: actions/cache@v4 + with: + path: /tmp/.buildx-cache + key: wordpress-buildx-${{ github.sha }} + restore-keys: | + wordpress-buildx- + + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build container image + uses: docker/build-push-action@v6 + with: + context: .docker/wordpress + file: .docker/wordpress/Dockerfile + platforms: linux/amd64,linux/arm64 + push: false + build-args: | + VERSION_WORDPRESS=${{ env.VERSION_WORDPRESS }} + VERSION_PHP=${{ env.VERSION_PHP }} + tags: | + ghcr.io/${{ github.repository_owner }}/wordpress-docker:${{ github.sha }} + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache-new + + - name: Push container image + if: github.ref == 'refs/heads/main' + uses: docker/build-push-action@v6 + with: + context: .docker/wordpress + file: .docker/wordpress/Dockerfile + platforms: linux/amd64,linux/arm64 + push: true + build-args: | + VERSION_WORDPRESS=${{ env.VERSION_WORDPRESS }} + VERSION_PHP=${{ env.VERSION_PHP }} + tags: | + ghcr.io/${{ github.repository_owner }}/wordpress-docker:${{ github.sha }} + ghcr.io/${{ github.repository_owner }}/wordpress-docker:latest + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache-new + + - name: Move cache + run: | + rm -rf /tmp/.buildx-cache + mv /tmp/.buildx-cache-new /tmp/.buildx-cache + + - name: Save Docker cache + if: steps.docker-cache.outputs.cache-hit != 'true' + uses: actions/cache@v4 + with: + path: /tmp/.buildx-cache + key: wordpress-buildx-${{ github.sha }} \ No newline at end of file diff --git a/.gitignore b/.gitignore index 3bb7c1c..19dfb08 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .vscode .env volumes +docker-compose.override.yml diff --git a/README.md b/README.md index 3a730a8..c35ed52 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,39 @@ docker compose up -d ### Development +Create a local file named `docker-compose.override.yml` in the project root with this content: + +```yaml +services: + wordpress: + extends: + file: common-services.yml + service: wordpress + environment: + - XDEBUG_MODE=${XDEBUG_MODE:-debug} + + nginx: + extends: + file: common-services.yml + service: nginx + ports: + - 80:80 + + mariadb: + extends: + file: common-services.yml + service: mariadb + + mailpit: + image: axllent/mailpit + ports: + - 127.0.0.1:${MAILPIT_PORT:-8025}:8025 +``` + +After that, start the stack with the standard Compose command: + ```bash +docker compose up -d --build docker compose exec --user www-data wordpress wp search-replace --all-tables --report-changed-only localhost docker compose exec --user www-data wordpress wp search-replace --all-tables --report-changed-only https://localhost http://localhost docker compose exec --user www-data wordpress wp user reset-password --show-password --skip-email diff --git a/common-services.yml b/common-services.yml index c4645cd..c46cf8d 100644 --- a/common-services.yml +++ b/common-services.yml @@ -1,10 +1,11 @@ services: wordpress: - build: - context: .docker/wordpress - args: - VERSION_WORDPRESS: ${VERSION_WORDPRESS:-6.9} - VERSION_PHP: ${VERSION_PHP:-8.3} + image: ghcr.io/librecodecoop/wordpress-docker:latest + # build: + # context: .docker/wordpress + # args: + # VERSION_WORDPRESS: ${VERSION_WORDPRESS:-6.9} + # VERSION_PHP: ${VERSION_PHP:-8.3} restart: unless-stopped volumes: - ./volumes/wordpress:/var/www/html diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml deleted file mode 100644 index edcebb3..0000000 --- a/docker-compose.dev.yml +++ /dev/null @@ -1,24 +0,0 @@ -services: - wordpress: - extends: - file: common-services.yml - service: wordpress - environment: - - XDEBUG_MODE=${XDEBUG_MODE:-debug} - - nginx: - extends: - file: common-services.yml - service: nginx - ports: - - 80:80 - - mariadb: - extends: - file: common-services.yml - service: mariadb - - mailpit: - image: axllent/mailpit - ports: - - 127.0.0.1:${MAILPIT_PORT:-8025}:8025 \ No newline at end of file From ab9de3b25936a96fa252ce998680e24f7fb4fb4c Mon Sep 17 00:00:00 2001 From: Vitor Mattos <1079143+vitormattos@users.noreply.github.com> Date: Wed, 13 May 2026 16:00:20 -0300 Subject: [PATCH 2/2] Add Shellcheck GitHub Actions workflow Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com> --- .github/workflows/shellcheck.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .github/workflows/shellcheck.yml diff --git a/.github/workflows/shellcheck.yml b/.github/workflows/shellcheck.yml new file mode 100644 index 0000000..5b05073 --- /dev/null +++ b/.github/workflows/shellcheck.yml @@ -0,0 +1,18 @@ +on: + pull_request: + push: + branches: + - main + +name: 'Shellcheck' + +jobs: + shellcheck: + name: Shellcheck + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + - name: Run ShellCheck + uses: ludeeus/action-shellcheck@master + with: + scandir: .docker/