From fd8b07b0d89ba942577986126bba926a0c89545e Mon Sep 17 00:00:00 2001 From: shanshanzhong Date: Fri, 26 Sep 2025 02:37:06 -0700 Subject: [PATCH] tg --- .gitea/workflows/docker.yml | 68 ++++++++++++++++++++++++++++++++----- 1 file changed, 59 insertions(+), 9 deletions(-) diff --git a/.gitea/workflows/docker.yml b/.gitea/workflows/docker.yml index 0c05c5e..8439e6c 100644 --- a/.gitea/workflows/docker.yml +++ b/.gitea/workflows/docker.yml @@ -69,6 +69,11 @@ jobs: jq --version curl --version + - name: Set up Docker Buildx + run: | + docker buildx create --use --name builder --driver docker-container + docker buildx inspect --bootstrap + - name: Install Bun run: | curl -fsSL https://bun.sh/install | bash @@ -151,10 +156,47 @@ jobs: path: | apps/admin/.next/cache apps/user/.next/cache - key: nextcache-${{ runner.os }}-${{ hashFiles('apps/**') }}-${{ hashFiles('packages/**') }}-${{ hashFiles('turbo.json') }}-${{ hashFiles('bun.lock') }} + key: nextcache-${{ runner.os }}-${{ hashFiles('apps/**/package.json') }}-${{ hashFiles('packages/**/package.json') }}-${{ hashFiles('turbo.json') }}-${{ hashFiles('bun.lock') }} restore-keys: | + nextcache-${{ runner.os }}-${{ hashFiles('apps/**/package.json') }}-${{ hashFiles('packages/**/package.json') }}- nextcache-${{ runner.os }}- + - name: Cache build outputs + uses: https://gitea.cn/actions/cache@v3 + with: + path: | + apps/admin/.next + apps/user/.next + apps/admin/dist + apps/user/dist + key: build-${{ runner.os }}-${{ hashFiles('apps/**/*.ts', 'apps/**/*.tsx', 'apps/**/*.js', 'apps/**/*.jsx') }}-${{ hashFiles('packages/**/*.ts', 'packages/**/*.tsx') }}-${{ hashFiles('bun.lock') }} + restore-keys: | + build-${{ runner.os }}-${{ hashFiles('apps/**/*.ts', 'apps/**/*.tsx', 'apps/**/*.js', 'apps/**/*.jsx') }}- + build-${{ runner.os }}- + + - name: Cache ESLint + uses: https://gitea.cn/actions/cache@v3 + with: + path: | + .eslintcache + apps/admin/.eslintcache + apps/user/.eslintcache + key: eslint-${{ runner.os }}-${{ hashFiles('.eslintrc*', 'apps/**/.eslintrc*', 'packages/**/.eslintrc*') }}-${{ hashFiles('bun.lock') }} + restore-keys: | + eslint-${{ runner.os }}- + + - name: Cache TypeScript + uses: https://gitea.cn/actions/cache@v3 + with: + path: | + .tsbuildinfo + apps/admin/.tsbuildinfo + apps/user/.tsbuildinfo + packages/**/.tsbuildinfo + key: typescript-${{ runner.os }}-${{ hashFiles('tsconfig*.json', 'apps/**/tsconfig*.json', 'packages/**/tsconfig*.json') }}-${{ hashFiles('bun.lock') }} + restore-keys: | + typescript-${{ runner.os }}- + - name: Build Admin (turbo via bun) if: env.BUILD_TARGET == 'admin' || env.BUILD_TARGET == 'both' run: bun run build --filter=ppanel-admin-web @@ -165,19 +207,27 @@ jobs: - name: Build Docker (admin) if: env.BUILD_TARGET == 'admin' || env.BUILD_TARGET == 'both' - run: docker build -f ./docker/ppanel-admin-web/Dockerfile -t ${{ env.DOCKER_REGISTRY }}/ppanel/ppanel-admin-web:${{ env.VERSION }} . + run: | + docker buildx build \ + --platform linux/amd64 \ + --cache-from type=registry,ref=${{ env.DOCKER_REGISTRY }}/ppanel/ppanel-admin-web:cache \ + --cache-to type=registry,ref=${{ env.DOCKER_REGISTRY }}/ppanel/ppanel-admin-web:cache,mode=max \ + -f ./docker/ppanel-admin-web/Dockerfile \ + -t ${{ env.DOCKER_REGISTRY }}/ppanel/ppanel-admin-web:${{ env.VERSION }} \ + --push . - name: Build Docker (user) if: env.BUILD_TARGET == 'user' || env.BUILD_TARGET == 'both' - run: docker build -f ./docker/ppanel-user-web/Dockerfile -t ${{ env.DOCKER_REGISTRY }}/ppanel/ppanel-user-web:${{ env.VERSION }} . + run: | + docker buildx build \ + --platform linux/amd64 \ + --cache-from type=registry,ref=${{ env.DOCKER_REGISTRY }}/ppanel/ppanel-user-web:cache \ + --cache-to type=registry,ref=${{ env.DOCKER_REGISTRY }}/ppanel/ppanel-user-web:cache,mode=max \ + -f ./docker/ppanel-user-web/Dockerfile \ + -t ${{ env.DOCKER_REGISTRY }}/ppanel/ppanel-user-web:${{ env.VERSION }} \ + --push . - - name: Push Docker Image (admin) - if: env.BUILD_TARGET == 'admin' || env.BUILD_TARGET == 'both' - run: docker push ${{ env.DOCKER_REGISTRY }}/ppanel/ppanel-admin-web:${{ env.VERSION }} - - name: Push Docker Image (user) - if: env.BUILD_TARGET == 'user' || env.BUILD_TARGET == 'both' - run: docker push ${{ env.DOCKER_REGISTRY }}/ppanel/ppanel-user-web:${{ env.VERSION }} - name: Debug SSH variables if: env.BUILD_TARGET == 'admin' || env.BUILD_TARGET == 'both'