From b4d2b2043c6428b06b5c197467e32026366ca6c7 Mon Sep 17 00:00:00 2001 From: chandi Date: Tue, 4 Mar 2025 00:49:28 +0100 Subject: [PATCH] bbb-export-annotations: update to 3.0.0, drop privileges, reduce docker context --- docker-compose.tmpl.yml | 4 ++- mod/bbb-export-annotations/Dockerfile | 25 +++++++++---------- .../config/settings.json | 23 ++++++++--------- mod/bbb-export-annotations/entrypoint.sh | 6 ----- 4 files changed, 26 insertions(+), 32 deletions(-) delete mode 100755 mod/bbb-export-annotations/entrypoint.sh diff --git a/docker-compose.tmpl.yml b/docker-compose.tmpl.yml index 27bef7b..e79e905 100644 --- a/docker-compose.tmpl.yml +++ b/docker-compose.tmpl.yml @@ -177,7 +177,7 @@ services: build: context: mod/bbb-export-annotations additional_contexts: - bigbluebutton: ./repos/bigbluebutton + src: ./repos/bigbluebutton/bbb-export-annotations image: alangecker/bbb-docker-bbb-export-annotations:{{ .Env.TAG_BBB }} restart: unless-stopped depends_on: @@ -193,6 +193,8 @@ services: ipv4_address: 10.7.7.19 volumes: - ./data/bigbluebutton:/var/bigbluebutton + tmpfs: + - /tmp redis: image: redis:7.2-alpine diff --git a/mod/bbb-export-annotations/Dockerfile b/mod/bbb-export-annotations/Dockerfile index 0723860..d6c591f 100644 --- a/mod/bbb-export-annotations/Dockerfile +++ b/mod/bbb-export-annotations/Dockerfile @@ -1,24 +1,23 @@ -FROM node:18-bullseye-slim AS builder +FROM node:22-bookworm-slim AS builder -COPY --from=bigbluebutton /bbb-export-annotations /bbb-export-annotations +COPY --from=src / /bbb-export-annotations RUN cd /bbb-export-annotations && npm ci && npm install # -------------------- -FROM node:18-bullseye-slim +FROM node:22-bookworm-slim + +RUN groupadd -g 998 bigbluebutton \ + && useradd -m -u 998 -g bigbluebutton bigbluebutton -#depends on; -#Depends: nodejs,npm,bbb-apps-akka,bbb-web,cairosvg,ghostscript,imagemagick, nodejs (>= 18), nodejs (<< 20) -#see repo https://ubuntu.bigbluebutton.org/focal-270/ bigbluebutton-focal main -#apt info bbb-export-annotations -#missing dependency: poppler-utils for pdftocairo bin -> covert background / original presentation to png RUN apt update && apt install -y \ nodejs npm cairosvg ghostscript imagemagick nodejs poppler-utils -# && useradd --uid 2004 --create-home --user-group bbb-export COPY --from=builder /bbb-export-annotations /bbb-export-annotations -#we need acces to volume bigbluebutton! -USER root COPY ./config/settings.json /bbb-export-annotations/config/settings.json -COPY entrypoint.sh /entrypoint.sh -ENTRYPOINT /entrypoint.sh + +USER bigbluebutton +WORKDIR /bbb-export-annotations +ENV NODE_ENV=production + +ENTRYPOINT npm start diff --git a/mod/bbb-export-annotations/config/settings.json b/mod/bbb-export-annotations/config/settings.json index 3283a8b..7fe69f4 100644 --- a/mod/bbb-export-annotations/config/settings.json +++ b/mod/bbb-export-annotations/config/settings.json @@ -4,23 +4,16 @@ "msgName": "PresAnnStatusMsg" }, "shared": { - "presDir": "/var/bigbluebutton", "presAnnDropboxDir": "/tmp/pres-ann-dropbox", "cairosvg": "/usr/bin/cairosvg", - "ghostscript": "/usr/bin/gs", - "imagemagick": "/usr/bin/convert", - "pdftocairo": "/usr/bin/pdftocairo" - }, - "collector": { - "pngWidthRasterizedSlides": 2560 + "ghostscript": "/usr/bin/gs" }, "process": { - "whiteboardTextEncoding": "utf-8", "maxImageWidth": 1440, "maxImageHeight": 1080, - "textScaleFactor": 2, "pointsPerInch": 72, - "pixelsPerInch": 96 + "pixelsPerInch": 96, + "cairoSVGUnsafeFlag": false }, "notifier": { "pod_id": "DEFAULT_PRESENTATION_POD", @@ -37,5 +30,11 @@ "queue": "exportJobs", "publish": "to-akka-apps-redis-channel" } - } -} + }, + "fonts": { + "draw": "/usr/local/share/fonts/CaveatBrush-Regular-2015-09-23.ttf", + "sans": "/usr/local/share/fonts/CrimsonPro[wght]-1.003.ttf", + "serif": "/usr/local/share/fonts/SourceSansPro-Regular-2.045.ttf", + "mono": "/usr/local/share/fonts/SourceCodePro-Regular-2.038.ttf" + } +} \ No newline at end of file diff --git a/mod/bbb-export-annotations/entrypoint.sh b/mod/bbb-export-annotations/entrypoint.sh deleted file mode 100755 index a637c84..0000000 --- a/mod/bbb-export-annotations/entrypoint.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh -set -e - -cd /bbb-export-annotations -export NODE_ENV=production -npm start