version: '3.8'

# docker compose up -d
# docker compose exec app bundle exec rake

services:
  app:
    build:
      context: .
      dockerfile: docker-app/Dockerfile
    tty: true
    volumes:
      - .:/app
    depends_on:
      - db
  admin:
    build: docker-admin
    ports:
      - '8080:80'
    volumes:
      - ./docker-admin/config.local.php:/var/www/html/config.local.php
    depends_on:
      - db
#    environment:
#      - POSTFIXADMIN_DB_TYPE=mysqli
#      - POSTFIXADMIN_DB_HOST=db
#      - POSTFIXADMIN_DB_USER=postfix
#      - POSTFIXADMIN_DB_PASSWORD=password
#      - POSTFIXADMIN_DB_NAME=postfix
  db:
    image: mariadb:10
    ports:
      - "13306:3306"
    volumes:
      - db-data:/var/lib/mysql
      - ./docker-db/postfix.v1841.sql:/docker-entrypoint-initdb.d/postfix.sql
#      - ./docker-db/postfix.v740.sql:/docker-entrypoint-initdb.d/postfix.sql
#      - ./docker-db/postfix.v352.sql:/docker-entrypoint-initdb.d/postfix.sql
    environment:
      - MYSQL_RANDOM_ROOT_PASSWORD=yes
      - MYSQL_USER=postfix
      - MYSQL_PASSWORD=password
      - MYSQL_DATABASE=postfix
volumes:
  db-data:

version: '3.8'

# docker compose up -d
# docker compose exec app bundle exec rake

services:
  app:
    build:
      context: .
      dockerfile: docker-app/Dockerfile
    tty: true
    volumes:
      - .:/app
    environment:
      - DATABASE_URL=mysql2://postfix:password@db/postfix
    depends_on:
      - db
  admin:
    build: docker-admin
    ports:
      - '8080:80'
    volumes:
      - ./docker-admin/config.local.php:/var/www/html/config.local.php
    depends_on:
      - db
#    environment:
#      - POSTFIXADMIN_DB_TYPE=mysqli
#      - POSTFIXADMIN_DB_HOST=db
#      - POSTFIXADMIN_DB_USER=postfix
#      - POSTFIXADMIN_DB_PASSWORD=password
#      - POSTFIXADMIN_DB_NAME=postfix
  db:
    image: mariadb:10
    ports:
      - "13306:3306"
    volumes:
      - db-data:/var/lib/mysql
      - ./docker-db/postfix.v1841.sql:/docker-entrypoint-initdb.d/postfix.sql
#      - ./docker-db/postfix.v740.sql:/docker-entrypoint-initdb.d/postfix.sql
#      - ./docker-db/postfix.v352.sql:/docker-entrypoint-initdb.d/postfix.sql
    environment:
      - MYSQL_RANDOM_ROOT_PASSWORD=yes
      - MYSQL_USER=postfix
      - MYSQL_PASSWORD=password
      - MYSQL_DATABASE=postfix
volumes:
  db-data:

Set up DATABASE_URL for service app
Set up DATABASE_URL for service app
