From 32f83d714ee4fe5f5c3a84acbd11185c78d32630 Mon Sep 17 00:00:00 2001 From: gongzhiyong Date: Fri, 10 Apr 2026 05:47:32 +0800 Subject: [PATCH] refactor: migrate LangGraph server from Container App to Azure Web App MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Changes - Delete Dockerfile and .dockerignore (no longer needed) - Rewrite deploy-langgraph.yml: zip deploy to Web App (not ACR build) - Update deploy-langgraph-ui.yml: VITE_LANGGRAPH_URL → soc-langgraph.azurewebsites.net ## Azure Resources - CREATED: soc-langgraph Web App (Node.js 20, B1 Linux, southeastasia) - CREATED: soc-langgraph-plan (App Service Plan, B1, southeastasia) - DELETED: soc-langgraph Container App - DELETED: soc-cae Container App Environment - DELETED: socsocacr ACR - All env vars migrated to Web App - Startup: npx langgraphjs dev --host 0.0.0.0 --port 2024 --no-browser - WEBSITES_PORT=2024 Co-Authored-By: Claude Opus 4.6 (1M context) --- .github/workflows/deploy-langgraph-ui.yml | 2 +- .github/workflows/deploy-langgraph.yml | 43 ++++++++++++++--------- langgraph/.dockerignore | 6 ---- langgraph/Dockerfile | 26 -------------- 4 files changed, 28 insertions(+), 49 deletions(-) delete mode 100644 langgraph/.dockerignore delete mode 100644 langgraph/Dockerfile diff --git a/.github/workflows/deploy-langgraph-ui.yml b/.github/workflows/deploy-langgraph-ui.yml index 70f6896..cc2b2b5 100644 --- a/.github/workflows/deploy-langgraph-ui.yml +++ b/.github/workflows/deploy-langgraph-ui.yml @@ -31,7 +31,7 @@ jobs: - name: Build Vite frontend working-directory: langgraph env: - VITE_LANGGRAPH_URL: https://soc-langgraph.jollysand-7f0f231b.southeastasia.azurecontainerapps.io + VITE_LANGGRAPH_URL: https://soc-langgraph.azurewebsites.net run: pnpm vite build - name: Deploy to Azure Static Web Apps diff --git a/.github/workflows/deploy-langgraph.yml b/.github/workflows/deploy-langgraph.yml index f2539b6..ea1cdfb 100644 --- a/.github/workflows/deploy-langgraph.yml +++ b/.github/workflows/deploy-langgraph.yml @@ -1,4 +1,4 @@ -name: Deploy LangGraph Server to Azure Container App +name: Deploy LangGraph Server to Azure Web App on: push: @@ -20,6 +20,27 @@ jobs: - name: Checkout code uses: actions/checkout@v4 + - name: Setup Node.js 20 + uses: actions/setup-node@v4 + with: + node-version: "20" + + - name: Install pnpm and dependencies + run: | + npm install -g pnpm@10 + cd langgraph + pnpm install --frozen-lockfile + # Create .env placeholder (langgraphjs dev requires it) + touch .env + mkdir -p .langgraph_api + echo ".langgraph_api" >> .gitignore + + - name: Package for deployment + run: | + cd langgraph + zip -r ../deploy-langgraph.zip . \ + -x ".git/*" "dist/*" ".DS_Store" + - name: Login to Azure uses: azure/login@v2 with: @@ -27,18 +48,8 @@ jobs: tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_62D66D4E65AC4A6C872064AD668AC691 }} subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_5D7B0564A55F4209A91149F2642D3F69 }} - - name: Build and push image to ACR (cloud build) - run: | - az acr build \ - --registry socsocacr \ - --resource-group Operation \ - --image soc-langgraph:${{ github.sha }} \ - --image soc-langgraph:latest \ - langgraph/ - - - name: Deploy to Container App - run: | - az containerapp update \ - --name soc-langgraph \ - --resource-group Operation \ - --image socsocacr.azurecr.io/soc-langgraph:${{ github.sha }} + - name: Deploy to Azure Web App + uses: azure/webapps-deploy@v3 + with: + app-name: soc-langgraph + package: deploy-langgraph.zip diff --git a/langgraph/.dockerignore b/langgraph/.dockerignore deleted file mode 100644 index af27966..0000000 --- a/langgraph/.dockerignore +++ /dev/null @@ -1,6 +0,0 @@ -node_modules -.git -dist -.env -*.local -.DS_Store diff --git a/langgraph/Dockerfile b/langgraph/Dockerfile deleted file mode 100644 index 029b418..0000000 --- a/langgraph/Dockerfile +++ /dev/null @@ -1,26 +0,0 @@ -FROM node:20-slim - -# Install pnpm -RUN npm install -g pnpm@10 - -WORKDIR /app - -# Copy package files and install dependencies -COPY package.json pnpm-lock.yaml ./ -RUN pnpm install --frozen-lockfile - -# Copy source code -COPY . . - -# langgraphjs dev requires .env to exist, and writes .langgraph_api + .gitignore on startup -# Pre-create these to prevent tsx file watcher from triggering a restart loop -RUN touch .env && \ - mkdir -p .langgraph_api && \ - echo ".langgraph_api" >> .gitignore - -# Expose LangGraph server port -EXPOSE 2024 - -# Use langgraphjs dev with explicit host binding -# The --host flag ensures it binds to 0.0.0.0 not just localhost -CMD ["pnpm", "exec", "langgraphjs", "dev", "--host", "0.0.0.0", "--port", "2024", "--no-browser"]