version: '3'

services:
  db:
    environment:
      POSTGRES_DB: app_db
      POSTGRES_USER: app_user
      POSTGRES_PASSWORD: changeme
    restart: always
    image: postgres:10-alpine
    expose:
      - "5432"
    volumes:
      - ./docker-data/postgres-data:/var/lib/postgresql
  app:
    environment:
      DJANGO_SECRET_KEY: changeme
      DATABASE_URL: postgres://app_user:changeme@db/app_db
      BASE_URL: "http://localhost:8000"
    build:
      context: .
      dockerfile: ./Dockerfile
    stdin_open: true
    tty: true
    command: honcho start
    links:
      - db:db
    ports:
      - "8000:8000"
    volumes:
      - ./project/:/app/project/
      - ./static/:/app/static/
      - ./templates/:/app/templates/
      - ./docker-data/media:/app/media

    depends_on:
      - db
