diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index 4f96ec6..88a0efc 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -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 @@ -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 diff --git a/8.0-nginx-swoole/Dockerfile b/8.0-swoole/Dockerfile similarity index 96% rename from 8.0-nginx-swoole/Dockerfile rename to 8.0-swoole/Dockerfile index b964d66..54fe396 100644 --- a/8.0-nginx-swoole/Dockerfile +++ b/8.0-swoole/Dockerfile @@ -1,4 +1,4 @@ -FROM kooldev/php:8.0-nginx +FROM kooldev/php:8.0-node RUN apk add libpq libpq-dev curl-dev diff --git a/8.1-nginx-swoole/Dockerfile b/8.1-swoole/Dockerfile similarity index 96% rename from 8.1-nginx-swoole/Dockerfile rename to 8.1-swoole/Dockerfile index b294c51..9a36fbe 100644 --- a/8.1-nginx-swoole/Dockerfile +++ b/8.1-swoole/Dockerfile @@ -1,4 +1,4 @@ -FROM kooldev/php:8.1-nginx +FROM kooldev/php:8.1-node RUN apk add libpq libpq-dev curl-dev diff --git a/8.2-nginx-swoole/Dockerfile b/8.2-swoole/Dockerfile similarity index 96% rename from 8.2-nginx-swoole/Dockerfile rename to 8.2-swoole/Dockerfile index c484fbf..8b933ac 100644 --- a/8.2-nginx-swoole/Dockerfile +++ b/8.2-swoole/Dockerfile @@ -1,4 +1,4 @@ -FROM kooldev/php:8.2-nginx +FROM kooldev/php:8.2-node RUN apk add libpq libpq-dev curl-dev diff --git a/fwd-template.json b/fwd-template.json index 6a2f918..d511903 100644 --- a/fwd-template.json +++ b/fwd-template.json @@ -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": [ { @@ -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": [ { @@ -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": [ { diff --git a/kool.yml b/kool.yml index 6428a4d..13b1106 100644 --- a/kool.yml +++ b/kool.yml @@ -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