version: "3"
services:
  ghost:
    image: ghost:latest
    # build:
    #   context: ./nginx
    #   dockerfile: Dockerfile
    volumes:
      - /srv/ghost:/var/lib/ghost/content
    environment:
      url: https://read.knast.cc
      database__client: sqlite3
      database__connection__filename: /var/lib/ghost/content/data/ghost.db
      # database__client: mysql
      # database__connection__host: ghost_db
      # database__connection__user: root
      # database__connection__password: RJbhYNaCEB3fu8cbtkteetxTR5LtZjnPsqATGgPZ
      # database__connection__database: ghost
    volumes:
      - /home/ghost/content:/var/lib/ghost/content/data
    networks:
      - traefik
      # - default
    # depends_on:
    #   - ghost_db
    restart: unless-stopped
    ports:
      - 2368:2368
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.ghost.entrypoints=websecure"
      - "traefik.http.routers.ghost.rule=Host(`read.$DOMAIN_NAME`)"
      - "traefik.http.routers.ghost.tls.certresolver=letsencr"
      - "traefik.http.services.ghost.loadbalancer.server.port=2368"

  # ghost_db:
  #   image: mysql:8
  #   networks:
  #     - default
  #   restart: unless-stopped
  #   command: --default-authentication-plugin=mysql_native_password
  #   environment:
  #     MYSQL_ROOT_PASSWORD: RJbhYNaCEB3fu8cbtkteetxTR5LtZjnPsqATGgPZ
  #   volumes:
  #     - /srv/ghost_mysql:/var/lib/mysql
    # ports:
    #   - 3366:3306

networks:
  traefik:
    external: true
  default:
    external: false