Skip to content

Commit

Permalink
Add relevant dockerfiles
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Braun committed Nov 22, 2023
1 parent 32c6eab commit c1eac34
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docker/client/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM rust:latest

WORKDIR /usr/src/client
COPY . .
RUN apt-get update && apt-get install -y protobuf-compiler netcat-traditional
ENTRYPOINT ["./docker/client/client.sh"]
28 changes: 28 additions & 0 deletions docker/client/client.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env bash
set -e
trap "exit" INT TERM
trap "kill 0" EXIT

echo "Server addr: $SERVER_IP:$SERVER_PORT"

cargo build --release --example zknode

# Retry loop
while ! nc -z -w 5 $SERVER_IP $SERVER_PORT; do
echo "Waiting for server $SERVER_IP:$SERVER_PORT ... "
sleep 0.5
done

PROCS=()
n=8
for i in {1..7}
do
RUST_LOG=debug cargo run --release --example zknode -- --n $n --king-ip $SERVER_IP:$SERVER_PORT --public-identity-der certs/$i/cert.der --client-only-king-public-identity-der certs/0/cert.der --watch-dir target/zk --name node$i --i $i --private-identity-der certs/$i/key.der &
pid=$!
PROCS[$i]=$pid
done

# Step 5: wait for all processes to finish
for pid in ${PROCS[@]}; do
wait $pid
done
7 changes: 7 additions & 0 deletions docker/server/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM rust:latest

WORKDIR /usr/src/server
COPY . .
RUN apt-get update && apt-get install -y protobuf-compiler
RUN sleep 15 # give time for the clients to get ahead in compiling
CMD RUST_LOG=debug cargo run --release --example zknode -- --n 8 --king-ip $BIND_ADDRESS --public-identity-der certs/0/cert.der --watch-dir target/zk --name king --i 0 --private-identity-der certs/0/key.der

0 comments on commit c1eac34

Please sign in to comment.