-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue #98 - Added optionality for debugging mode
- Loading branch information
Showing
4 changed files
with
65 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/bin/bash | ||
|
||
trap popd EXIT | ||
pushd $PWD &> /dev/null | ||
cd $(dirname "$0") | ||
cd .. | ||
|
||
# Check if Docker is installed and running | ||
dockerfail() { | ||
echo "Docker not found. Check that Docker is installed and running." | ||
exit 1 | ||
} | ||
docker ps &> /dev/null || dockerfail | ||
|
||
set -e # Exit on errors | ||
set -x # Print commands for debugging | ||
|
||
# Clean logs | ||
rm -r ./logs || true | ||
mkdir -p ./logs | ||
|
||
# Stop and remove the old container if it exists | ||
docker stop crawl_test || true | ||
docker rm crawl_test || true | ||
|
||
# Build the Docker image | ||
docker build --tag=crawl_test . &> build.log | ||
|
||
# Check if the user provided the 'debug' argument | ||
if [[ "$1" == "debug" ]]; then | ||
DEBUG_MODE="true" | ||
echo "Starting container with debugging enabled." | ||
else | ||
DEBUG_MODE="false" | ||
echo "Starting container without debugging." | ||
fi | ||
|
||
# Run the Docker container with the DEBUG_MODE environment variable | ||
docker run -d --name crawl_test --privileged \ | ||
-v /sys/fs/cgroup:/sys/fs/cgroup:ro \ | ||
-v "$(pwd)":/srv/analysis \ | ||
-p 5901:5901 \ | ||
-p 6901:6901 \ | ||
-p 8080:8080 \ | ||
-e DEBUG_MODE=$DEBUG_MODE \ | ||
--user 0 \ | ||
crawl_test || true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters