Skip to content

nginx

nginx #20

Workflow file for this run

name: "nginx"
on:
workflow_dispatch:
schedule:
- cron: '35 19 * * 3'
env:
# The default repo env will be 'ComputeStacks'; uppercase is not allowed.
GH_REPO: computestacks/cs-docker-wordpress
jobs:
build:
strategy:
matrix:
php_version: [ "7.4", "8.0", "8.1", "8.2" ]
image: [ "ghcr.io/computestacks/cs-docker-wordpress", "cmptstks/wordpress" ]
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
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: Log into Github Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Log into DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ matrix.image }}
tags: |
php${{ matrix.php_version }}-nginx
- name: Build and prepare to test
uses: docker/build-push-action@v5
with:
context: nginx-fpm/
load: true
build-args: |
php_version=${{ matrix.php_version }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Test container image
run: >
docker run --name=mysql -d \
-e MARIADB_ROOT_PASSWORD=ch3ngeme \
mariadb:11
docker run --name=wptest -d \
--network "container:mysql" \
-e CS_AUTH_KEY=FcUpBTaoi746JbAdhWqJwtmXC0en1M3u \
-e METADATA_SERVICE=http://localhost \
-e METADATA_AUTH=foobar123 \
-e WORDPRESS_DB_USER=root \
-e WORDPRESS_DB_PASSWORD=ch3ngeme \
-e WORDPRESS_DB_HOST=127.0.0.1 \
-e WORDPRESS_DB_NAME=wptest \
-e WORDPRESS_TITLE=blogger \
-e WORDPRESS_PASSWORD=ch3ngeme \
-e WORDPRESS_URL=localhost \
-e [email protected] \
-e WORDPRESS_USER=admin \
${{ matrix.image }}:php${{ matrix.php_version }}-nginx
bash ./scripts/container-health.sh wptest
- name: Build and push
id: build-and-push
uses: docker/build-push-action@v5
with:
context: nginx-fpm/
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
build-args: |
php_version=${{ matrix.php_version }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max