mirror of
https://gitlab.com/MrFry/mrfrys-node-server
synced 2025-04-01 20:24:18 +02:00
Added docker stuff
This commit is contained in:
parent
cc19b5424b
commit
6ea1ec3958
4 changed files with 60 additions and 10 deletions
7
.dockerignore
Normal file
7
.dockerignore
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
node_modules
|
||||||
|
npm-debug.log
|
||||||
|
dist
|
||||||
|
stats
|
||||||
|
data
|
||||||
|
publicDirs
|
||||||
|
devel
|
15
Dockerfile
Normal file
15
Dockerfile
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
FROM node:16
|
||||||
|
|
||||||
|
WORKDIR /server
|
||||||
|
COPY package.json ./
|
||||||
|
COPY package-lock.json ./
|
||||||
|
|
||||||
|
RUN npm i
|
||||||
|
COPY . .
|
||||||
|
RUN npm run export
|
||||||
|
|
||||||
|
CMD [ "bash", "scripts/make.sh" ]
|
||||||
|
CMD [ "npm", "run", "start" ]
|
||||||
|
|
||||||
|
EXPOSE 80
|
||||||
|
EXPOSE 8080
|
|
@ -17,6 +17,13 @@ checkFile() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setupJson() {
|
||||||
|
if [ ! -f "$1" ]; then
|
||||||
|
echo "Setting up ${1}"
|
||||||
|
echo '{}' >"$1"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
makeNextSubmodule() {
|
makeNextSubmodule() {
|
||||||
log "Making ${1}"
|
log "Making ${1}"
|
||||||
pushd "submodules/${1}/"
|
pushd "submodules/${1}/"
|
||||||
|
@ -29,6 +36,7 @@ makeNextSubmodule() {
|
||||||
|
|
||||||
checkFile "$PWD/src/server.ts"
|
checkFile "$PWD/src/server.ts"
|
||||||
checkFile "$PWD/package.json"
|
checkFile "$PWD/package.json"
|
||||||
|
checkFile "$PWD/package-lock.json"
|
||||||
|
|
||||||
git pull
|
git pull
|
||||||
git submodule update --init --recursive
|
git submodule update --init --recursive
|
||||||
|
@ -63,20 +71,22 @@ mkdir -p data/dbs
|
||||||
touch data/nolog
|
touch data/nolog
|
||||||
|
|
||||||
#JSONS
|
#JSONS
|
||||||
echo '{}' >stats/stats
|
setupJson stats/stats
|
||||||
echo '{}' >stats/vstats
|
setupJson stats/vstats
|
||||||
echo '{}' >stats/idstats
|
setupJson stats/idstats
|
||||||
echo '{}' >stats/idvstats
|
setupJson stats/idvstats
|
||||||
echo '{}' >publicDirs/qminingPublic/userSpecificMotd.json
|
setupJson publicDirs/qminingPublic/userSpecificMotd.json
|
||||||
echo '{}' >publicDirs/qminingPublic/news.json
|
setupJson publicDirs/qminingPublic/news.json
|
||||||
|
|
||||||
touch publicDirs/qminingPublic/version
|
touch publicDirs/qminingPublic/version
|
||||||
touch publicDirs/qminingPublic/motd
|
touch publicDirs/qminingPublic/motd
|
||||||
|
|
||||||
pushd src/standaloneUtils
|
if [ -z "$(ls -A ./src/standaloneUtils)" ]; then
|
||||||
NS_LOGLEVEL=2 node dbSetup.js
|
pushd src/standaloneUtils
|
||||||
mv *db ../../data/dbs
|
NS_LOGLEVEL=2 node dbSetup.js
|
||||||
popd
|
mv *db ../../data/dbs
|
||||||
|
popd
|
||||||
|
fi
|
||||||
|
|
||||||
hr
|
hr
|
||||||
echo "Done!"
|
echo "Done!"
|
||||||
|
|
18
scripts/runDocker.sh
Executable file
18
scripts/runDocker.sh
Executable file
|
@ -0,0 +1,18 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
if [ "$1" == "build" ]; then
|
||||||
|
docker build . -t qminer/mrfrys-node-server
|
||||||
|
exit
|
||||||
|
elif [ "$1" == "run" ]; then
|
||||||
|
# --entrypoint bash \
|
||||||
|
docker run -it \
|
||||||
|
-p 8080:80 \
|
||||||
|
--mount src="$(pwd)/stats",target=/server/stats,type=bind \
|
||||||
|
--mount src="$(pwd)/data",target=/server/data,type=bind \
|
||||||
|
--mount src="$(pwd)/publicDirs",target=/server/publicDirs,type=bind \
|
||||||
|
qminer/mrfrys-node-server
|
||||||
|
elif [ "$1" == "bash" ]; then
|
||||||
|
docker exec -it "<container id>" /bin/bash
|
||||||
|
else
|
||||||
|
echo 'params: "build" or "run"'
|
||||||
|
fi
|
Loading…
Add table
Add a link
Reference in a new issue