dockerize backend server
This commit is contained in:
parent
373d560881
commit
7682ee3628
4 changed files with 54 additions and 0 deletions
14
docker/Dockerfile
Normal file
14
docker/Dockerfile
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
FROM nikolaik/python-nodejs:python3.9-nodejs15
|
||||||
|
|
||||||
|
RUN wget -qO- https://github.com/strukturag/pdfdraw/archive/v0.1.2.tar.gz | tar -C /tmp -xvz --strip 1
|
||||||
|
RUN cp -r /tmp/server /app
|
||||||
|
ADD config.js.docker /app/config.js
|
||||||
|
|
||||||
|
RUN apt-get update || : && apt-get install pdftk python-pypdf2 -y
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
RUN pip install svglib
|
||||||
|
RUN npm install
|
||||||
|
|
||||||
|
CMD ["node", "server.js"]
|
||||||
8
docker/README.md
Normal file
8
docker/README.md
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
# run pdfdraw backend in a docker container using docker-compose.
|
||||||
|
|
||||||
|
all settings are exposed into enviroment variables. That means you are able to config the backend server in [docker-compose.yml](docker-compose.yml) yaml file by edting the corresponding enviroment variables.
|
||||||
|
|
||||||
|
Than run docker compose.
|
||||||
|
|
||||||
|
docker-compose up -d
|
||||||
|
|
||||||
24
docker/config.js.docker
Normal file
24
docker/config.js.docker
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
var config = {};
|
||||||
|
|
||||||
|
// The port the service should run on.
|
||||||
|
config.port = process.env.port || 8080;
|
||||||
|
|
||||||
|
// The shared secret for token validation. Must be the same value
|
||||||
|
// as configured in the Nextcloud admin interface.
|
||||||
|
config.secret = process.env.secret || 'the-shared-secret';
|
||||||
|
|
||||||
|
// INSECURE! Allow any self-signed / expired certificates.
|
||||||
|
// Only use this during development!
|
||||||
|
config.allow_invalid_certificates = process.env.allow_invalid_certificates || false;
|
||||||
|
|
||||||
|
// Required for newer versions of node / libssl.
|
||||||
|
// See https://github.com/nodejs/node/issues/21513#issuecomment-399790415
|
||||||
|
config.use_auto_ecdh_curve = process.env.use_auto_ecdh_curve || false;
|
||||||
|
|
||||||
|
// Command to use when running pdftk. Defaults to 'pdftk' if not configured.
|
||||||
|
config.cmd_pdftk = process.env.cmd_pdftk || '';
|
||||||
|
|
||||||
|
// Command to use when running svg2pdf. Defaults to 'svg2pdf' if not configured.
|
||||||
|
config.cmd_svg2pdf = process.env.cmd_svg2pdf || '';
|
||||||
|
|
||||||
|
module.exports = config;
|
||||||
8
docker/docker-compose.yml
Executable file
8
docker/docker-compose.yml
Executable file
|
|
@ -0,0 +1,8 @@
|
||||||
|
version: '2'
|
||||||
|
services:
|
||||||
|
pdfdraw-server:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
environment:
|
||||||
|
port: 8080
|
||||||
|
secret: 'the-shared-secret'
|
||||||
Loading…
Reference in a new issue