From 468e53f95944712aaa43e95b2fb5942b5f2e0843 Mon Sep 17 00:00:00 2001 From: "2569718930@qq.com" <2569718930@qq.com> Date: Tue, 26 May 2026 03:19:28 +0800 Subject: [PATCH] =?UTF-8?q?CI=20=E7=AE=80=E5=8C=96=EF=BC=9A=E7=A7=BB?= =?UTF-8?q?=E9=99=A4=20SCP=20artifact=EF=BC=8CDockerfile=20=E5=86=85=20npm?= =?UTF-8?q?=20run=20build?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 32 ++++++++------------------------ docker-compose.yml | 2 +- 2 files changed, 9 insertions(+), 25 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 387afc4d..eb1e53bc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -54,37 +54,21 @@ jobs: - name: Build run: npm run build - - name: Upload frontend build artifact - uses: actions/upload-artifact@v4 - with: - name: frontend-next - path: | - frontend/.next - frontend/package.json - frontend/package-lock.json - frontend/next.config.mjs - frontend/public - !frontend/.next/cache - deploy: needs: [python-quality, frontend-quality] if: github.event_name == 'push' && github.ref == 'refs/heads/main' runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Download frontend build artifact - uses: actions/download-artifact@v4 - with: - name: frontend-next - path: frontend - - name: Deploy to VPS run: | mkdir -p ~/.ssh echo "${{ secrets.VPS_SSH_KEY }}" > ~/.ssh/id_rsa chmod 600 ~/.ssh/id_rsa - ssh -o StrictHostKeyChecking=accept-new ${{ secrets.VPS_USER }}@${{ secrets.VPS_HOST }} "cd /root/PolyWeather && git fetch origin main && git reset --hard origin/main && mkdir -p frontend" - scp -o StrictHostKeyChecking=accept-new -r frontend/.next frontend/package.json frontend/package-lock.json frontend/next.config.mjs ${{ secrets.VPS_USER }}@${{ secrets.VPS_HOST }}:/root/PolyWeather/frontend/ - ssh -o StrictHostKeyChecking=accept-new ${{ secrets.VPS_USER }}@${{ secrets.VPS_HOST }} "cd /root/PolyWeather && docker compose down && docker compose up -d --build && sleep 10 && curl -s http://localhost:8000/healthz" + ssh -o StrictHostKeyChecking=accept-new ${{ secrets.VPS_USER }}@${{ secrets.VPS_HOST }} " + cd /root/PolyWeather + git fetch origin main && git reset --hard origin/main + docker compose down + docker compose up -d --build + sleep 10 + curl -s http://localhost:8000/healthz + " diff --git a/docker-compose.yml b/docker-compose.yml index 658161fc..5032d32b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -37,7 +37,7 @@ services: NEXT_PUBLIC_SUPABASE_ANON_KEY: '' NEXT_PUBLIC_SUPABASE_URL: '' context: ./frontend - dockerfile: prod.Dockerfile + dockerfile: Dockerfile container_name: polyweather_frontend environment: NEXT_PUBLIC_POLYWEATHER_API_BASE_URL: ${NEXT_PUBLIC_POLYWEATHER_API_BASE_URL:-}