version: '3.9'
services:
  metabase:
    image: metabase/metabase:latest
    container_name: metabase
    volumes: 
    - /dev/urandom:/dev/random:ro
    ports:
      - 14569:3000
    environment: 
      MB_DB_TYPE: postgres
      MB_DB_DBNAME: metabase
      MB_DB_PORT: 5432
      MB_DB_USER: ${USER_PG}
      MB_DB_PASS: ${PASS_PG}
      MB_DB_HOST: postgres-meta

  db:
    container_name: postgres
    image: postgres
    restart: always
    hostname: postgres-meta
    volumes:
      - postgresmetabase:/data/postgres
    environment:
      POSTGRES_USER: ${USER_PG}
      POSTGRES_PASSWORD: ${PASS_PG}
      POSTGRES_DB: metabase
      PGDATA: /data/postgres

volumes:
  postgresmetabase:
    driver: local
    driver_opts:
      type: none
      device: ${VOLUME_POSTGRES_META}
      o: bind
