version: '2'

services:
  db:
    environment:
      POSTGRES_DB: app_db
      POSTGRES_USER: app_user
      POSTGRES_PASSWORD: changeme
    restart: always
    image: postgres:14.1
    expose:
      - '5432'
  redis:
    restart: always
    image: redis:6.2
    expose:
      - '6379'
  app:
    environment:
      DJANGO_SECRET_KEY: changeme
      DATABASE_URL: postgres://app_user:changeme@db/app_db
      CACHE_URL: redis://redis
    build:
      context: .
      dockerfile: ./Dockerfile
    volumes:
      - media-root:/code/bakerydemo/media
    links:
      - db:db
      - redis:redis
    ports:
      - '8000:8000'
    depends_on:
      - db
      - redis
volumes:
  media-root:
