services:
  pterodactyl-china:
    image: ghcr.io/pterodactyl-china/panel:v1.12.1.0
    command: >
      /bin/sh -c "
      if [ ! -f /app/var/initialized ]; then
        php artisan p:user:make --email=${MAIL_FROM} --username=admin --password=123456 --admin=1 --name-first=admin --name-last=admin;
        touch /app/var/initialized;
      fi;
      supervisord -n -c /etc/supervisord.conf"
    container_name: ${CONTAINER_NAME}
    environment:
      - USER_UID=${USER_UID}
      - USER_GID=${USER_GID}
      - DB_CONNECTION=${PANEL_DB_TYPE}
      - DB_HOST=${PANEL_DB_HOST}
      - DB_PORT=${PANEL_DB_PORT}
      - DB_DATABASE=${PANEL_DB_NAME}
      - DB_USERNAME=${PANEL_DB_USER}
      - DB_PASSWORD=${PANEL_DB_USER_PASSWORD}
      - APP_URL=${PANEL_APP_URL}
      - APP_TIMEZONE=${TIME_ZONE}
      - APP_SERVICE_AUTHOR=${APP_SERVICE_AUTHOR}
      - MAIL_FROM=${MAIL_FROM}
      - MAIL_DRIVER=${MAIL_DRIVER}
      - MAIL_HOST=${MAIL_HOST}
      - MAIL_PORT=${MAIL_PORT}
      - MAIL_USERNAME=${MAIL_USERNAME}
      - MAIL_PASSWORD=${MAIL_PASSWORD}
      - MAIL_ENCRYPTION=${MAIL_ENCRYPTION}
      - APP_ENV=${APP_ENV}
      - APP_ENVIRONMENT_ONLY=${APP_ENVIRONMENT_ONLY}
      - CACHE_DRIVER=${CACHE_DRIVER}
      - SESSION_DRIVER=${SESSION_DRIVER}
      - QUEUE_DRIVER=${QUEUE_DRIVER}
      - REDIS_HOST=${REDIS_HOST}
      - REDIS_PASSWORD=${PANEL_REDIS_ROOT_PASSWORD}
      - RECAPTCHA_ENABLED=${RECAPTCHA_ENABLED}
    restart: always
    networks:
      - 1panel-network
    volumes:
      - ./data/var/:/app/var/
      - ./data/nginx/:/etc/nginx/http.d/
      - ./data/certs/:/etc/letsencrypt/
      - ./data/logs/:/app/storage/logs
    ports:
      - "${PANEL_APP_PORT_HTTP}:80"
    labels:
      createdBy: "Apps"
networks:
  1panel-network:
    external: true
