This commit is contained in:
2026-02-02 00:00:40 -06:00
parent 457f962434
commit 9f6fba4fc1
5 changed files with 143 additions and 0 deletions

48
docker-compose.yml Normal file
View File

@@ -0,0 +1,48 @@
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}