49 lines
1.1 KiB
YAML
49 lines
1.1 KiB
YAML
services:
|
|
server:
|
|
image: gcc:13
|
|
working_dir: /app
|
|
volumes:
|
|
- ./:/app:rw
|
|
env_file:
|
|
- .env
|
|
networks:
|
|
net-hw1:
|
|
ipv4_address: ${SERVER_IP}
|
|
command: >
|
|
bash -lc "
|
|
set -euo pipefail;
|
|
g++ -std=c++17 -O2 -Wall -Wextra -pedantic /app/server.cpp -o /tmp/server;
|
|
echo '[server] IP='$(hostname -i)' SERVER_IP='${SERVER_IP}' SERVER_PORT='${APP_PORT};
|
|
exec /tmp/server
|
|
"
|
|
|
|
client:
|
|
image: gcc:13
|
|
working_dir: /app
|
|
volumes:
|
|
- ./:/app:rw
|
|
env_file:
|
|
- .env
|
|
networks:
|
|
net-hw1:
|
|
ipv4_address: ${CLIENT_IP}
|
|
depends_on:
|
|
- server
|
|
stdin_open: true
|
|
tty: true
|
|
command: >
|
|
bash -lc "
|
|
set -euo pipefail;
|
|
g++ -std=c++17 -O2 -Wall -Wextra -pedantic /app/client.cpp -o /tmp/client;
|
|
echo '[client] IP='$(hostname -i)' CLIENT_IP='${CLIENT_IP}' SERVER_IP='${SERVER_IP}' APP_PORT='${APP_PORT};
|
|
exec /tmp/client
|
|
"
|
|
|
|
networks:
|
|
net-hw1:
|
|
name: net-hw1
|
|
driver: bridge
|
|
ipam:
|
|
config:
|
|
- subnet: ${NET_SUBNET}
|