From c77f0f5e0b60c98b6f16bf517ab503457f8ba698 Mon Sep 17 00:00:00 2001
From: ping <dev@guillaumepin.ch>
Date: Wed, 12 Feb 2025 01:20:15 +0100
Subject: [PATCH] Update Dockerfile to download nexus-exam dependencies

---
 live_exam_os/Dockerfile                               |  7 +++----
 .../config/03-post_install/3000-nexus_exam.sh         | 11 +++++------
 2 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/live_exam_os/Dockerfile b/live_exam_os/Dockerfile
index f5e1cdc..10f8c84 100644
--- a/live_exam_os/Dockerfile
+++ b/live_exam_os/Dockerfile
@@ -11,13 +11,12 @@ RUN git clone https://github.com/limine-bootloader/limine.git --branch=v8.x-bina
     make && \
     cp /opt/limine/limine /bin/
 
+RUN git config --global --add safe.directory /data
+
 RUN wget https://go.dev/dl/$archive && tar -C /usr/local -xzf $archive
 
 WORKDIR /nexus
 
-RUN mkdir src
 COPY src src
-COPY Makefile .
-COPY ca-cert.pem .
 
-RUN make build_nexus-exam SERVER="127.0.0.1:1077" CERT="ca-cert.pem" EXAM_USER="user" EXAM_PWD="pwd"
+RUN cd src/client && go mod download
diff --git a/live_exam_os/config/03-post_install/3000-nexus_exam.sh b/live_exam_os/config/03-post_install/3000-nexus_exam.sh
index 0894fb9..dc6e31d 100755
--- a/live_exam_os/config/03-post_install/3000-nexus_exam.sh
+++ b/live_exam_os/config/03-post_install/3000-nexus_exam.sh
@@ -5,13 +5,12 @@
 echo " [Compiling nexus-exam...]"
 pushd ..  > /dev/null
 run_command make build_nexus-exam SERVER=$SERVER CERT=$CERT EXAM_USER=$EXAM_USER EXAM_PWD=$EXAM_PWD
-check_exit_code $? "Error during nexus-exam compilation"
 if [[ "$ROOTFS_DIR" != /* ]]; then
-  mkdir -p live_exam_os/$ROOTFS_DIR/usr/local/bin
-  cp build/nexus-exam live_exam_os/$ROOTFS_DIR/usr/local/bin/nexus-exam
+  run_command mkdir -p live_exam_os/$ROOTFS_DIR/usr/local/bin
+  run_command cp build/nexus-exam live_exam_os/$ROOTFS_DIR/usr/local/bin/nexus-exam
 else
-  mkdir -p $ROOTFS_DIR/usr/local/bin
-  cp build/nexus-exam $ROOTFS_DIR/usr/local/bin/nexus-exam
+  run_command mkdir -p $ROOTFS_DIR/usr/local/bin
+  run_command cp build/nexus-exam $ROOTFS_DIR/usr/local/bin/nexus-exam
 fi
-make clean_client
+run_command make clean_client
 popd  > /dev/null
-- 
GitLab