# Painless development and deployment with Docker.
# Visit the docs at https://docs.docker.com/compose/

version: "2"

volumes:
  database_data: {}

services:
  webserver:
    build: ./config/webserver
    ports:
      - "80:80"
    volumes_from:
      - application
    depends_on:
      - application

  application:
    build:
      context: .
      dockerfile: ./config/application/Dockerfile
    user: application
    depends_on:
      - database

  database:
    image: postgres
    volumes:
      - database_data:/var/lib/postgresql/data

# Painless development and deployment with Docker.
# Visit the docs at https://docs.docker.com/compose/

version: "2"

volumes:
  database_data: {}

services:
  webserver:
    build: ./config/webserver
    ports:
      - "80:80"
    volumes_from:
      - application
    depends_on:
      - application

  application:
    build:
      context: .
      dockerfile: ./config/application/Dockerfile
    user: application
{%- if cookiecutter.database in ['Postgres', 'MySQL/MariaDB'] %}
    depends_on:
      - database
{% endif %}

{%- if cookiecutter.database == 'Postgres' %}
  database:
    image: postgres
    # Make database accessible on localhost during development
    # # NOTE: on OS X and Windows you need to configure port forwarding in addition,
    # # ----  if you use VirtualBox and docker-machine; see
    # #     https://jihedamine.github.io/docker-liferay-virtualbox#setup-port-forwarding
    # #     https://docs.docker.com/engine/installation/#/on-macos-and-windows
    # ports:
    #   - "5432:5432"
    volumes:
      - database_data:/var/lib/postgresql/data
{%- elif cookiecutter.database == 'MySQL/MariaDB' %}
  database:
    image: mysql
    # Make database accessible on localhost during development
    # # NOTE: on OS X and Windows you need to configure port forwarding in addition,
    # # ----  if you use VirtualBox and docker-machine; see
    # #     https://jihedamine.github.io/docker-liferay-virtualbox#setup-port-forwarding
    # #     https://docs.docker.com/engine/installation/#/on-macos-and-windows
    # ports:
    #   - "3306:3306"
    volumes:
      - database_data:/var/lib/mysql/data
{%- endif %}

Use appropriate Docker image for database
Use appropriate Docker image for database
