---
services:
  tima-full:
    build: "."
    deploy:
      resources:
        limits:
          cpus: "0.8"
          memory: 8G
    healthcheck:
      test: ["NONE"]
      interval: 200s
      timeout: 200s
      retries: 5
    image: adafede/tima-r
    networks:
      - service-service-frontend
    security_opt:
      - apparmor:unconfined
      - no-new-privileges:true
    user: tima-user
    volumes:
      - "./data:/home/tima-user/.tima/data"
    command: Rscript -e "tima::tima_full()"

  tima-run-app:
    build: "."
    deploy:
      resources:
        limits:
          cpus: "0.8"
          memory: 8G
    healthcheck:
      test: ["NONE"]
      interval: 200s
      timeout: 200s
      retries: 5
    ports:
      - "3838:3838"
    image: adafede/tima-r
    networks:
      - service-service-frontend
    security_opt:
      - apparmor:unconfined
      - no-new-privileges:true
    user: tima-user
    volumes:
      - "./data:/home/tima-user/.tima/data"
    command: Rscript -e "tima::run_app()"

networks:
  service-service-frontend:
