version: '3'

services:
  # Banco de dados (PostgreSQL)
  postgres:
    image: postgres:13
    environment:
      POSTGRES_PASSWORD: senhaSegura123
      POSTGRES_USER: alfresco
      POSTGRES_DB: alfresco
    volumes:
      - postgres_data:/var/lib/postgresql/data
    restart: unless-stopped

  # Busca (Solr 6)
  solr:
    image: alfresco/alfresco-search-services:2.0.5
    environment:
      SOLR_ALFRESCO_HOST: alfresco
      SOLR_ALFRESCO_PORT: 8080
      SOLR_SOLR_HOST: solr
      SOLR_SOLR_PORT: 8983
      SOLR_CREATE_ALFRESCO_DEFAULTS: "alfresco,archive"
    volumes:
      - solr_data:/opt/alfresco-search-services/data
    depends_on:
      - alfresco
    restart: unless-stopped

  # Alfresco Content Services (ACS)
  alfresco:
    image: alfresco/alfresco-content-repository-community:7.3.0
    environment:
      DB_HOST: postgres
      DB_USERNAME: alfresco
      DB_PASSWORD: senhaSegura123
      SOLR_HOST: solr
      SOLR_PORT: 8983
      JAVA_OPTS: "
        -Ddb.driver=org.postgresql.Driver
        -Ddb.url=jdbc:postgresql://postgres:5432/alfresco
        -Ddb.username=alfresco
        -Ddb.password=senhaSegura123
        -Dsolr.host=solr
        -Dsolr.port=8983
        -Xms2g -Xmx4g
      "
    volumes:
      - alfresco_data:/opt/alfresco/alf_data
    ports:
      - "8080:8080"
    depends_on:
      - postgres
    restart: unless-stopped

  # Interface Web (Share)
  share:
    image: alfresco/alfresco-share:7.3.0
    environment:
      REPO_HOST: alfresco
      REPO_PORT: 8080
      JAVA_OPTS: "
        -Xms1g -Xmx2g
      "
    ports:
      - "8180:8080"
    depends_on:
      - alfresco
    restart: unless-stopped

# Volumes para persistência
volumes:
  postgres_data:
  solr_data:
  alfresco_data: