# All build artifacts live in the named `build` volume (inside Docker), the # host only provides the source tree mounted read-write at /app. # # docker compose build # build the toolchain image # docker compose run --rm builder # configure + compile # docker compose run --rm tests # run unit tests # docker compose up server client # live HSMS demo x-base: &base build: . volumes: - .:/app - build:/app/build services: builder: <<: *base command: - bash - -lc - > cmake -S /app -B /app/build -G Ninja -DCMAKE_BUILD_TYPE=Release && cmake --build /app/build tests: <<: *base depends_on: builder: condition: service_completed_successfully command: ["ctest", "--test-dir", "/app/build", "--output-on-failure"] server: <<: *base depends_on: builder: condition: service_completed_successfully command: ["/app/build/secs_server", "--port", "5000", "--device", "0"] networks: [secs] # No host port publish: the client reaches the server over the `secs` # Docker network by service name. Uncomment to expose to the host. # ports: # - "5000:5000" client: <<: *base depends_on: builder: condition: service_completed_successfully server: condition: service_started command: ["/app/build/secs_client", "--host", "server", "--port", "5000", "--device", "0"] networks: [secs] networks: secs: {} volumes: build: {}