version: '3.8'

services:  
  postgres:
    image: postgres:13
    deploy:
      replicas: 1      
    
    volumes:
      - pg_data:/var/lib/postgresql/data
    environment:
      POSTGRES_DB: kimya_db
      POSTGRES_USER: root
      POSTGRES_PASSWORD: MustB3Ch4ng3d
    ports:
      - 5433:5432
    hostname: postgres
  


  kimya_site:
      image: 'initialdeve/kimya_web:version-1.3'
      deploy:
        replicas: 2        
      environment:
          - APP_ENV=production
          - APP_DEBUG=true
          - APP_KEY=base64:BPUbkwUI/PZK29UkgVmmweDSe+ulTMCchu15+ORNkh0=

      #command: ["sh", "-c", "echo 'yes' | php artisan migrate:fresh --seed"]
      #container_name: 'api'
      working_dir: /var/www/html
      volumes:
      - ./:/var/www/html
      - /var/www/html/vendor          
      ports:
          - 80:80
      depends_on:
         - postgres
   

  pgadmin:
    image: dpage/pgadmin4:latest
    deploy:
      replicas: 1
    environment:
      PGADMIN_DEFAULT_EMAIL: admin@admin.com
      PGADMIN_DEFAULT_PASSWORD: root
      PGADMIN_LISTEN_PORT: 5050
    ports:
      - "5050:5050"

  

secrets:
  db_username:
    external: true

  db_password:
    external: true

volumes:
  pg_data: ~
  phpmyadmin_data:

