Add support for deploying from TS source
Signed-off-by: Fred Boniface <fred@fjla.uk>
This commit is contained in:
parent
b717917500
commit
159c46c4cc
15
Dockerfile
15
Dockerfile
@ -1,7 +1,16 @@
|
||||
FROM node:19
|
||||
FROM node:20 as builder
|
||||
EXPOSE 8460
|
||||
WORKDIR /usr/src/app
|
||||
COPY ./package*.json ./
|
||||
RUN npm ci --omit=dev
|
||||
RUN npm i
|
||||
COPY . .
|
||||
CMD [ "node", "app.js" ]
|
||||
RUN npm run build
|
||||
|
||||
FROM node:20-slim
|
||||
EXPOSE 8460
|
||||
WORKDIR /usr/src/app
|
||||
COPY ./mail-templates/* ./mail-templates/
|
||||
COPY ./package*.json ./
|
||||
RUN npm ci --omit=dev
|
||||
COPY --from=builder /usr/src/app/dist/ ./
|
||||
CMD [ "node" , "app.js" ]
|
||||
|
@ -18,7 +18,7 @@ const cors = require('cors');
|
||||
const authenticate= require('./src/middlewares/auth.middlewares');
|
||||
|
||||
// Internal Requires
|
||||
const log = require('./src/utils/log.utils');
|
||||
const log = require('./src/utils/logs.utils');
|
||||
const version = require('./src/configs/version.configs');
|
||||
const listRtr = require('./src/routes/list.routes');
|
||||
const ldbRtr = require('./src/routes/ldb.routes');
|
||||
@ -54,7 +54,7 @@ log.out(`app: Starting OwlBoard - Backend Version: ${version.app} - ` +
|
||||
`API versions: ${version.api}`, 'init');
|
||||
|
||||
// Express Error Handling:
|
||||
app.use((err: Error, req: Request, res, next) => {
|
||||
app.use((err, req, res, next) => {
|
||||
const statusCode = err.statuscode || 500;
|
||||
console.error(err.message, err.stack);
|
||||
res.status(statusCode).json({'message': err.message});
|
||||
@ -103,7 +103,7 @@ mode === 'development'
|
||||
: null;
|
||||
|
||||
// Start Express
|
||||
app.listen(srvPort, srvListen, (error: Error) =>{
|
||||
app.listen(srvPort, srvListen, (error) =>{
|
||||
if(!error) {
|
||||
log.out(`app.listen: Listening on http://${srvListen}:${srvPort}`, 'init');
|
||||
log.out('app.listen: State - alive', 'init');
|
@ -1,5 +1,5 @@
|
||||
const issue = require('../services/issue.services');
|
||||
const log = require('../utils/log.utils');
|
||||
const log = require('../utils/logs.utils');
|
||||
|
||||
async function post(req, res, next){
|
||||
try {
|
||||
|
@ -1,5 +1,5 @@
|
||||
const utils = require('../utils/auth.utils');
|
||||
const log = require('../utils/log.utils');
|
||||
const log = require('../utils/logs.utils');
|
||||
|
||||
module.exports = async function authCheck(req, res, next) {
|
||||
log.out('authMiddlewares: Checking authentication', 'dbug');
|
||||
|
@ -1,4 +1,4 @@
|
||||
const log = require('../utils/log.utils');
|
||||
const log = require('../utils/logs.utils');
|
||||
|
||||
module.exports = async function requireJson(req, res, next) {
|
||||
if (req.headers['content-type'] !== 'application/json') {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* global process */
|
||||
const log = require('../utils/log.utils'); // Log Helper
|
||||
const log = require('../utils/logs.utils'); // Log Helper
|
||||
|
||||
const dbUser = process.env.OWL_DB_USER || 'owl';
|
||||
const dbPass = process.env.OWL_DB_PASS || 'twittwoo';
|
||||
|
@ -1,6 +1,6 @@
|
||||
// Parse and return a find request
|
||||
|
||||
const log = require('../utils/log.utils'); // Log Helper
|
||||
const log = require('../utils/logs.utils'); // Log Helper
|
||||
const db = require('../services/dbAccess.services');
|
||||
const san = require('../utils/sanitizer.utils');
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* eslint-disable no-useless-escape */
|
||||
const axios = require('axios');
|
||||
const log = require('../utils/log.utils');
|
||||
const log = require('../utils/logs.utils');
|
||||
|
||||
const issueLabels = {
|
||||
bug: 120,
|
||||
|
@ -1,5 +1,5 @@
|
||||
const testing = require('../services/mail.services');
|
||||
const log = require('../utils/log.utils');
|
||||
const log = require('../utils/logs.utils');
|
||||
|
||||
async function getAlive(){
|
||||
log.out('kubeServices.getAlive: alive hook checked', 'info');
|
||||
|
@ -1,6 +1,6 @@
|
||||
// Parse and return an LDB Request
|
||||
|
||||
const log = require('../utils/log.utils'); // Log Helper
|
||||
const log = require('../utils/logs.utils'); // Log Helper
|
||||
const ldb = require('ldbs-json');
|
||||
const util = require('../utils/ldb.utils');
|
||||
const san = require('../utils/sanitizer.utils');
|
||||
|
@ -1,4 +1,4 @@
|
||||
const log = require('../utils/log.utils'); // Log Helper
|
||||
const log = require('../utils/logs.utils'); // Log Helper
|
||||
const db = require('../services/dbAccess.services');
|
||||
|
||||
async function getStations(){
|
||||
|
@ -1,4 +1,4 @@
|
||||
const log = require('../utils/log.utils');
|
||||
const log = require('../utils/logs.utils');
|
||||
const mail = require('nodemailer'); //>> Probs wrong
|
||||
|
||||
const fromAddr = process.env.OWL_EML_FROM;
|
||||
|
@ -1,7 +1,7 @@
|
||||
// Finds PIS Codes using DB Lookups
|
||||
|
||||
const db = require('../services/dbAccess.services');
|
||||
const log = require('../utils/log.utils');
|
||||
const log = require('../utils/logs.utils');
|
||||
const clean = require('../utils/sanitizer.utils');
|
||||
|
||||
const supported = [
|
||||
|
@ -1,4 +1,4 @@
|
||||
const log = require('../utils/log.utils');
|
||||
const log = require('../utils/logs.utils');
|
||||
const auth = require('../utils/auth.utils');
|
||||
const db = require('./dbAccess.services');
|
||||
const mail = require('./mail.services');
|
||||
|
@ -1,4 +1,4 @@
|
||||
const log = require('../utils/log.utils'); // Log Helper
|
||||
const log = require('../utils/logs.utils'); // Log Helper
|
||||
const db = require('../services/dbAccess.services');
|
||||
const os = require('os');
|
||||
const vers = require('../configs/version.configs');
|
||||
|
@ -1,4 +1,4 @@
|
||||
const log = require('../utils/log.utils');
|
||||
const log = require('../utils/logs.utils');
|
||||
const db = require('./dbAccess.services');
|
||||
const clean = require('../utils/sanitizer.utils');
|
||||
const pis = require('../services/pis.services');
|
||||
|
@ -1,5 +1,5 @@
|
||||
const logs = require('../utils/logs.utils');
|
||||
const crypt = require('crypt');
|
||||
const logs = require('../utils/logs.utils');
|
||||
const crypt = require('crypto');
|
||||
const db = require('../services/dbAccess.services');
|
||||
const fs = require('fs/promises');
|
||||
const minify = require('../utils/minify.utils');
|
||||
|
@ -1,4 +1,4 @@
|
||||
const log = require('../utils/log.utils'); // Log Helper
|
||||
const log = require('./logs.utils'); // Log Helper
|
||||
const db = require('../services/dbAccess.services'); // DB Access
|
||||
//const san = require('../utils/sanitizer.utils'); // Sanitiser
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user