
version: '2'
services:
  database:
    image: postgres
    env_file: .env
    volumes_from:
      - data
  data:
    image: busybox
    volumes: 
      - /etc/postgresql
      - /var/log/postgresql
      - /var/lib/postgresql
  web:
    build: .
    command: bash -c "sleep 3 && python manage.py migrate && python manage.py runserver 0.0.0.0:8000"
    volumes:
      - .:/code
    depends_on:
      - database
    env_file: .env
    ports:
      - "8000:8000"


version: '2'
services:
  database:
    image: postgres
    env_file: .env
    volumes_from:
      - data
  data:
    image: busybox
    volumes: 
      - /etc/postgresql
      - /var/log/postgresql
      - /var/lib/postgresql
  web:
    build: .
    command: bash -c "sleep 10 && python manage.py migrate && python manage.py runserver 0.0.0.0:8000"
    volumes:
      - .:/code
    depends_on:
      - database
    env_file: .env
    ports:
      - "8000:8000"

Fix build error. Database have to be up and running before the website
Fix build error. Database have to be up and running before the website
