#!/bin/bash


make -j 8

cd ./docker
cp ../light .

DOCKER_NETWORK="mallob-test"


docker build --no-cache -f common.dockerfile -t light:common .
docker build --no-cache -f leader.dockerfile -t light:leader .
docker build --no-cache -f worker.dockerfile -t light:worker .

docker stop worker1
docker stop worker2
docker stop worker3

docker run -d --name worker1 --network $DOCKER_NETWORK --entrypoint bash --rm -t light:worker -c "/competition/init_solver.sh; exec bash"
docker run -d --name worker2 --network $DOCKER_NETWORK --entrypoint bash --rm -t light:worker -c "/competition/init_solver.sh; exec bash"
docker run -d --name worker3 --network $DOCKER_NETWORK --entrypoint bash --rm -t light:worker -c "/competition/init_solver.sh; exec bash"

docker stop leader

docker run -i --name leader --network $DOCKER_NETWORK --entrypoint bash --rm -t light:leader -c "/competition/init_solver.sh; exec bash"