services:
  server:
    image: debian:bookworm-slim
    container_name: hw4-server
    working_dir: /app
    env_file:
      - .env
    networks:
      net-hw4:
        ipv4_address: ${SERVER_IP}
    volumes:
      - ./bin/server:/usr/local/bin/server:ro
    entrypoint: ["bash", "-lc", "apt-get update && apt-get install -y --no-install-recommends libstdc++6 iproute2 libssl-dev; exec stdbuf -oL -eL /usr/local/bin/server"]

  client:
    image: debian:bookworm-slim
    container_name: hw4-client
    working_dir: /app
    env_file:
      - .env
    networks:
      net-hw4:
        ipv4_address: ${CLIENT_IP}
    depends_on:
      - server
    stdin_open: true
    tty: true
    volumes:
      - ./bin/client:/usr/local/bin/client:ro
    entrypoint: ["bash", "-lc", "apt-get update && apt-get install -y --no-install-recommends libstdc++6 iproute2 libssl-dev; exec stdbuf -oL -eL /usr/local/bin/client"]

networks:
  net-hw4:
    name: net-hw4
    driver: bridge
    ipam:
      config:
        - subnet: ${NET_SUBNET}
