From d30c5d90a3c1925ae9fb219f2dbe7d14cad04b75 Mon Sep 17 00:00:00 2001 From: fabriciojs Date: Wed, 25 Oct 2023 09:28:34 -0300 Subject: [PATCH 1/5] update swoole dev to base on -node flavor --- 8.0-nginx-swoole-prod/Dockerfile | 19 ------------------- 8.0-nginx-swoole/Dockerfile | 19 ------------------- 8.1-nginx-swoole-prod/Dockerfile | 19 ------------------- 8.1-nginx-swoole/Dockerfile | 19 ------------------- 8.2-nginx-swoole-prod/Dockerfile | 19 ------------------- 8.2-nginx-swoole/Dockerfile | 19 ------------------- fwd-template.json | 12 ++++++------ kool.yml | 6 +++--- 8 files changed, 9 insertions(+), 123 deletions(-) delete mode 100644 8.0-nginx-swoole-prod/Dockerfile delete mode 100644 8.0-nginx-swoole/Dockerfile delete mode 100644 8.1-nginx-swoole-prod/Dockerfile delete mode 100644 8.1-nginx-swoole/Dockerfile delete mode 100644 8.2-nginx-swoole-prod/Dockerfile delete mode 100644 8.2-nginx-swoole/Dockerfile diff --git a/8.0-nginx-swoole-prod/Dockerfile b/8.0-nginx-swoole-prod/Dockerfile deleted file mode 100644 index 48487b0..0000000 --- a/8.0-nginx-swoole-prod/Dockerfile +++ /dev/null @@ -1,19 +0,0 @@ -FROM kooldev/php:8.0-nginx-prod - -RUN apk add libpq libpq-dev curl-dev - -RUN apk add --no-cache --virtual .build-deps linux-headers && \ - docker-php-ext-install sockets && \ - docker-php-source extract && \ - mkdir /usr/src/php/ext/swoole && \ - curl -sfL https://github.com/swoole/swoole-src/archive/v5.1.0.tar.gz -o swoole.tar.gz && \ - tar xfz swoole.tar.gz --strip-components=1 -C /usr/src/php/ext/swoole && \ - docker-php-ext-configure swoole \ - --enable-mysqlnd \ - --enable-swoole-pgsql \ - --enable-openssl \ - --enable-sockets --enable-swoole-curl && \ - docker-php-ext-install -j$(nproc) swoole && \ - # cleanup - apk del .build-deps && \ - rm -rf /var/cache/apk/* /tmp/* diff --git a/8.0-nginx-swoole/Dockerfile b/8.0-nginx-swoole/Dockerfile deleted file mode 100644 index b964d66..0000000 --- a/8.0-nginx-swoole/Dockerfile +++ /dev/null @@ -1,19 +0,0 @@ -FROM kooldev/php:8.0-nginx - -RUN apk add libpq libpq-dev curl-dev - -RUN apk add --no-cache --virtual .build-deps linux-headers && \ - docker-php-ext-install sockets && \ - docker-php-source extract && \ - mkdir /usr/src/php/ext/swoole && \ - curl -sfL https://github.com/swoole/swoole-src/archive/v5.1.0.tar.gz -o swoole.tar.gz && \ - tar xfz swoole.tar.gz --strip-components=1 -C /usr/src/php/ext/swoole && \ - docker-php-ext-configure swoole \ - --enable-mysqlnd \ - --enable-swoole-pgsql \ - --enable-openssl \ - --enable-sockets --enable-swoole-curl && \ - docker-php-ext-install -j$(nproc) swoole && \ - # cleanup - apk del .build-deps && \ - rm -rf /var/cache/apk/* /tmp/* diff --git a/8.1-nginx-swoole-prod/Dockerfile b/8.1-nginx-swoole-prod/Dockerfile deleted file mode 100644 index 37d250b..0000000 --- a/8.1-nginx-swoole-prod/Dockerfile +++ /dev/null @@ -1,19 +0,0 @@ -FROM kooldev/php:8.1-nginx-prod - -RUN apk add libpq libpq-dev curl-dev - -RUN apk add --no-cache --virtual .build-deps linux-headers && \ - docker-php-ext-install sockets && \ - docker-php-source extract && \ - mkdir /usr/src/php/ext/swoole && \ - curl -sfL https://github.com/swoole/swoole-src/archive/v5.1.0.tar.gz -o swoole.tar.gz && \ - tar xfz swoole.tar.gz --strip-components=1 -C /usr/src/php/ext/swoole && \ - docker-php-ext-configure swoole \ - --enable-mysqlnd \ - --enable-swoole-pgsql \ - --enable-openssl \ - --enable-sockets --enable-swoole-curl && \ - docker-php-ext-install -j$(nproc) swoole && \ - # cleanup - apk del .build-deps && \ - rm -rf /var/cache/apk/* /tmp/* diff --git a/8.1-nginx-swoole/Dockerfile b/8.1-nginx-swoole/Dockerfile deleted file mode 100644 index b294c51..0000000 --- a/8.1-nginx-swoole/Dockerfile +++ /dev/null @@ -1,19 +0,0 @@ -FROM kooldev/php:8.1-nginx - -RUN apk add libpq libpq-dev curl-dev - -RUN apk add --no-cache --virtual .build-deps linux-headers && \ - docker-php-ext-install sockets && \ - docker-php-source extract && \ - mkdir /usr/src/php/ext/swoole && \ - curl -sfL https://github.com/swoole/swoole-src/archive/v5.1.0.tar.gz -o swoole.tar.gz && \ - tar xfz swoole.tar.gz --strip-components=1 -C /usr/src/php/ext/swoole && \ - docker-php-ext-configure swoole \ - --enable-mysqlnd \ - --enable-swoole-pgsql \ - --enable-openssl \ - --enable-sockets --enable-swoole-curl && \ - docker-php-ext-install -j$(nproc) swoole && \ - # cleanup - apk del .build-deps && \ - rm -rf /var/cache/apk/* /tmp/* diff --git a/8.2-nginx-swoole-prod/Dockerfile b/8.2-nginx-swoole-prod/Dockerfile deleted file mode 100644 index 240573a..0000000 --- a/8.2-nginx-swoole-prod/Dockerfile +++ /dev/null @@ -1,19 +0,0 @@ -FROM kooldev/php:8.2-nginx-prod - -RUN apk add libpq libpq-dev curl-dev - -RUN apk add --no-cache --virtual .build-deps linux-headers && \ - docker-php-ext-install sockets && \ - docker-php-source extract && \ - mkdir /usr/src/php/ext/swoole && \ - curl -sfL https://github.com/swoole/swoole-src/archive/v5.1.0.tar.gz -o swoole.tar.gz && \ - tar xfz swoole.tar.gz --strip-components=1 -C /usr/src/php/ext/swoole && \ - docker-php-ext-configure swoole \ - --enable-mysqlnd \ - --enable-swoole-pgsql \ - --enable-openssl \ - --enable-sockets --enable-swoole-curl && \ - docker-php-ext-install -j$(nproc) swoole && \ - # cleanup - apk del .build-deps && \ - rm -rf /var/cache/apk/* /tmp/* diff --git a/8.2-nginx-swoole/Dockerfile b/8.2-nginx-swoole/Dockerfile deleted file mode 100644 index c484fbf..0000000 --- a/8.2-nginx-swoole/Dockerfile +++ /dev/null @@ -1,19 +0,0 @@ -FROM kooldev/php:8.2-nginx - -RUN apk add libpq libpq-dev curl-dev - -RUN apk add --no-cache --virtual .build-deps linux-headers && \ - docker-php-ext-install sockets && \ - docker-php-source extract && \ - mkdir /usr/src/php/ext/swoole && \ - curl -sfL https://github.com/swoole/swoole-src/archive/v5.1.0.tar.gz -o swoole.tar.gz && \ - tar xfz swoole.tar.gz --strip-components=1 -C /usr/src/php/ext/swoole && \ - docker-php-ext-configure swoole \ - --enable-mysqlnd \ - --enable-swoole-pgsql \ - --enable-openssl \ - --enable-sockets --enable-swoole-curl && \ - docker-php-ext-install -j$(nproc) swoole && \ - # cleanup - apk del .build-deps && \ - rm -rf /var/cache/apk/* /tmp/* 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 From 6c8e09432cadaab57c2ec01c692fcc8e94f6e561 Mon Sep 17 00:00:00 2001 From: fabriciojs Date: Wed, 25 Oct 2023 09:31:01 -0300 Subject: [PATCH 2/5] update CI for new tags --- .github/workflows/ci-cd.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index eb9504e..7b376cd 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -19,12 +19,14 @@ jobs: - 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 }}-swoole ${{ matrix.version }}-swoole docker build --pull -t kooldev/php:${{ matrix.version }}-nginx-swoole-prod ${{ matrix.version }}-nginx-swoole-prod - 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 }}-swoole php -r "extension_loaded('swoole') or die(1);" + docker run kooldev/php:${{ matrix.version }}-swoole node -v + docker run kooldev/php:${{ matrix.version }}-swoole yarn -v docker run kooldev/php:${{ matrix.version }}-nginx-swoole-prod php -r "extension_loaded('swoole') or die(1);" - name: Login to DockerHub From 48f343cd8a535206014ae2b9ad474efb82d4b409 Mon Sep 17 00:00:00 2001 From: fabriciojs Date: Wed, 25 Oct 2023 20:31:07 -0300 Subject: [PATCH 3/5] add gereated files --- 8.0-nginx-swoole-prod/Dockerfile | 19 +++++++++++++++++++ 8.0-swoole/Dockerfile | 19 +++++++++++++++++++ 8.1-nginx-swoole-prod/Dockerfile | 19 +++++++++++++++++++ 8.1-swoole/Dockerfile | 19 +++++++++++++++++++ 8.2-nginx-swoole-prod/Dockerfile | 19 +++++++++++++++++++ 8.2-swoole/Dockerfile | 19 +++++++++++++++++++ 6 files changed, 114 insertions(+) create mode 100644 8.0-nginx-swoole-prod/Dockerfile create mode 100644 8.0-swoole/Dockerfile create mode 100644 8.1-nginx-swoole-prod/Dockerfile create mode 100644 8.1-swoole/Dockerfile create mode 100644 8.2-nginx-swoole-prod/Dockerfile create mode 100644 8.2-swoole/Dockerfile diff --git a/8.0-nginx-swoole-prod/Dockerfile b/8.0-nginx-swoole-prod/Dockerfile new file mode 100644 index 0000000..48487b0 --- /dev/null +++ b/8.0-nginx-swoole-prod/Dockerfile @@ -0,0 +1,19 @@ +FROM kooldev/php:8.0-nginx-prod + +RUN apk add libpq libpq-dev curl-dev + +RUN apk add --no-cache --virtual .build-deps linux-headers && \ + docker-php-ext-install sockets && \ + docker-php-source extract && \ + mkdir /usr/src/php/ext/swoole && \ + curl -sfL https://github.com/swoole/swoole-src/archive/v5.1.0.tar.gz -o swoole.tar.gz && \ + tar xfz swoole.tar.gz --strip-components=1 -C /usr/src/php/ext/swoole && \ + docker-php-ext-configure swoole \ + --enable-mysqlnd \ + --enable-swoole-pgsql \ + --enable-openssl \ + --enable-sockets --enable-swoole-curl && \ + docker-php-ext-install -j$(nproc) swoole && \ + # cleanup + apk del .build-deps && \ + rm -rf /var/cache/apk/* /tmp/* diff --git a/8.0-swoole/Dockerfile b/8.0-swoole/Dockerfile new file mode 100644 index 0000000..54fe396 --- /dev/null +++ b/8.0-swoole/Dockerfile @@ -0,0 +1,19 @@ +FROM kooldev/php:8.0-node + +RUN apk add libpq libpq-dev curl-dev + +RUN apk add --no-cache --virtual .build-deps linux-headers && \ + docker-php-ext-install sockets && \ + docker-php-source extract && \ + mkdir /usr/src/php/ext/swoole && \ + curl -sfL https://github.com/swoole/swoole-src/archive/v5.1.0.tar.gz -o swoole.tar.gz && \ + tar xfz swoole.tar.gz --strip-components=1 -C /usr/src/php/ext/swoole && \ + docker-php-ext-configure swoole \ + --enable-mysqlnd \ + --enable-swoole-pgsql \ + --enable-openssl \ + --enable-sockets --enable-swoole-curl && \ + docker-php-ext-install -j$(nproc) swoole && \ + # cleanup + apk del .build-deps && \ + rm -rf /var/cache/apk/* /tmp/* diff --git a/8.1-nginx-swoole-prod/Dockerfile b/8.1-nginx-swoole-prod/Dockerfile new file mode 100644 index 0000000..37d250b --- /dev/null +++ b/8.1-nginx-swoole-prod/Dockerfile @@ -0,0 +1,19 @@ +FROM kooldev/php:8.1-nginx-prod + +RUN apk add libpq libpq-dev curl-dev + +RUN apk add --no-cache --virtual .build-deps linux-headers && \ + docker-php-ext-install sockets && \ + docker-php-source extract && \ + mkdir /usr/src/php/ext/swoole && \ + curl -sfL https://github.com/swoole/swoole-src/archive/v5.1.0.tar.gz -o swoole.tar.gz && \ + tar xfz swoole.tar.gz --strip-components=1 -C /usr/src/php/ext/swoole && \ + docker-php-ext-configure swoole \ + --enable-mysqlnd \ + --enable-swoole-pgsql \ + --enable-openssl \ + --enable-sockets --enable-swoole-curl && \ + docker-php-ext-install -j$(nproc) swoole && \ + # cleanup + apk del .build-deps && \ + rm -rf /var/cache/apk/* /tmp/* diff --git a/8.1-swoole/Dockerfile b/8.1-swoole/Dockerfile new file mode 100644 index 0000000..9a36fbe --- /dev/null +++ b/8.1-swoole/Dockerfile @@ -0,0 +1,19 @@ +FROM kooldev/php:8.1-node + +RUN apk add libpq libpq-dev curl-dev + +RUN apk add --no-cache --virtual .build-deps linux-headers && \ + docker-php-ext-install sockets && \ + docker-php-source extract && \ + mkdir /usr/src/php/ext/swoole && \ + curl -sfL https://github.com/swoole/swoole-src/archive/v5.1.0.tar.gz -o swoole.tar.gz && \ + tar xfz swoole.tar.gz --strip-components=1 -C /usr/src/php/ext/swoole && \ + docker-php-ext-configure swoole \ + --enable-mysqlnd \ + --enable-swoole-pgsql \ + --enable-openssl \ + --enable-sockets --enable-swoole-curl && \ + docker-php-ext-install -j$(nproc) swoole && \ + # cleanup + apk del .build-deps && \ + rm -rf /var/cache/apk/* /tmp/* diff --git a/8.2-nginx-swoole-prod/Dockerfile b/8.2-nginx-swoole-prod/Dockerfile new file mode 100644 index 0000000..240573a --- /dev/null +++ b/8.2-nginx-swoole-prod/Dockerfile @@ -0,0 +1,19 @@ +FROM kooldev/php:8.2-nginx-prod + +RUN apk add libpq libpq-dev curl-dev + +RUN apk add --no-cache --virtual .build-deps linux-headers && \ + docker-php-ext-install sockets && \ + docker-php-source extract && \ + mkdir /usr/src/php/ext/swoole && \ + curl -sfL https://github.com/swoole/swoole-src/archive/v5.1.0.tar.gz -o swoole.tar.gz && \ + tar xfz swoole.tar.gz --strip-components=1 -C /usr/src/php/ext/swoole && \ + docker-php-ext-configure swoole \ + --enable-mysqlnd \ + --enable-swoole-pgsql \ + --enable-openssl \ + --enable-sockets --enable-swoole-curl && \ + docker-php-ext-install -j$(nproc) swoole && \ + # cleanup + apk del .build-deps && \ + rm -rf /var/cache/apk/* /tmp/* diff --git a/8.2-swoole/Dockerfile b/8.2-swoole/Dockerfile new file mode 100644 index 0000000..8b933ac --- /dev/null +++ b/8.2-swoole/Dockerfile @@ -0,0 +1,19 @@ +FROM kooldev/php:8.2-node + +RUN apk add libpq libpq-dev curl-dev + +RUN apk add --no-cache --virtual .build-deps linux-headers && \ + docker-php-ext-install sockets && \ + docker-php-source extract && \ + mkdir /usr/src/php/ext/swoole && \ + curl -sfL https://github.com/swoole/swoole-src/archive/v5.1.0.tar.gz -o swoole.tar.gz && \ + tar xfz swoole.tar.gz --strip-components=1 -C /usr/src/php/ext/swoole && \ + docker-php-ext-configure swoole \ + --enable-mysqlnd \ + --enable-swoole-pgsql \ + --enable-openssl \ + --enable-sockets --enable-swoole-curl && \ + docker-php-ext-install -j$(nproc) swoole && \ + # cleanup + apk del .build-deps && \ + rm -rf /var/cache/apk/* /tmp/* From 80f751a51445b80a1b67d5958dcaf0331ef706d1 Mon Sep 17 00:00:00 2001 From: fabriciojs Date: Wed, 25 Oct 2023 20:49:08 -0300 Subject: [PATCH 4/5] add QEMU/ARM build --- .github/workflows/ci-cd.yml | 50 +++++++++++++++++++++++++------------ 1 file changed, 34 insertions(+), 16 deletions(-) diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index 7b376cd..1f72f50 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -12,35 +12,53 @@ jobs: strategy: matrix: version: ['8.0', '8.1', '8.2'] + type: ['-swoole', '-nginx-swoole-prod'] steps: - name: Checkout code - uses: actions/checkout@v3.1.0 + uses: actions/checkout@v4.1.1 - - name: Build - run: | - docker build --pull -t kooldev/php:${{ matrix.version }}-swoole ${{ matrix.version }}-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 }}-swoole php -r "extension_loaded('swoole') or die(1);" - docker run kooldev/php:${{ matrix.version }}-swoole node -v - docker run kooldev/php:${{ matrix.version }}-swoole yarn -v - 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 From 41064f01a313ca412cb7dc00e6c7530fefe51542 Mon Sep 17 00:00:00 2001 From: fabriciojs Date: Wed, 25 Oct 2023 20:53:50 -0300 Subject: [PATCH 5/5] fix triggers --- .github/workflows/ci-cd.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index 1b4e15b..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