version: '3.8'
services:
  my-service:
    image: alpine
    command: tail -f /dev/null
    init: true
    depends_on:
      nginx: {condition: service_healthy}

  nginx:
    image: nginx:alpine
    stop_signal: SIGTERM
    healthcheck:
      test:     "echo | nc -w 5 localhost:80"
      interval: 2s
      timeout:  1s
      retries:  10
