name: librodrome
services:
  app:
    build:
      context: ../
      dockerfile: docker/Dockerfile
      target: production
    environment:
      NODE_ENV: ${NODE_ENV:-production}
      NUXT_PUBLIC_SITE_URL: ${NUXT_PUBLIC_SITE_URL:-https://librodrome.org}
      NUXT_ADMIN_PASSWORD: ${NUXT_ADMIN_PASSWORD}
      NUXT_ADMIN_SECRET: ${NUXT_ADMIN_SECRET}
      ADMIN_GIT_SYNC: ${ADMIN_GIT_SYNC:-false}
    ports:
      - 3000
    volumes:
      - ./data:/src/data
      - ./public:/src/public
      # Git sync admin → nécessite un clone du repo sur le serveur
      # avec accès push (clé SSH ou token) + ADMIN_GIT_SYNC=true dans .env
      - ../.git:/app/.git
      - ../site:/app/site
      - ../content:/app/content
      - ../public:/app/public
    restart: always
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.librodrome.rule=Host(`librodrome.org`)"
      - "traefik.http.routers.librodrome.entrypoints=websecure"
      - "traefik.http.routers.librodrome.tls.certresolver=letsencrypt"
      - "traefik.http.services.librodrome.loadbalancer.server.port=3000"
