build scripts

This commit is contained in:
Valentyn Faychuk 2024-12-22 17:43:20 +02:00
parent 331788fb6e
commit 1da6053acf
Signed by: valy
GPG Key ID: F1AB995E20FEADC5
5 changed files with 7 additions and 8 deletions

@ -17,6 +17,7 @@ COPY --from=build /opt/occlum/build/bin/occlum-run /opt/occlum/build/bin/occlum-
COPY --from=build /opt/occlum/build/bin/occlum /usr/bin/occlum COPY --from=build /opt/occlum/build/bin/occlum /usr/bin/occlum
COPY --from=build /sgx_libs /sgx_libs COPY --from=build /sgx_libs /sgx_libs
RUN cp /sgx_libs/* /usr/lib/x86_64-linux-gnu/ RUN cp /sgx_libs/* /usr/lib/x86_64-linux-gnu/
RUN tar -xzf /challenge.tar.gz && cp /challenge.sh /challenge/challenge.sh
WORKDIR / WORKDIR /challenge
ENTRYPOINT ["/challenge.sh"] ENTRYPOINT ["/challenge/challenge.sh"]

@ -2,8 +2,6 @@
# This script is the entrypoint of the challenge container # This script is the entrypoint of the challenge container
tar -xzf challenge.tar.gz && cd challenge
if [ -z "${INIT_NODES}" ]; then if [ -z "${INIT_NODES}" ]; then
echo "The INIT_NODES environment variable is not set." echo "The INIT_NODES environment variable is not set."
else else

@ -14,7 +14,7 @@ fi
cd docker cd docker
cp ../challenge_instance/challenge.tar.gz challenge.tar.gz cp ../challenge_instance/challenge.tar.gz challenge.tar.gz
docker build -f challenge.Dockerfile -t hacker-challenge:latest . docker build -f challenge.Dockerfile -t detee/hacker-challenge:latest .
cd .. cd ..
echo "Container named 'hacker-challenge' built" echo "Container named 'hacker-challenge' built"

@ -41,7 +41,7 @@ echo "Waiting for the network root to start"
docker run --device /dev/sgx/enclave \ docker run --device /dev/sgx/enclave \
--device /dev/sgx/provision \ --device /dev/sgx/provision \
--name "hacker-challenge" \ --name "hacker-challenge" \
-d hacker-challenge:latest -d detee/hacker-challenge:latest
while true; do while true; do
echo -n "." && sleep 1 echo -n "." && sleep 1
docker logs hacker-challenge | grep -q "SOL" && echo && break docker logs hacker-challenge | grep -q "SOL" && echo && break
@ -62,7 +62,7 @@ for p in {31311..31320}; do
--env INIT_NODES="172.17.0.2 172.17.0.3 172.17.0.4" \ --env INIT_NODES="172.17.0.2 172.17.0.3 172.17.0.4" \
-v "/tmp/hacker-challenge${p}:/challenge/main" \ -v "/tmp/hacker-challenge${p}:/challenge/main" \
--name "hacker-challenge${p}" -p "${p}:31372" \ --name "hacker-challenge${p}" -p "${p}:31372" \
-d hacker-challenge:latest -d detee/hacker-challenge:latest
done done
sleep 15 # Wait for the cluster to start sleep 15 # Wait for the cluster to start

@ -26,7 +26,7 @@ pub struct NodeInfo {
impl NodeInfo { impl NodeInfo {
pub fn is_newer_than(&self, older_self: &Self) -> bool { pub fn is_newer_than(&self, older_self: &Self) -> bool {
self > older_self self.keepalive > older_self.keepalive
} }
pub fn to_json(&self) -> String { pub fn to_json(&self) -> String {