version: '3.6'
services:
  pkcs11proxyd-unix:
    image: "pkcs11proxyd-unix:${FLAVOR}"
    build:
      context: .
      dockerfile: src/tests/integration/Dockerfile.debian-integration-unix
      args:
        dist: "${DIST}"
        flavor: "${FLAVOR}"
    volumes:
      - ./src/tests/integration/filter.conf:/build/src/tests/integration/filter.conf:ro
      - ./src/tests/integration/pkcs11proxyd-unix.conf:/build/src/tests/integration/pkcs11proxyd.conf:ro
      - vol-pkcs11proxyd-unix:/var/run/
    entrypoint: '/usr/local/bin/pkcs11proxyd -fg -conf /build/src/tests/integration/pkcs11proxyd.conf'
  pkcs11proxydtls-unix:
    image: "pkcs11proxydtls-unix:${FLAVOR}"
    build:
      context: .
      dockerfile: src/tests/integration/Dockerfile.debian-integration-unix-tls
      args:
        dist: "${DIST}"
        flavor: "${FLAVOR}"
    volumes:
      - ./src/tests/integration/filter.conf:/build/src/tests/integration/filter.conf:ro
      - ./src/tests/integration/pkcs11proxyd-unix-tls.conf:/build/src/tests/integration/pkcs11proxyd.conf:ro
      - ./src/tests/integration/certs/ca.pem:/build/src/tests/integration/ca.pem:ro
      - ./src/tests/integration/certs/server.pem:/build/src/tests/integration/server.pem:ro
      - ./src/tests/integration/certs/server-key.pem:/build/src/tests/integration/server-key.pem:ro
      - vol-pkcs11proxydtls-unix:/var/run/
    entrypoint: '/usr/local/bin/pkcs11proxyd -fg -conf /build/src/tests/integration/pkcs11proxyd.conf'
  client-unix:
    image: "pkcs11proxyd-unix:${FLAVOR}"
    depends_on:
      - "pkcs11proxyd-unix"
    volumes:
      - vol-pkcs11proxyd-unix:/var/run/
    environment: 
      - PKCS11PROXY_LIBNAME=softhsm
    entrypoint: /build/src/tests/integration/run-tests.sh
  client-unix-tls:
    image: "pkcs11proxydtls-unix:${FLAVOR}"
    depends_on:
      - "pkcs11proxydtls-unix"
    environment: 
      - PKCS11PROXY_LIBNAME=softhsm
      - PKCS11PROXY_CA_FILE=/tmp/ca.pem
      - PKCS11PROXY_CERT_FILE=/tmp/client.pem
      - PKCS11PROXY_PRIVKEY_FILE=/tmp/client-key.pem
    volumes:
      - vol-pkcs11proxydtls-unix:/var/run/
      - ./src/tests/integration/certs/ca.pem:/tmp/ca.pem:ro
      - ./src/tests/integration/certs/client.pem:/tmp/client.pem:ro
      - ./src/tests/integration/certs/client-key.pem:/tmp/client-key.pem:ro
    entrypoint: /build/src/tests/integration/run-tests.sh
volumes:
  vol-pkcs11proxyd-unix:
  vol-pkcs11proxydtls-unix: