version: "3"

networks:
  app-tier:
    driver: bridge

services:
  postgresql:
    container_name: shellvalier-postgresql
    image: postgres:14.2
    shm_size: 1gb
    environment:
      POSTGRES_USER: "shellvalier"
      POSTGRES_DB: "shellvalier"
      POSTGRES_PASSWORD: "shellvalier"
      POSTGRES_INITDB_ARGS: "--encoding=UTF-8 --lc-collate=en_US.UTF-8 --lc-ctype=en_US.UTF-8"
    networks:
      - app-tier
    volumes:
      - ${DATABASE_DIR}:/var/lib/postgresql/data

  backend:
    #platform: linux/amd64
    container_name: shellvalier-backend
    image: shellvalier-developer:latest
    build:
      context: .
      dockerfile: Dockerfile
    depends_on:
      - postgresql
    networks:
      - app-tier
    env_file: .environment-dev
    volumes:
      - .:/app
    ports:
      - "80:8000"

  frontend:
    container_name: shellvalier-frontend
    image: shellvalier-frontend-developer:latest
    build:
      context: .
      dockerfile: Dockerfile-frontend
    networks:
      - app-tier
    volumes:
      - ./frontend:/src
    ports:
      - "8010:8010"
