version: '2'

services:

  db:
    image: mariadb:10.1
    environment:
     - MYSQL_ALLOW_EMPTY_PASSWORD=yes
     - MYSQL_DATABASE=comic
    restart: always

  web:
    build:
      context: .
      dockerfile: ./dockerfiles/web/Dockerfile
    environment:
      - GOOGLE_ANALYTICS_TRACKING_ID=UA-XXXXX-Y
    command: >-
      dockerize -wait tcp://db:3306 -timeout 120s bash -c "
      envsubst < /tmp/google-analytics-tracking.js.template > /static/js/google-analytics-tracking.js
      && python manage.py migrate
      && python manage.py loaddata comic_initial_project user_everyone
      && python manage.py check_permissions
      && gunicorn -w 2 -b 0.0.0.0 comic.wsgi
      "
    links:
      - db:mysql
    depends_on:
      - db
    volumes:
      - static:/static/
    restart: always

  http:
    build: ./dockerfiles/http
    ports:
      - "8000:80"
    links:
      - web
    depends_on:
      - web
      - dropbox
    volumes:
      - static:/srv/static/:ro
    volumes_from:
      - dropbox
    restart: always

  dropbox:
    image: janeczku/dropbox
    volumes:
      - /srv/Dropbox/:/dbox/Dropbox/
    restart: always

volumes:
  static:

version: '2'

services:

  db:
    image: mariadb:10.1
    environment:
     - MYSQL_ALLOW_EMPTY_PASSWORD=yes
     - MYSQL_DATABASE=comic
    restart: always

  web:
    build:
      context: .
      dockerfile: ./dockerfiles/web/Dockerfile
    environment:
      - GOOGLE_ANALYTICS_TRACKING_ID=UA-XXXXX-Y
    command: >-
      dockerize -wait tcp://db:3306 -timeout 120s bash -c "
      envsubst < /tmp/google-analytics-tracking.js.template > /static/js/google-analytics-tracking.js
      && python manage.py migrate
      && python manage.py loaddata comic_initial_project user_everyone
      && python manage.py check_permissions
      && gunicorn -w 2 -b 0.0.0.0 comic.wsgi
      "
    links:
      - db:mysql
    depends_on:
      - db
      - dropbox
    volumes:
      - static:/static/
    volumes_from:
      - dropbox
    restart: always

  http:
    build: ./dockerfiles/http
    ports:
      - "8000:80"
    links:
      - web
    depends_on:
      - web
      - dropbox
    volumes:
      - static:/srv/static/:ro
    volumes_from:
      - dropbox
    restart: always

  dropbox:
    image: janeczku/dropbox
    volumes:
      - /srv/Dropbox/:/dbox/Dropbox/
    restart: always

volumes:
  static:

Add the Dropbox folder to the web worker
Add the Dropbox folder to the web worker
