Merge pull request #35 from PretendoNetwork/docker

Docker
This commit is contained in:
Jonathan Barrow
2022-05-07 19:57:15 -04:00
committed by GitHub
8 changed files with 37 additions and 5 deletions

5
.dockerignore Normal file
View File

@@ -0,0 +1,5 @@
.git
config.json
logs
certs
cdn

15
Dockerfile Normal file
View File

@@ -0,0 +1,15 @@
FROM node:14-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" ]
CMD ["sh", "entrypoint.sh"]

12
docker/entrypoint.sh Normal file
View File

@@ -0,0 +1,12 @@
#!/bin/sh
files='config.json certs/nex/datastore/secret.key certs/nex/secret.key certs/nex/public.pem'
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

View File

@@ -3,7 +3,7 @@ const bcrypt = require('bcrypt');
const util = require('./util');
const { PNID } = require('./models/pnid');
const { Server } = require('./models/server');
const { mongoose: mongooseConfig } = require('./config.json');
const { mongoose: mongooseConfig } = require('../config.json');
const { uri, database, options } = mongooseConfig;
let connection;

View File

@@ -1,5 +1,5 @@
const nodemailer = require('nodemailer');
const config = require('./config');
const config = require('../config.json');
const transporter = nodemailer.createTransport(config.email);

View File

@@ -6,7 +6,7 @@ const xmlparser = require('./middleware/xml-parser');
const database = require('./database');
const util = require('./util');
const logger = require('../logger');
const config = require('./config.json');
const config = require('../config.json');
const { http: { port } } = config;
const app = express();

View File

@@ -8,7 +8,7 @@ const { PNID } = require('../../../../models/pnid');
const { NEXAccount } = require('../../../../models/nex-account');
const database = require('../../../../database');
const util = require('../../../../util');
const config = require('../../../../config');
const config = require('../../../../../config');
const PNID_VALID_CHARACTERS_REGEX = /^[\w\-\.]*$/gm;
const PNID_PUNCTUATION_START_REGEX = /^[\_\-\.]/gm;

View File

@@ -2,7 +2,7 @@ const crypto = require('crypto');
const NodeRSA = require('node-rsa');
const fs = require('fs-extra');
const aws = require('aws-sdk');
const config = require('./config.json');
const config = require('../config.json');
const spacesEndpoint = new aws.Endpoint('nyc3.digitaloceanspaces.com');
const s3 = new aws.S3({