README.md 2.1 KB

🐳 Docker Deployment

Prerequisites

  • Docker and Docker Compose installed
  • Domain name (for production)
  • SSL certificates (optional)

Configuration Files

docker-compose.yml

services:
  byom-web:
    container_name: byom-web
    build:
      context: /path/to/byom-web
      dockerfile: Dockerfile
    environment:
      - NEXT_PUBLIC_API_URL=${API_URL:-http://localhost:3001}
      - NODE_ENV=production
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.web.rule=Host(`${DOMAIN:-localhost}`)"
      - "traefik.http.services.web.loadbalancer.server.port=3000"
      # HTTPS redirect
      - "traefik.http.middlewares.https-redirect.redirectscheme.scheme=https"
      - "traefik.http.routers.web.middlewares=https-redirect"
      # Secure router
      - "traefik.http.routers.web-secure.rule=Host(`${DOMAIN:-localhost}`)"
      - "traefik.http.routers.web-secure.entrypoints=websecure"
      - "traefik.http.routers.web-secure.tls=true"
    networks:
      - traefik-public
    restart: unless-stopped

networks:
  traefik-public:
    external: true

Quick Start

  1. Create network for Traefik:

    docker network create traefik-public
    
  2. Configure environment variables:

    # Copy example env file
    cp .env.example .env
    
    # Edit with your settings
    nano .env
    
  3. Deploy the stack:

    docker compose up -d
    

Environment Variables

# Domain configuration
DOMAIN=your-domain.com        # Your domain name
API_URL=https://api.domain.com # Backend API URL

# Optional SSL config
SSL_EMAIL=your@email.com      # For Let's Encrypt notifications

Accessing the Application

  • Web UI: https://your-domain.com
  • Traefik Dashboard: http://localhost:8080 (development only)

Common Commands

# View logs
docker compose logs -f

# Restart services
docker compose restart

# Stop stack
docker compose down

# Update images and restart
docker compose pull
docker compose up -d

Production Considerations

  • Enable SSL in Traefik configuration
  • Disable Traefik dashboard
  • Use proper secrets management
  • Set up monitoring