Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# Based on https://developers.google.com/web/tools/puppeteer/troubleshooting#running_puppeteer_in_docker

FROM node:16.15.0
FROM --platform=linux/amd64 node:17

RUN apt-get update \
&& apt-get install -y wget gnupg ca-certificates \
Expand Down Expand Up @@ -41,15 +39,18 @@ RUN groupadd -r pptruser && useradd -r -g pptruser -G audio,video pptruser \
# Run everything after as non-privileged user.
USER pptruser

COPY --chown=pptruser:pptruser ["src/", "/home/pptruser/src/"]
COPY --chown=pptruser:pptruser ["app.config.js", "package.json", "/home/pptruser/"]
COPY --chown=pptruser:pptruser . /home/pptruser/

WORKDIR /home/pptruser

RUN npm i
RUN npm install

EXPOSE 8080 8081

ENTRYPOINT [ "node", "./src/server.js", "-H", "8081" ]
# Uncomment this if you need to dev with the docker file and standard environnement
USER root
RUN npm install -g nodemon --unsafe-perm=true --allow-root
USER pptruser
ENTRYPOINT [ "nodemon", "./src/server.js", "-H", "8081" ]
# ENTRYPOINT [ "node", "./src/server.js", "-H", "8081" ]

CMD ["bash"]
5 changes: 5 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
version: "3"
services:
bryntum_pdfexport_server:
# Helpfull to precise that to help it run on Apple ships
platform: linux/amd64
build: .
image: bryntum_pdfexport_server
container_name: bryntum_pdfexport_server
ports:
- "8080:8080"
- "8081:8081"
volumes:
# Syncing local files with docker files to help update server files even when using docker
- ./src:/home/pptruser/src
14 changes: 14 additions & 0 deletions src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ const Commands = require('./commands.js');
const WebServer = require('./server/WebServer.js');
let { config } = require('../app.config.js');

console.info("👉 Starting ExportServer");

//Do a check if this is a Pkg executable or is executed from nodejs commandline
const isPkg = typeof process.pkg !== 'undefined';

Expand Down Expand Up @@ -66,3 +68,15 @@ else {
commands.showHelp();
process.exit();
}

process.on("SIGTERM", (error) => {
console.info("\nGracefully shutting down the server from SIGTERM:");
console.error(error);
process.exit();
});

process.on('uncaughtException', (error) => {
console.info("\nGracefully shutting down the server from uncaughtException");
console.error(error);
process.exit();
})