Skip to content

Build Nginx WordPress Image #60

Build Nginx WordPress Image

Build Nginx WordPress Image #60

Workflow file for this run

name: Build Nginx WordPress Image
on:
push:
branches:
- main
paths:
- 'nginx/*'
- '.github/workflows/build-nginx.yml'
pull_request:
paths:
- 'nginx/*'
- '.github/workflows/build-nginx.yml'
workflow_dispatch:
schedule:
- cron: '30 12 * * 5'
concurrency:
# SHA is added to the end if on `main` to let all main workflows run
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}-${{ github.ref == 'refs/heads/main' && github.sha || '' }}
cancel-in-progress: true
jobs:
package:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
repository: '10up/nginx_configs'
path: nginx/nginx_configs
- name: Install j2
run: |
sudo apt-get update
sudo apt-get install -y j2cli
- name: Template security configs
run: |
export AUTOMATTIC_IPV4_BLOCKS=$(curl -s https://jetpack.com/ips-v4.txt)
export AUTOMATTIC_IPV6_BLOCKS=$(cat nginx/security/automattic-ipv6.txt)
j2 -o nginx/security/automatticips.inc nginx/security/automatticips.inc.j2
# Also remove the 10up version of automattic ips that doesn't automatically update
rm nginx/nginx_configs/security/automatticips.inc
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: |
ghcr.io/${{ github.repository }}/nginx
tags: |
type=raw,value=latest,enable=${{ endsWith(github.ref, github.event.repository.default_branch) }}
type=sha,format=long
- name: Build Docker Container
uses: docker/build-push-action@v3
with:
context: nginx
file: nginx/Dockerfile
platforms: "linux/amd64,linux/arm64"
push: true
tags: ${{ steps.meta.outputs.tags }}