version: "3.9"

services:
  backend:
    build:
      context: ./backend
      dockerfile: ./Dockerfile
    volumes:
      - ./backend/app:/lumen/app
      - ./backend/bootstrap:/lumen/bootstrap
      - ./backend/config:/lumen/config
      - ./backend/public:/lumen/public
      - ./backend/resources:/lumen/resources
      - ./backend/routes:/lumen/routes
      - ./backend/storage:/lumen/storage
      - ./backend/tests:/lumen/tests
      - ./backend/.env:/lumen/.env
      - ./backend/artisan:/lumen/artisan
      - ./backend/phpunit.xml:/lumen/phpunit.xml
    ports:
      - 8080:8080

  frontend:
    build:
      context: ./frontend
      dockerfile: ./Dockerfile
    volumes:
      - ./frontend/src:/angular/src
      - ./frontend/angular.json:/angular/angular.json
      - ./frontend/karma.conf.js:/angular/karma.conf.js
      - ./frontend/README.md:/angular/README.md
      - ./frontend/tsconfig.app.json:/angular/tsconfig.app.json
      - ./frontend/tsconfig.json:/angular/tsconfig.json
      - ./frontend/tsconfig.spec.json:/angular/tsconfig.spec.json
    ports:
      - 4200:4200

  database:
    image: postgres:13
    restart: unless-stopped
    environment:
      POSTGRES_PASSWORD: admin
      PGDATA: "/var/lib/postgresql/data/pgdata"
    volumes:
      - ./database/init:/docker-entrypoint-initdb.d
      - database:/var/lib/postgresql/data
    ports:
      - 5400:5432

  cache: 
    image: redis
    restart: unless-stopped
    volumes:
      - cache:/data

volumes:
  database:
  cache:

