mirror of
https://gitea.smigz.com/smiggiddy/odin-codeprojects.git
synced 2025-04-05 03:10:57 -04:00
updates
This commit is contained in:
parent
1d28883841
commit
e07590d6e5
3 changed files with 18 additions and 4 deletions
|
@ -1,3 +1,2 @@
|
||||||
node_modules/
|
node_modules/
|
||||||
Dockerfile
|
Dockerfile
|
||||||
package-lock.json
|
|
||||||
|
|
|
@ -1,15 +1,17 @@
|
||||||
FROM node:23-alpine
|
FROM node:23-alpine
|
||||||
|
|
||||||
COPY package.json package-lock.json /app
|
COPY package*.json /app/package*.json
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
RUN npm install .
|
RUN npm install .
|
||||||
|
|
||||||
COPY --chown nobody:nobody ./src /app
|
COPY --chown=nobody:nobody ./src /app/src
|
||||||
|
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
|
|
||||||
|
USER nobody
|
||||||
|
|
||||||
CMD ["node", "src/app.js"]
|
CMD ["node", "src/app.js"]
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,19 @@ app.use(express.urlencoded({ extended: true }));
|
||||||
app.use("/", indexRouter);
|
app.use("/", indexRouter);
|
||||||
//app.use("/new", msgRouter);
|
//app.use("/new", msgRouter);
|
||||||
|
|
||||||
app.listen(port, () => {
|
const server = app.listen(port, () => {
|
||||||
console.log(`Webserver running on ${port}.`);
|
console.log(`Webserver running on ${port}.`);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Shutdown Logic
|
||||||
|
const gracefulShutdownHandler = (signal) => {
|
||||||
|
console.log(`Caught ${signal}, gracefully shutting down`);
|
||||||
|
|
||||||
|
server.close(() => {
|
||||||
|
console.log(`Shutting down server`);
|
||||||
|
process.exit();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
process.on("SIGINT", gracefulShutdownHandler);
|
||||||
|
process.on("SIGTERM", gracefulShutdownHandler);
|
||||||
|
|
Loading…
Add table
Reference in a new issue