add docker files and remove static config.json

This commit is contained in:
mrjvs 2022-05-08 15:35:27 +02:00
parent cc8f890f08
commit 0606435ce0
5 changed files with 33 additions and 0 deletions

4
.dockerignore Normal file
View file

@ -0,0 +1,4 @@
node_modules
.git
config.json
certs

2
.gitignore vendored
View file

@ -1 +1,3 @@
.DS_Store
node_modules
certs

15
Dockerfile Normal file
View file

@ -0,0 +1,15 @@
FROM node:18-alpine
RUN apk add --no-cache python3 make gcc g++
WORKDIR /app
COPY "docker/entrypoint.sh" ./
COPY package*.json ./
RUN npm install
COPY . ./
VOLUME [ "/app/config.json", "/app/certs" ]
CMD ["sh", "entrypoint.sh"]

12
docker/entrypoint.sh Normal file
View file

@ -0,0 +1,12 @@
#!/bin/sh
files='config.json certs/access/private.pem certs/access/aes.key'
for file in $files; do
if [ ! -f $file ]; then
echo "$PWD/$file file does not exist. Please mount and try again."
exit 1
fi
done
exec node src/server.js