Docker script updates

This commit is contained in:
mrfry 2021-08-11 09:25:18 +02:00
parent 2eb6bb9a49
commit e561cc871b
3 changed files with 31 additions and 6 deletions

View file

@ -1,8 +1,28 @@
#!/bin/bash
repoName='qminer/mrfrys-node-server'
function getContainerId() {
docker ps -a | grep -i "${repoName}" | xargs | cut -d' ' -f1
}
function getDockerRepoId() {
docker images | grep "${repoName}" | xargs | cut -d' ' -f3
}
if [ "$1" == "build" ]; then
docker build . -t qminer/mrfrys-node-server
exit
elif [ "$1" == "rebuild" ]; then
docker rmi -f $(getDockerRepoId)
docker build . -t qminer/mrfrys-node-server
elif [ "$1" == "build" ]; then
docker build . -t qminer/mrfrys-node-server
elif [ "$1" == "stop" ]; then
docker stop $(getContainerId)
elif [ "$1" == "start" ]; then
# --entrypoint bash \
scripts/setup.sh
docker start -i $(getContainerId)
elif [ "$1" == "run" ]; then
# --entrypoint bash \
scripts/setup.sh
@ -13,7 +33,7 @@ elif [ "$1" == "run" ]; then
--mount src="$(pwd)/publicDirs",target=/server/publicDirs,type=bind \
qminer/mrfrys-node-server
elif [ "$1" == "bash" ]; then
docker exec -it "<container id>" /bin/bash
docker exec -it $(getContainerId) /bin/bash
else
echo 'params: "build" or "run"'
fi