diff --git a/Dockerfile b/Dockerfile index 213f8d3..d22fc3e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,6 +16,8 @@ RUN pnpm install --no-frozen-lockfile # 2. Build the project FROM base AS builder WORKDIR /app +ARG NEXT_PUBLIC_ASSET_PREFIX="" +ENV NEXT_PUBLIC_ASSET_PREFIX=$NEXT_PUBLIC_ASSET_PREFIX COPY --from=deps /app/node_modules ./node_modules COPY --from=deps /app/apps/web/node_modules ./apps/web/node_modules COPY --from=deps /app/packages/contracts/node_modules ./packages/contracts/node_modules diff --git a/README.md b/README.md index a16e952..6a74f1b 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,7 @@ VIBEWORK_JOB_SECRET="your-cron-job-secret" # A2A demand funnel:外部 Agent 導流需求方到 VibeWork paid intake VIBEWORK_SITE_URL="https://vibework.wooo.work" NEXT_PUBLIC_VIBEWORK_SITE_URL="https://vibework.wooo.work" +NEXT_PUBLIC_ASSET_PREFIX="https://agent.wooo.work" AGENT_GATEWAY_URL="https://agent.wooo.work" VIBEWORK_TREASURY_USDC_ADDRESS="" VIBEWORK_TREASURY_WALLET_LABEL="USDC Treasury" diff --git a/apps/web/next.config.ts b/apps/web/next.config.ts index 517ee9f..fac0bca 100644 --- a/apps/web/next.config.ts +++ b/apps/web/next.config.ts @@ -1,8 +1,11 @@ import type { NextConfig } from "next"; +const assetPrefix = process.env.NEXT_PUBLIC_ASSET_PREFIX?.trim().replace(/\/$/, ""); + const nextConfig: NextConfig = { transpilePackages: ["@agent-bounty/contracts"], output: "standalone", + assetPrefix: assetPrefix || undefined, }; export default nextConfig; diff --git a/docker-compose.yml b/docker-compose.yml index 170fb3c..165855a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -40,6 +40,8 @@ services: build: context: . dockerfile: Dockerfile + args: + NEXT_PUBLIC_ASSET_PREFIX: ${NEXT_PUBLIC_ASSET_PREFIX:-https://agent.wooo.work} container_name: agent_bounty_web restart: always ports: @@ -56,6 +58,7 @@ services: - VIBEWORK_JOB_SECRET=${VIBEWORK_JOB_SECRET:-} - VIBEWORK_SITE_URL=${VIBEWORK_SITE_URL:-https://vibework.wooo.work} - NEXT_PUBLIC_VIBEWORK_SITE_URL=${NEXT_PUBLIC_VIBEWORK_SITE_URL:-https://vibework.wooo.work} + - NEXT_PUBLIC_ASSET_PREFIX=${NEXT_PUBLIC_ASSET_PREFIX:-https://agent.wooo.work} - AGENT_GATEWAY_URL=${AGENT_GATEWAY_URL:-https://agent.wooo.work} - VIBEWORK_TREASURY_USDC_ADDRESS=${VIBEWORK_TREASURY_USDC_ADDRESS:-} - VIBEWORK_TREASURY_WALLET_LABEL=${VIBEWORK_TREASURY_WALLET_LABEL:-USDC Treasury} diff --git a/ops/nginx/vibework-propose-proxy.conf b/ops/nginx/vibework-propose-proxy.conf new file mode 100644 index 0000000..e13bf7a --- /dev/null +++ b/ops/nginx/vibework-propose-proxy.conf @@ -0,0 +1,39 @@ +# Nginx snippet for 192.168.0.188 / vibework.wooo.work. +# Purpose: keep A2A paid intake on the VibeWork brand domain while the agent app +# serves /propose and /propose/success from port 3004. +# +# Place these locations inside the existing HTTPS server block for: +# server_name vibework.wooo.work; +# +# The web image should be built with: +# NEXT_PUBLIC_ASSET_PREFIX=https://agent.wooo.work +# +# That avoids collisions with the official VibeWork site's own /_next assets. + +location = /propose { + proxy_pass http://127.0.0.1:3004; + proxy_http_version 1.1; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Forwarded-Host $host; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_read_timeout 300s; + proxy_connect_timeout 60s; +} + +location ^~ /propose/ { + proxy_pass http://127.0.0.1:3004; + proxy_http_version 1.1; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Forwarded-Host $host; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_read_timeout 300s; + proxy_connect_timeout 60s; +}