Deployments
Next.js
Deploy a Next.js app from GitHub using the Dockerfile build pack (recommended default). Devployer exposes port 3000 and sets PORT / HOSTNAME for the container.
Before you start
- A Devployer account and a project with an environment
- A public or private GitHub repository with a Next.js app
- A root
Dockerfile(create one if missing — vibecoding / MCP should add it at the project root) - Optional: MCP + Deploy with MCP
1. Create the app in Devployer
- Open your project and environment
- Add resource → Public GitHub or Private GitHub
- Select framework Next.js
- Keep Build pack → Dockerfile (recommended)
- Dockerfile path:
/Dockerfile(root) - Pick a plan and complete payment when asked
- Finish creation (leave instant deploy off to deploy later from MCP)
2. Root Dockerfile
Your repository must include a Dockerfile at the root. If it does not exist, create one before deploy (MCP/vibecoding will do this when you choose Dockerfile).
A typical Next.js standalone image listens on 3000 and matches Devployer’s ports_exposes: "3000".
Example pattern (adapt to your app):
FROM node:22-alpine AS deps
WORKDIR /app
COPY package.json package-lock.json* ./
RUN npm ci
FROM node:22-alpine AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
RUN npm run build
FROM node:22-alpine AS runner
WORKDIR /app
ENV NODE_ENV=production
ENV PORT=3000
ENV HOSTNAME=0.0.0.0
COPY --from=builder /app/public ./public
COPY --from=builder /app/.next/standalone ./
COPY --from=builder /app/.next/static ./.next/static
EXPOSE 3000
CMD ["node", "server.js"]
Enable output: 'standalone' in next.config when using this layout.
3. Deploy from Cursor (MCP)
- Connect MCP — MCP
- If no root
Dockerfileexists, the agent creates it; then commit/push - In chat: “Deploy my app on Devployer”
- The agent uses Dockerfile only and shows the logs
Full guide: Deploy with MCP.
Tips
- Port must stay 3000 for the standard Next.js Docker path
- Prefer Dockerfile over Nixpacks for Next.js on Devployer
- See also Dockerfile and Deploy with MCP
Quick checklist
- Next.js selected in Devployer with Dockerfile build pack
- Root
Dockerfileexists and is pushed - App listens on 3000 inside the container
- Deploy from portal or MCP
- Public URL loads when the build finishes