services:
  web1:
    build: ./web
    image: dockerinternal/e2e_test_secret_server
    ports:
      - "80:80"
    secrets:
      - source: mysecret1
        target: mytarget1
      - mysecret2
    deploy:
      restart_policy:
        condition: on-failure
      resources:
        limits:
          cpus: '0.7'
          memory: 1G
        reservations:
          cpus: '0.5'
          memory: 0.5G
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:80/healthz"]
      interval: 5s

  web2:
    build: ./web
    image: dockerinternal/e2e_test_secret_server
    ports:
      - "8080:8080"
    environment:
      - PORT=8080
    deploy:
      restart_policy:
        condition: on-failure
      resources:
        reservations:
          cpus: '0.5'
          memory: 0.7G
    secrets:
      - mysecret2

secrets:
  mysecret1:
    file: ./my_secret1.txt
  mysecret2:
    file: ./my_secret2.txt
