version : "3.8"
networks:
  backend:
    name: "${COMPOSE_PROJECT_NAME}"
volumes:
  src:
    name: "${COMPOSE_PROJECT_NAME}.src"
services:
  src:
    container_name: "${COMPOSE_PROJECT_NAME}.src"
    build:
      context: "../../api"
      target: "src"
    image: "${APP_NAME}/src"
    volumes:
      - src:/var/www
    networks:
      - backend
  nginx:
    container_name: "${COMPOSE_PROJECT_NAME}.nginx"
    build:
      context: "../../nginx"
      target: "ecs"
    image: "${APP_NAME}/nginx"
    ports:
      - "8888:80"
    volumes:
      - src:/var/www
    depends_on:
      - "src"
    networks:
      - backend
  api:
    container_name: "${COMPOSE_PROJECT_NAME}.api"
    build:
      context: "../../api"
      target: "ecs"
    image: "${APP_NAME}/api"
    volumes:
      - src:/var/www
    init: true
    depends_on:
      - "src"
    networks:
      - "backend"

