version: '3'

services:
  ruby:
    environment:
      - DATABASE_HOST=postgres
    build:
      args:
        - RUBY_VERSION=${RUBY_VERSION:-3.2.2}
        - RUBY_PLATFORM=${RUBY_PLATFORM:-ruby}
      context: .
    volumes:
      - '.:/usr/src/app'
    depends_on:
      - postgres


  postgres:
    image: postgres
    environment:
      - POSTGRES_HOST_AUTH_METHOD=trust
      - POSTGRES_DB=jsonb_accessor
      - PGDATA=/var/lib/postgresql/data/pgdata
    volumes:                                                                                    
      - pg_data:/var/lib/postgresql/data/pgdata
    ports:
      - 5432:5432

volumes:                                                                                        
  pg_data:
