version: '3.8' services: backend: build: context: ./backend container_name: backone_backend_prod restart: always # No ports exposed to the host! Completely internal. environment: - MONGODB_URI=${MONGODB_URI} - BACKEND_PORT=3001 env_file: - .env.production frontend: build: context: . # Optional: you can define a multi-stage production build in a separate Dockerfile if desired, # but using the standard one works if it builds Next.js standalone. container_name: backone_frontend_prod restart: always # No ports exposed to the host! Completely internal. environment: - NEXT_PUBLIC_API_URL=http://backend:3001 env_file: - .env.production depends_on: - backend nginx: image: nginx:alpine container_name: backone_nginx_prod restart: always ports: - "80:80" # If using SSL, add "443:443" later volumes: - ./nginx/conf.d:/etc/nginx/conf.d depends_on: - frontend