build(docker): use tini for init

This commit is contained in:
Travis Shivers 2020-10-13 18:25:30 -05:00
parent 7ec6cb9000
commit 5136961f17
No known key found for this signature in database
GPG Key ID: EE4CC2891B8FCD33
2 changed files with 3 additions and 10 deletions

View File

@ -26,9 +26,11 @@ RUN npm prune --production
FROM node:14.13.1-alpine3.12 as production-stage FROM node:14.13.1-alpine3.12 as production-stage
RUN mkdir /app && chown -R node:node /app RUN mkdir /app && chown -R node:node /app
WORKDIR /app WORKDIR /app
RUN apk add --no-cache tini
COPY --chown=node:node server.js . COPY --chown=node:node server.js .
COPY --chown=node:node config config COPY --chown=node:node config config
COPY --chown=node:node --from=dependency-stage /app/node_modules node_modules COPY --chown=node:node --from=dependency-stage /app/node_modules node_modules
COPY --chown=node:node --from=build-stage /app/dist dist COPY --chown=node:node --from=build-stage /app/dist dist
ENTRYPOINT ["/app/server.js"] ENTRYPOINT ["/sbin/tini", "--"]
CMD ["/app/server.js"]

View File

@ -4,15 +4,6 @@ const syncloungeServer = require('syncloungeserver');
const path = require('path'); const path = require('path');
const config = require('./config'); const config = require('./config');
// Using a single function to handle multiple signals
const handle = (signal) => {
console.log(`Received ${signal}. Exiting`);
process.exit(0);
};
process.on('SIGINT', handle);
process.on('SIGTERM', handle);
const blockList = Object.keys(syncloungeServer.defaultConfig); const blockList = Object.keys(syncloungeServer.defaultConfig);
const appConfig = config.get(null, blockList); const appConfig = config.get(null, blockList);
console.log(appConfig); console.log(appConfig);