-
Notifications
You must be signed in to change notification settings - Fork 1
/
run.sh
48 lines (41 loc) · 1.44 KB
/
run.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash
# Set the current directory
currentDir=$(pwd)
# Set the name, image and version for the Docker container
containerName=mercurySandbox
imageName=node
versionTag=18.18.2
relativePathToMercurySdk=../../paltalabs/mercury-sdk
# Display the command being executed
echo "Command: $1"
# Check if there is a previous Docker container with the same name
echo "Searching for a previous docker container"
containerID=$(docker ps --filter="name=${containerName}" --all --quiet)
if [[ ${containerID} ]]; then
echo "Start removing container."
# Remove the previous Docker container
docker rm --force ${containerName}
echo "Finished removing container."
else
echo "No previous container was found"
fi
# Run a new Docker container
docker run --volume ${currentDir}/:/workspace \
--volume ${currentDir}/${relativePathToMercurySdk}:/linked_sdk \
--name ${containerName} \
--interactive \
--publish 3000:3000 \
--workdir="/workspace" \
--env-file .env \
--tty \
--detach \
--publish-all \
--memory=12g \
--privileged \
--network soroban-network \
${imageName}:${versionTag}
# --net-alias ${containerName} \
# Set the git config
# docker exec $containerName git config --global --add safe.directory /workspace
# Connect to bash on Docker container
docker exec --tty --interactive $containerName bash