version: '3.8'

services:
  app:
    build:
      context: .
      dockerfile: Dockerfile
    container_name: dcw-app
    restart: always
    working_dir: /var/www/
    volumes:
      - .:/var/www
  nginx:
    image: nginx:1.19-alpine
    container_name: dcw-nginx
    restart: always
    ports:
      - 8003:80
    volumes:
      - ./public:/var/www/public
      - ./nginx:/etc/nginx/conf.d

  database:
    image: mysql:5.5.61
    container_name: dcw-mysql
    restart: always
    user: root
    environment:
      MYSQL_DATABASE: dcw2018
      MYSQL_ROOT_PASSWORD: root
    volumes:
      - ./database/my.cnf:/etc/mysql/mysql.conf.d/mysqld.cnf # config mysql server
      - type: bind
        source: ../database
        target: /var/lib/mysql

    ports:
      - "3306:3306"
