version: "3.4"
services:

  redis:
    image: redis
    hostname: redis
    networks:
      - hpndev
    ports:
      - 6379:6379

  exec:
    image: node
    volumes:
      - "./:/home"
    working_dir: "/home"
    environment:
      - REDIS_HOST=redis
      - REDIS_PORT=6379
    command: [ "bash", "-lc", "npm ci || npm i && npm run build && ${FILE}" ]
    depends_on:
      - redis
    networks:
      - hpndev

  tests:
    image: node
    volumes:
      - "./:/home"
    working_dir: "/home"
    environment:
      - REDIS_HOST=redis
      - REDIS_PORT=6379
    command: [ "bash", "-lc", "npm ci || npm i && npm run build && npx ts-node -P tsconfig.tests.json tests/index.ts" ]
    depends_on:
      - redis
    networks:
      - hpndev

networks:
  hpndev:


