version: '3.8'

services:
  app:
    build:
      context: ./
      dockerfile: ./deploy/Dockerfile
    volumes:
      - data:/home/app/data
      - config:/home/app/config
    links:
      - db
    depends_on:
      - db
    restart:
      always
    command: ./entrypoint.sh

  db:
    image: postgres:latest
    restart: always
    volumes:
      - ./data/db:/var/lib/postgresql/data
      - ./.init.sql:/docker-entrypoint-initdb.d/10-init.sql
    env_file:
      - .env.db

  nginx:
    image: nginx:latest
    restart: always
    links:
      - app
    ports:
      - "8000:80"
    volumes:
      - ./logs:/var/log/nginx
      - ./deploy/nginx/proxy_params:/etc/nginx/proxy_params
      - ./deploy/nginx/app.conf:/etc/nginx/conf.d/app.conf

volumes:
  db:
  data:
  config:
