Skip to content

Commit

Permalink
build: Add a new gradle task to start the docker container in debug m…
Browse files Browse the repository at this point in the history
…ode. (#57)

Signed-off-by: Alfredo Gutierrez <[email protected]>
  • Loading branch information
AlfredoG87 authored Jul 30, 2024
1 parent dc3568a commit fda4418
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
13 changes: 13 additions & 0 deletions server/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,19 @@ tasks.register<Exec>("startDockerContainer") {
commandLine("sh", "-c", "docker-compose -p block-node up -d")
}

tasks.register<Exec>("startDockerDebugContainer") {
description = "Starts the docker container of the Block Node Server of the current version"
group = "docker"

workingDir(layout.projectDirectory.dir("docker"))

commandLine(
"sh",
"-c",
"./update-env.sh ${project.version} true && docker compose -p block-node up -d"
)
}

tasks.register<Exec>("stopDockerContainer") {
description = "Stops running docker containers of the Block Node Server"
group = "docker"
Expand Down
7 changes: 6 additions & 1 deletion server/docker/update-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# This script is called by gradle and get the current project version as an input param

if [ $# -lt 1 ]; then
echo "USAGE: $0 <VERSION>"
echo "USAGE: $0 <VERSION> <DEBUG>"
exit 1
fi

Expand All @@ -13,4 +13,9 @@ echo "REGISTRY_PREFIX=" >> .env
# Storage root path, this is temporary until we have a proper .properties file for all configs
echo "BLOCKNODE_STORAGE_ROOT_PATH=/app/storage" >> .env

if [ $# -eq 2 ]; then
echo "SERVER_OPTS='-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005'" >> .env
fi

echo "DEBUG $2"
echo "VERSION/TAG UPDATED TO $1"

0 comments on commit fda4418

Please sign in to comment.