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

@ -34,8 +34,7 @@ makeNextSubmodule() {
ln -sf "$PWD/submodules/${1}/out" "$PWD/nextStatic/${2}" ln -sf "$PWD/submodules/${1}/out" "$PWD/nextStatic/${2}"
} }
log 'Making project' log "Making project"
log "Installing node modules for server"
npm install npm install
npm audit fix npm audit fix
npm run export npm run export
@ -75,13 +74,15 @@ setupJson publicDirs/qminingPublic/news.json
touch publicDirs/qminingPublic/version touch publicDirs/qminingPublic/version
touch publicDirs/qminingPublic/motd touch publicDirs/qminingPublic/motd
if [ -z "$(ls -A ./src/standaloneUtils)" ]; then if [ -z "$(ls -A ./data/dbs)" ]; then
pushd src/standaloneUtils pushd src/standaloneUtils
NS_LOGLEVEL=2 node dbSetup.js NS_LOGLEVEL=2 node dbSetup.js
mv *db ../../data/dbs mv *.db ../../data/dbs
popd popd
fi fi
npx --yes next telemetry disable
hr hr
echo "Done!" echo "Done!"
echo "npm start {loglevel}" echo "npm start {loglevel}"

View file

@ -1,8 +1,28 @@
#!/bin/bash #!/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 if [ "$1" == "build" ]; then
docker build . -t qminer/mrfrys-node-server 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 elif [ "$1" == "run" ]; then
# --entrypoint bash \ # --entrypoint bash \
scripts/setup.sh scripts/setup.sh
@ -13,7 +33,7 @@ elif [ "$1" == "run" ]; then
--mount src="$(pwd)/publicDirs",target=/server/publicDirs,type=bind \ --mount src="$(pwd)/publicDirs",target=/server/publicDirs,type=bind \
qminer/mrfrys-node-server qminer/mrfrys-node-server
elif [ "$1" == "bash" ]; then elif [ "$1" == "bash" ]; then
docker exec -it "<container id>" /bin/bash docker exec -it $(getContainerId) /bin/bash
else else
echo 'params: "build" or "run"' echo 'params: "build" or "run"'
fi fi

4
scripts/start.sh Executable file
View file

@ -0,0 +1,4 @@
#!/bin/bash
scripts/make.sh
npm run start