From 68d42a514f352514fd31f5e099e5ac84ff53880e Mon Sep 17 00:00:00 2001 From: xboard Date: Fri, 7 Feb 2025 19:58:42 +0800 Subject: [PATCH 1/4] update dockerfile --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 443b45f..34188ea 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,8 +3,8 @@ FROM phpswoole/swoole:php8.2-alpine COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/ # Install PHP extensions one by one with lower optimization level for ARM64 compatibility -RUN CFLAGS="-O1" install-php-extensions pcntl && \ - CFLAGS="-O1" install-php-extensions bcmath && \ +RUN CFLAGS="-O0" install-php-extensions pcntl && \ + CFLAGS="-O0 -g0" install-php-extensions bcmath && \ install-php-extensions zip && \ install-php-extensions redis && \ apk --no-cache add shadow sqlite mysql-client mysql-dev mariadb-connector-c git patch supervisor redis && \ From b3339f7fe0c3429bf37820376641d4694d585a51 Mon Sep 17 00:00:00 2001 From: xboard Date: Fri, 7 Feb 2025 20:11:08 +0800 Subject: [PATCH 2/4] update docker-publish.yml --- .github/workflows/docker-publish.yml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index ff87686..4098063 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -33,7 +33,17 @@ jobs: with: platforms: linux/amd64,linux/arm64 driver-opts: | - image=moby/buildkit:latest + image=moby/buildkit:master + network=host + + # Add free disk space + - name: Free Disk Space + run: | + sudo rm -rf /usr/share/dotnet + sudo rm -rf /usr/local/lib/android + sudo rm -rf /opt/ghc + sudo rm -rf /opt/hostedtoolcache/CodeQL + sudo docker image prune -af - name: Login to registry uses: docker/login-action@v3 @@ -77,7 +87,12 @@ jobs: ${{ env.REGISTRY }}/${{ github.repository_owner }}/xboard:${{ steps.get_version.outputs.version }} build-args: | BUILDKIT_INLINE_CACHE=1 + BUILDKIT_MULTI_PLATFORM=1 + DOCKER_BUILDKIT=1 provenance: false + outputs: type=registry,push=true + allow: | + network.host - name: Install cosign uses: sigstore/cosign-installer@v3.4.0 From 2fb6691ca64cbfe3a623187f285d265238caa4bc Mon Sep 17 00:00:00 2001 From: xboard Date: Fri, 7 Feb 2025 22:39:31 +0800 Subject: [PATCH 3/4] fix: coupon period limit --- app/Http/Resources/CouponResource.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/Http/Resources/CouponResource.php b/app/Http/Resources/CouponResource.php index 7bfb6c6..b0fc77e 100644 --- a/app/Http/Resources/CouponResource.php +++ b/app/Http/Resources/CouponResource.php @@ -2,6 +2,9 @@ namespace App\Http\Resources; +use App\Models\Coupon; +use App\Services\CouponService; +use App\Services\PlanService; use Illuminate\Http\Request; use Illuminate\Http\Resources\Json\JsonResource; @@ -28,6 +31,13 @@ class CouponResource extends JsonResource ->map(fn(mixed $id): string => (string) $id) ->values() ->all() + ), + 'limit_period' => $this->when( + !empty($this->limit_period), + fn() => collect($this->limit_period) + ->map(fn(mixed $period): string => (string) PlanService::convertToLegacyPeriod($period)) + ->values() + ->all() ) ]; } From 8e5732d8576a8dd7a28d860b8d080bb195fa4c8d Mon Sep 17 00:00:00 2001 From: xboard Date: Fri, 7 Feb 2025 22:55:45 +0800 Subject: [PATCH 4/4] fix: coupon period limit --- app/Http/Resources/CouponResource.php | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/app/Http/Resources/CouponResource.php b/app/Http/Resources/CouponResource.php index b0fc77e..049a61f 100644 --- a/app/Http/Resources/CouponResource.php +++ b/app/Http/Resources/CouponResource.php @@ -25,20 +25,14 @@ class CouponResource extends JsonResource { return [ ...$this->resource->toArray(), - 'limit_plan_ids' => $this->when( - !empty($this->limit_plan_ids), - fn() => collect($this->limit_plan_ids) - ->map(fn(mixed $id): string => (string) $id) - ->values() - ->all() - ), - 'limit_period' => $this->when( - !empty($this->limit_period), - fn() => collect($this->limit_period) - ->map(fn(mixed $period): string => (string) PlanService::convertToLegacyPeriod($period)) - ->values() - ->all() - ) + 'limit_plan_ids' => empty($this->limit_plan_ids) ? null : collect($this->limit_plan_ids) + ->map(fn(mixed $id): string => (string) $id) + ->values() + ->all(), + 'limit_period' => empty($this->limit_period) ? null : collect($this->limit_period) + ->map(fn(mixed $period): string => (string) PlanService::convertToLegacyPeriod($period)) + ->values() + ->all(), ]; } }