File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ # Variables
4+ CONTAINER_NAME=" spectator-build"
5+ IMAGE_NAME=" spectator-cpp-image"
6+ CONTAINER_FILE_PATH=" /home/ubuntu/spectator-cpp/cmake-build"
7+ HOST_FILE_PATH=" $PWD "
8+
9+ if [[ -z " $BUILD_TYPE " ]]; then
10+ BUILD_TYPE=" Debug"
11+ fi
12+
13+ # Build image if it does not exist
14+ if [[ -z " $( docker images -q $IMAGE_NAME 2> /dev/null) " ]]; then
15+ echo " Docker image $IMAGE_NAME not found. Building..."
16+ docker build -t $IMAGE_NAME -f Dockerfiles/Ubuntu.Dockerfile .
17+ fi
18+
19+ # # Remove any previous container
20+ docker rm $CONTAINER_NAME 2> /dev/null || true
21+
22+ # # Run the container and execute build.sh inside the virtual environment
23+ docker run --name $CONTAINER_NAME \
24+ --entrypoint bash $IMAGE_NAME -lc \
25+ " source /home/ubuntu/spectator-cpp/venv/bin/activate && set -x && BUILD_TYPE=$BUILD_TYPE bash /home/ubuntu/spectator-cpp/build.sh"
26+
27+ # # Copy the build output from the container to the host
28+ docker cp $CONTAINER_NAME :$CONTAINER_FILE_PATH $HOST_FILE_PATH
29+
30+ # # Remove the container after copying
31+ docker rm $CONTAINER_NAME
You can’t perform that action at this time.
0 commit comments