Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 93 additions & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -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 }}
18 changes: 18 additions & 0 deletions .github/workflows/shellcheck.yml
Original file line number Diff line number Diff line change
@@ -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/
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.vscode
.env
volumes
docker-compose.override.yml
32 changes: 32 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <domain-without-protocol> 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 <username> --show-password --skip-email
Expand Down
11 changes: 6 additions & 5 deletions common-services.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
24 changes: 0 additions & 24 deletions docker-compose.dev.yml

This file was deleted.