Skip to content

Tweak

Tweak #106

Workflow file for this run

name: CI/CD
on:
push:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
services:
registry:
image: registry:2
ports:
- 5000:5000
strategy:
matrix:
version: ['8.0-swoole', '8.1-swoole', '8.2-swoole', '8.3-swoole']
type: ['', '-prod']
steps:
- name: Checkout code
uses: actions/[email protected]
- name: Setup QEMU
uses: docker/setup-qemu-action@v3
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver-opts: network=host # needed to push to local registry
- name: Build and export to Docker
uses: docker/build-push-action@v5
with:
context: ${{ matrix.version }}${{ matrix.type }}
push: true
tags: localhost:5000/kooldev/php:${{ matrix.version }}${{ matrix.type }}
- name: Build and export to Docker (nginx)
uses: docker/build-push-action@v5
with:
context: ${{ matrix.version }}-nginx${{ matrix.type }}
push: true
tags: localhost:5000/kooldev/php:${{ matrix.version }}-nginx${{ matrix.type }}
build-contexts: |
kooldev/php:${{ matrix.version }}${{ matrix.type }}=docker-image://localhost:5000/kooldev/php:${{ matrix.version }}${{ matrix.type }}
- name: Tests
run: |
docker run localhost:5000/kooldev/php:${{ matrix.version }}${{ matrix.type }} php -r "extension_loaded('swoole') or die(1);"
docker run localhost:5000/kooldev/php:${{ matrix.version }}-nginx${{ matrix.type }} nginx -v
- name: Tests (dev)
if: matrix.type == ''
run: |
docker run localhost:5000/kooldev/php:${{ matrix.version }}${{ matrix.type }} node -v
docker run localhost:5000/kooldev/php:${{ matrix.version }}${{ matrix.type }} yarn -v
docker run localhost:5000/kooldev/php:${{ matrix.version }}-nginx${{ matrix.type }} node -v
docker run localhost:5000/kooldev/php:${{ matrix.version }}-nginx${{ matrix.type }} yarn -v
- name: Login to DockerHub
uses: docker/login-action@v3
if: github.ref == 'refs/heads/main' && github.repository == 'kool-dev/docker-php-swoole'
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push
uses: docker/build-push-action@v5
if: github.ref == 'refs/heads/main' && github.repository == 'kool-dev/docker-php-swoole'
with:
context: ${{ matrix.version }}${{ matrix.type }}
platforms: linux/amd64,linux/arm64
push: true
tags: kooldev/php:${{ matrix.version }}${{ matrix.type }}
- name: Build and push (nginx)
uses: docker/build-push-action@v5
if: github.ref == 'refs/heads/main' && github.repository == 'kool-dev/docker-php-swoole'
with:
context: ${{ matrix.version }}-nginx${{ matrix.type }}
platforms: linux/amd64,linux/arm64
push: true
tags: kooldev/php:${{ matrix.version }}-nginx${{ matrix.type }}