Files
agent-bounty-protocol/Dockerfile.agent
OG T 54500c80f7
Some checks failed
Deploy to 110 WOOO Server / deploy (push) Failing after 7s
feat: Add agent.wooo.work frontend
2026-06-08 13:27:48 +08:00

53 lines
1.6 KiB
Docker

FROM node:20-alpine AS base
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
# 1. Setup workspace & dependencies
FROM base AS deps
WORKDIR /app
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
COPY apps/agent/package.json apps/agent/
COPY packages/contracts/package.json packages/contracts/
COPY packages/mcp-server/package.json packages/mcp-server/
RUN pnpm install --frozen-lockfile
# 2. Build the project
FROM base AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY --from=deps /app/apps/agent/node_modules ./apps/agent/node_modules
COPY --from=deps /app/packages/contracts/node_modules ./packages/contracts/node_modules
COPY . .
# Build the contracts package first (though agent doesn't depend on it directly right now, it's good practice for the workspace)
RUN pnpm --filter @agent-bounty/contracts build
# Build the Next.js app
RUN pnpm --filter agent build
# 3. Production image, copy all the files and run next
FROM base AS runner
WORKDIR /app
ENV NODE_ENV production
ENV NEXT_TELEMETRY_DISABLED 1
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs
# Copy standalone Next.js build
COPY --from=builder /app/apps/agent/public ./apps/agent/public
COPY --from=builder --chown=nextjs:nodejs /app/apps/agent/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/apps/agent/.next/static ./apps/agent/.next/static
USER nextjs
EXPOSE 3001
ENV PORT 3001
ENV HOSTNAME "0.0.0.0"
# Run the standalone server
# Note: The standalone output creates a server.js file at the root of the workspace context
CMD ["node", "apps/agent/server.js"]