version: '3'

networks:
  proxy:
    external: true
  mongo:
    internal: true

services:
  pocketcraft:
    # image: maael/pocketcraft:latest
    build:
      context: ./
      args:
        MONGO_URI: mongodb://mongo:27017
    restart: always
    ports:
      - "3042:3042"
    environment:
      MONGO_URI: mongodb://mongo:27017
    labels:
      - traefik.backend=pocketcraft
      - traefik.frontend.rule=Host:pocketcraft.mael.tech
      - traefik.docker.network=proxy
      - traefik.port=3042
    networks:
      - proxy
      - mongo

  mongo:
    image: maael/pocketcraft-db:latest
    hostname: mongo
    restart: always
    expose:
      - 27017
    environment:
      - MONGO_DATA_DIR=/data/db
      - MONGO_LOG_DIR=/data/log
    volumes:
      - ./data/db:/data/db
      - ./data/log:/data/log
    networks:
      - mongo
