# Docker Compose Configuration for Local Development/Testing # This file is used to run the Next.js blog application locally using Docker # # Usage: # 1. Copy this file to project root: cp docker-compose.yml.example docker-compose.yml # 2. Build and start: docker compose up -d # 3. View logs: docker compose logs -f # 4. Stop: docker compose down # # Note: This builds from local Dockerfile, not registry image version: '3.8' services: mypage: # Build configuration build: context: . dockerfile: Dockerfile.nextjs # Use the Next.js-specific Dockerfile container_name: mypage-dev # Port mapping: host:container # Access the app at http://localhost:3030 ports: - "3030:3030" # Environment variables for development environment: - NODE_ENV=production # Use production mode even locally to test production build - NEXT_TELEMETRY_DISABLED=1 - PORT=3030 - HOSTNAME=0.0.0.0 # Optional: Mount logs directory for debugging # Uncomment if your application writes logs to /app/logs # volumes: # - ./logs:/app/logs # Restart policy: restart unless explicitly stopped restart: unless-stopped # Network configuration networks: - mypage-network # Health check configuration # Docker will check if the app is healthy healthcheck: test: ["CMD", "curl", "-f", "http://localhost:3030/"] interval: 30s timeout: 10s retries: 3 start_period: 40s networks: mypage-network: driver: bridge # ============================================ # Common Commands # ============================================ # # Build and start containers: # docker compose up -d # # Build with no cache (clean build): # docker compose build --no-cache # docker compose up -d # # View logs (follow mode): # docker compose logs -f mypage # # Stop containers: # docker compose down # # Stop and remove volumes: # docker compose down -v # # Restart service: # docker compose restart mypage # # Access container shell: # docker compose exec mypage /bin/sh # # Check container status: # docker compose ps # # View resource usage: # docker stats mypage-dev