services:
  app:
    build:
      context: .
      dockerfile: Dockerfile
    ports:
      - '3000:3000' # Node.js
      # - '4983:4983' # Drizzle Studio
    volumes:
      - .:/app
      - /app/node_modules
    environment:
      NODE_ENV: development
    command: ["sh", "-c", "pnpm db:push && pnpm run dev"]
    depends_on:
      - db

  db:
    image: postgres
    restart: always
    # ports:
      # - 5432:5432 # DEBUG
    volumes:
      - postgres:/var/lib/postgresql/data
    environment:
      POSTGRES_USER: ${POSTGRES_USER}
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
      POSTGRES_DB: ${POSTGRES_DB}

  adminer:
    image: adminer
    restart: always
    ports:
      - 8080:8080

volumes:
  postgres:
