Docker Compose for Next.js

A standalone Next.js application. Perfect for full-stack React apps with API routes.

nextjs react frontend fullstack
compose.yaml
services:
  web:
    build: .
    ports:
      - target: 3000
        mode: ingress
    environment:
      - NODE_ENV=production
    healthcheck:
      test:
        - CMD
        - curl
        - -f
        - http://localhost:3000/
      interval: 30s
      timeout: 5s
      retries: 3
    deploy:
      resources:
        reservations:
          cpus: "1"
          memory: 512M
    restart: unless-stopped

Services

  • web .

Deploy

$ npx defang@latest compose up

Learn more about Defang