services:                                                                                                     
  tdsdb:
    image: mariadb
    container_name: tds-db
    restart: always
    environment:
      - MARIADB_ROOT_PASSWORD=lolpol
      - MARIADB_USER=ward
      - MARIADB_PASSWORD=lolpol
      - MARIADB_DATABASE=family
    volumes:
      - /data/tds/mariadb:/var/lib/mysql
#   ports:
#     - "3306:3306"

  tdsfront:                                                                                                        
    build: tds-front                                                                                                  
    image: tds/front
    container_name: tds-web
    restart: always
    labels:                                                                                                   
      - "traefik.http.routers.tdsfront.rule=Host(`tds.truyen.network`) && PathPrefix(`/`)"                                           
      - "traefik.http.routers.tdsfront.entrypoints=websecure"
      - "traefik.http.routers.tdsfront.tls=true"
      - "traefik.http.routers.tdsfront.tls.certresolver=myresolver"
      - "traefik.enable=true"

  tdsback:                                                                                                        
    build: tds-back                                                                                                  
    image: tds/back
    container_name: tds-api
    restart: always
    depends_on:
      - tdsdb
    labels:                                                                                                   
      - "traefik.http.routers.tdsback.rule=Host(`tds.truyen.network`) && PathPrefix(`/api`)"                                           
      - "traefik.http.routers.tdsback.entrypoints=websecure"
      - "traefik.http.routers.tdsback.tls=true"
      - "traefik.http.routers.tdsback.tls.certresolver=myresolver"
      - "traefik.enable=true"

  samplefamdb:
    image: mariadb
    container_name: samplefam-db
    restart: always
    environment:
      - MARIADB_ROOT_PASSWORD=lolpol
      - MARIADB_USER=ward
      - MARIADB_PASSWORD=lolpol
      - MARIADB_DATABASE=family
    volumes:
      - /data/samplefam/mariadb:/var/lib/mysql
#   ports:
#     - "3306:3306"

  samplefamfront:                                                                                                        
    build: sample-front                                                                                                  
    image: samplefam/front
    container_name: samplefam-web
    restart: always
    labels:                                                                                                   
      - "traefik.http.routers.samplefamfront.rule=Host(`sf.truyen.network`) && PathPrefix(`/`)"                                           
      - "traefik.http.routers.samplefamfront.entrypoints=websecure"
      - "traefik.http.routers.samplefamfront.tls=true"
      - "traefik.http.routers.samplefamfront.tls.certresolver=myresolver"
      - "traefik.enable=true"

  samplefamback:                                                                                                        
    image: tds/back
    build: 
      context: tds-back
      args:
        jarargs: -Dspring.profiles.active=sample
    container_name: samplefam-api
    restart: always
    depends_on:
      - samplefamdb
      - tdsback
    labels:                                                                                                   
      - "traefik.http.routers.samplefamback.rule=Host(`sf.truyen.network`) && PathPrefix(`/api`)"                                           
      - "traefik.http.routers.samplefamback.entrypoints=websecure"
      - "traefik.http.routers.samplefamback.tls=true"
      - "traefik.http.routers.samplefamback.tls.certresolver=myresolver"
      - "traefik.enable=true"
