version: '3.8'

services:
  database:
    image: postgres:16-alpine
    container_name: directus_database
    restart: unless-stopped
    volumes:
      - ./data/database:/var/lib/postgresql/data
    environment:
      POSTGRES_USER: directus
      POSTGRES_PASSWORD: directus
      POSTGRES_DB: directus
    networks:
      - directus

  cache:
    image: redis:7-alpine
    container_name: directus_cache
    restart: unless-stopped
    networks:
      - directus

  directus:
    image: directus/directus:latest
    container_name: directus
    restart: unless-stopped
    ports:
      - "8055:8055"
    volumes:
      - ./uploads:/directus/uploads
      - ./extensions:/directus/extensions
    depends_on:
      - database
      - cache
    environment:
      KEY: '255d861b-5ea1-5996-9aa3-922530ec40b1'
      SECRET: '6116487b-cda1-52c2-b5b5-c8022c45e263'
      
      DB_CLIENT: 'pg'
      DB_HOST: 'database'
      DB_PORT: '5432'
      DB_DATABASE: 'directus'
      DB_USER: 'directus'
      DB_PASSWORD: 'directus'
      
      CACHE_ENABLED: 'true'
      CACHE_STORE: 'redis'
      REDIS: 'redis://cache:6379'
      
      ADMIN_EMAIL: 'support@onesoft.hu'
      ADMIN_PASSWORD: 'ABcd1234'
      
      PUBLIC_URL: 'http://directus.oenedev.hu'
      
      WEBSOCKETS_ENABLED: 'true'
    networks:
      - directus

networks:
  directus:
    driver: bridge

volumes:
  database:
  uploads:
  extensions:
