version: "3.7"

services:
  backend:
    build: .
    container_name: tj-project-app
    ports:
      - 9001:9000
    restart: always
    volumes: 
      - ./mount/backend:/usr/local/data
    networks:
      - spring-postgres
    depends_on: 
      - db
      - redis
  db:
    build: ./postgres
    container_name: tj-project-db
    ports:
      - 5433:5432
    restart: always
    volumes:
      - ./mount/db:/var/lib/postgresql/data
    networks:
      - spring-postgres
    environment:
      - POSTGRES_DB=tj_project
      - POSTGRES_PASSWORD=admin503
  redis:
    image: redis
    container_name: tj-project-redis
    volumes:
      - ./mount/redis:/usr/local/etc/redis
    expose: 
      - 6379
    networks: 
      - spring-postgres

networks:
  spring-postgres: