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
|
||||
}
|
||||
|
||||
function setupJson() {
|
||||
if [ ! -f "$1" ]; then
|
||||
echo "Setting up ${1}"
|
||||
echo '{}' >"$1"
|
||||
fi
|
||||
}
|
||||
|
||||
makeNextSubmodule() {
|
||||
log "Making ${1}"
|
||||
pushd "submodules/${1}/"
|
||||
|
@ -29,6 +36,7 @@ makeNextSubmodule() {
|
|||
|
||||
checkFile "$PWD/src/server.ts"
|
||||
checkFile "$PWD/package.json"
|
||||
checkFile "$PWD/package-lock.json"
|
||||
|
||||
git pull
|
||||
git submodule update --init --recursive
|
||||
|
@ -63,20 +71,22 @@ mkdir -p data/dbs
|
|||
touch data/nolog
|
||||
|
||||
#JSONS
|
||||
echo '{}' >stats/stats
|
||||
echo '{}' >stats/vstats
|
||||
echo '{}' >stats/idstats
|
||||
echo '{}' >stats/idvstats
|
||||
echo '{}' >publicDirs/qminingPublic/userSpecificMotd.json
|
||||
echo '{}' >publicDirs/qminingPublic/news.json
|
||||
setupJson stats/stats
|
||||
setupJson stats/vstats
|
||||
setupJson stats/idstats
|
||||
setupJson stats/idvstats
|
||||
setupJson publicDirs/qminingPublic/userSpecificMotd.json
|
||||
setupJson publicDirs/qminingPublic/news.json
|
||||
|
||||
touch publicDirs/qminingPublic/version
|
||||
touch publicDirs/qminingPublic/motd
|
||||
|
||||
if [ -z "$(ls -A ./src/standaloneUtils)" ]; then
|
||||
pushd src/standaloneUtils
|
||||
NS_LOGLEVEL=2 node dbSetup.js
|
||||
mv *db ../../data/dbs
|
||||
popd
|
||||
fi
|
||||
|
||||
hr
|
||||
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