---
# DOCKER_HOST=192.168.4.41:2376 docker-compose up -d
# DOCKER_HOST=dkhost:2376 docker stack deploy -c docker-compose.yml jenkins

version: '3.4'
volumes:
  jenkins_home:

services:
  app:
#    restart: always
#    privileged: true
#    image: "jenkins/jenkins:lts"
    image: "jenkinsci/blueocean"

    volumes:
      - jenkins_home:/var/jenkins_home
    ports:
      - "8080:8080"
      - "50000:50000"
    environment:
      - "JAVA_OPTS=-Dhudson.model.DirectoryBrowserSupport.CSP="
    deploy:
      mode: replicated
      replicas: 1
      restart_policy:
        condition: any
        delay: "5s"
        max_attempts: 3
      update_config:
        parallelism: 1
        delay: 2s
        order: start-first
      resources:
        limits:
          cpus: '2'
          memory: 1536M

#    healthcheck:
#      test: ["CMD", "curl", "-f", "http://localhost:8080/metrics/ejkxeVI-iKLy968ji9AnfYmOHGIh1kYd3gA500JqrRxzTeenT06ynR5Dqo0CQplO/ping"]
#      interval: 1m30s
#      timeout: 10s
#      retries: 3
#      start_period: 3m

#    logging:
#      driver: fluentd
#      options:
#        fluentd-address: "logs.xai-corp.net:24224"
#        fluentd-async-connect: 'true'
#        tag: jenkins

    networks:
      - prod_ui

networks:
  prod_ui:
    external:
      name: prod_ui
  prod_db:
    external:
      name: prod_db
  prod_cache:
    external:
      name: prod_cache
  prod_app:
    external:
      name: prod_app
