Skip to content

Commit

Permalink
Merge pull request #13 from kool-dev/node-flavor
Browse files Browse the repository at this point in the history
update swoole dev to base on -node flavor
  • Loading branch information
fabriciojs authored Oct 26, 2023
2 parents 60bf249 + 41064f0 commit e6a54f6
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 27 deletions.
54 changes: 39 additions & 15 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: CI/CD

on: [push, pull_request, workflow_dispatch]
on:
push:
workflow_dispatch:
schedule:
- cron: '0 0 * * 0'

env:
DOCKER_BUILDKIT: 1
Expand All @@ -12,33 +16,53 @@ jobs:
strategy:
matrix:
version: ['8.0', '8.1', '8.2']
type: ['-swoole', '-nginx-swoole-prod']

steps:
- name: Checkout code
uses: actions/checkout@v3.3.0
uses: actions/checkout@v4.1.1

- name: Build
run: |
docker build --pull -t kooldev/php:${{ matrix.version }}-nginx-swoole ${{ matrix.version }}-nginx-swoole
docker build --pull -t kooldev/php:${{ matrix.version }}-nginx-swoole-prod ${{ matrix.version }}-nginx-swoole-prod
- name: Setup QEMU
uses: docker/setup-qemu-action@v3

- name: Tests
run: |
docker run kooldev/php:${{ matrix.version }}-nginx-swoole php -r "extension_loaded('swoole') or die(1);"
docker run kooldev/php:${{ matrix.version }}-nginx-swoole-prod php -r "extension_loaded('swoole') or die(1);"
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to DockerHub
uses: docker/login-action@v2.1.0
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: Push to DockerHub
if: github.ref == 'refs/heads/main' && github.repository == 'kool-dev/docker-php-swoole'
- name: Build and export to Docker
uses: docker/build-push-action@v5
with:
context: ${{ matrix.version }}${{ matrix.type }}
load: true
tags: kooldev/php:${{ matrix.version }}${{ matrix.type }}

- name: Tests (dev)
if: matrix.type == '-swoole'
run: |
docker push kooldev/php:${{ matrix.version }}-nginx-swoole
docker push kooldev/php:${{ matrix.version }}-nginx-swoole-prod
docker run kooldev/php:${{ matrix.version }}${{ matrix.type }} php -r "extension_loaded('swoole') or die(1);"
docker run kooldev/php:${{ matrix.version }}${{ matrix.type }} node -v
docker run kooldev/php:${{ matrix.version }}${{ matrix.type }} yarn -v
- name: Tests (prod)
if: matrix.type == '-nginx-swoole-prod'
run: |
docker run kooldev/php:${{ matrix.version }}${{ matrix.type }} php -r "extension_loaded('swoole') or die(1);"
docker run kooldev/php:${{ matrix.version }}${{ matrix.type }} nginx -v
- 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 }}

trigger-build-oci8:
name: Trigger OCI8 Build
Expand Down
2 changes: 1 addition & 1 deletion 8.0-nginx-swoole/Dockerfile → 8.0-swoole/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM kooldev/php:8.0-nginx
FROM kooldev/php:8.0-node

RUN apk add libpq libpq-dev curl-dev

Expand Down
2 changes: 1 addition & 1 deletion 8.1-nginx-swoole/Dockerfile → 8.1-swoole/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM kooldev/php:8.1-nginx
FROM kooldev/php:8.1-node

RUN apk add libpq libpq-dev curl-dev

Expand Down
2 changes: 1 addition & 1 deletion 8.2-nginx-swoole/Dockerfile → 8.2-swoole/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM kooldev/php:8.2-nginx
FROM kooldev/php:8.2-node

RUN apk add libpq libpq-dev curl-dev

Expand Down
12 changes: 6 additions & 6 deletions fwd-template.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"output": ".",
"builds": [
{
"name": "8.0-nginx-swoole",
"name": "8.0-swoole",
"data": {
"from": "kooldev/php:8.0-nginx"
"from": "kooldev/php:8.0-node"
},
"files": [
{
Expand All @@ -26,9 +26,9 @@
]
},
{
"name": "8.1-nginx-swoole",
"name": "8.1-swoole",
"data": {
"from": "kooldev/php:8.1-nginx"
"from": "kooldev/php:8.1-node"
},
"files": [
{
Expand All @@ -50,9 +50,9 @@
]
},
{
"name": "8.2-nginx-swoole",
"name": "8.2-swoole",
"data": {
"from": "kooldev/php:8.2-nginx"
"from": "kooldev/php:8.2-node"
},
"files": [
{
Expand Down
6 changes: 3 additions & 3 deletions kool.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ scripts:
- kool docker fireworkweb/fwd:v1.0 fwd template
build:
- kool run template
- docker build --pull -t kooldev/php:8.0-nginx-swoole 8.0-nginx-swoole
- docker build --pull -t kooldev/php:8.0-swoole 8.0-swoole
- docker build --pull -t kooldev/php:8.0-nginx-swoole-prod 8.0-nginx-swoole-prod
- docker build --pull -t kooldev/php:8.1-nginx-swoole 8.1-nginx-swoole
- docker build --pull -t kooldev/php:8.1-swoole 8.1-swoole
- docker build --pull -t kooldev/php:8.1-nginx-swoole-prod 8.1-nginx-swoole-prod
- docker build --pull -t kooldev/php:8.2-nginx-swoole 8.2-nginx-swoole
- docker build --pull -t kooldev/php:8.2-swoole 8.2-swoole
- docker build --pull -t kooldev/php:8.2-nginx-swoole-prod 8.2-nginx-swoole-prod

0 comments on commit e6a54f6

Please sign in to comment.