30 lines
731 B
Bash
Executable File
30 lines
731 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
mkdir -p bin
|
|
|
|
# add libssl-dev if needed
|
|
|
|
# apt-get update && apt-get install -y --no-install-recommends libssl-dev
|
|
|
|
# Adjust flags as you like
|
|
CXXFLAGS="-std=c++17 -O2 -Wall -Wextra -pedantic"
|
|
OPENSSL_LIBS="-lssl -lcrypto"
|
|
|
|
g++ ${CXXFLAGS} server.cpp helper.cpp -o bin/server ${OPENSSL_LIBS}
|
|
g++ ${CXXFLAGS} client.cpp helper.cpp -o bin/client ${OPENSSL_LIBS}
|
|
|
|
echo "Built:"
|
|
file bin/server bin/client || true
|
|
|
|
chmod a+x bin/server bin/client
|
|
|
|
# stop the containers and free up network resources
|
|
docker compose down --remove-orphans || true
|
|
docker network rm net-hw3 >/dev/null 2>&1 || true
|
|
|
|
# start the containers
|
|
docker compose up -d server
|
|
docker compose run --rm -it client
|
|
|
|
echo "Done." |