Files
hse-2026/homework/02-grpc-messenger/docker-compose.yml
T
2026-09-17 16:34:16 +03:00

126 lines
3.1 KiB
YAML

x-tests-image: &tests-image
image: grpc-solution-tests
build:
context: .
dockerfile: tests/Dockerfile
services:
server:
image: grpc-solution-server
build:
context: ./solution
dockerfile: server.dockerfile
environment:
MESSENGER_SERVER_PORT: 51075
ports:
- "${MESSENGER_SERVER_HOST_PORT:-51075}:51075"
# Start the clients first to exercise their reconnect logic during manual runs.
depends_on:
- client1
- client2
server-tests:
image: grpc-solution-server
build:
context: ./solution
dockerfile: server.dockerfile
environment:
MESSENGER_SERVER_PORT: 51075
client1:
image: grpc-solution-client
build:
context: ./solution
dockerfile: client.dockerfile
environment:
MESSENGER_SERVER_ADDR: server:51075
MESSENGER_HTTP_PORT: 8080
ports:
- "${MESSENGER_CLIENT1_HOST_PORT:-8080}:8080"
client2:
image: grpc-solution-client
build:
context: ./solution
dockerfile: client.dockerfile
environment:
MESSENGER_SERVER_ADDR: server:51075
MESSENGER_HTTP_PORT: 8080
ports:
- "${MESSENGER_CLIENT2_HOST_PORT:-8081}:8080"
client-test-server:
image: "${MESSENGER_CLIENT_TEST_SERVER_IMAGE:-distsys.ru/course/grpc-messenger:latest}"
entrypoint:
- /usr/local/bin/client-test-server
environment:
MESSENGER_CLIENT_TEST_SERVER_EXPECTED_STREAMS: 2
MESSENGER_CLIENT_TEST_SERVER_PROTO: /submission/proto/messenger.proto
MESSENGER_SERVER_PORT: 51075
volumes:
- type: bind
source: "${MESSENGER_CLIENT_TEST_SERVER_PROTO_DIR:-./solution/proto}"
target: /submission/proto
read_only: true
user: "65532:65532"
read_only: true
cap_drop:
- ALL
security_opt:
- no-new-privileges:true
client-test1:
image: grpc-solution-client
build:
context: ./solution
dockerfile: client.dockerfile
environment:
MESSENGER_SERVER_ADDR: client-test-server:51075
MESSENGER_HTTP_PORT: 8080
depends_on:
- client-test-server
client-test2:
image: grpc-solution-client
build:
context: ./solution
dockerfile: client.dockerfile
environment:
MESSENGER_SERVER_ADDR: client-test-server:51075
MESSENGER_HTTP_PORT: 8080
depends_on:
- client-test-server
tests:
<<: *tests-image
environment:
MESSENGER_TEST_CLIENT1_ADDR: client-test1:8080
MESSENGER_TEST_CLIENT2_ADDR: client-test2:8080
MESSENGER_TEST_SERVER_ADDR: server-tests:51075
depends_on:
- server-tests
- client-test1
- client-test2
server-test-runner:
<<: *tests-image
command:
- --component
- server
environment:
MESSENGER_TEST_SERVER_ADDR: server-tests:51075
depends_on:
- server-tests
client-tests:
<<: *tests-image
command:
- --component
- client
environment:
MESSENGER_TEST_CLIENT1_ADDR: client-test1:8080
MESSENGER_TEST_CLIENT2_ADDR: client-test2:8080
depends_on:
- client-test1
- client-test2