JSreport on Alpine Docker image missing symbols
-
We are trying to package JSreport in a Docker for running on Kubernetes.
Our server.js reads a config file where we use environment variables. We get the docker to compile and run. The studio comes up.
However, we have some issues with chrome and puppeteer on Alpine when rendering reports. So far we included the following chromium dependenciesRUN apk update &&
wget https://pkgs.alpinelinux.org/package/edge/main/x86/libbsd && apk add --no-cache libbsd && _
apk add --no-cache gcompat nss cairo pango at-spi2-core-doc at-spi2-atk nspr atk cups-dev libdrm libxkbcommon libxcomposite libxdamage libxfixes libxrandr mesa-gbm alsa-lib &&
apk upgradeThe running container ldd chrome | grep not gives us these missing symbols:
Error relocating chrome: __vsnprintf_chk: symbol not found
Error relocating chrome: __vfprintf_chk: symbol not found
Error relocating chrome: __memcpy_chk: symbol not found
Error relocating chrome: __res_nclose: symbol not found
Error relocating chrome: __res_ninit: symbol not found
Error relocating chrome: __memset_chk: symbol not found
Error relocating chrome: __fprintf_chk: symbol not found
Error relocating chrome: __snprintf_chk: symbol not found
Error relocating chrome: __longjmp_chk: symbol not found
Error relocating chrome: __mbrlen: symbol not found
Error relocating chrome: strtoll_l: symbol not found
Error relocating chrome: strtoull_l: symbol not found
Error relocating chrome: gnu_get_libc_version: symbol not found
Error relocating chrome: __fdelt_chk: symbol not found
Error relocating chrome: backtrace: symbol not found
Error relocating chrome: __strncat_chk: symbol not found
Error relocating chrome: __sched_cpualloc: symbol not found
Error relocating chrome: __sched_cpufree: symbol not found
Error relocating chrome: __close: symbol not found
Error relocating chrome: initstate_r: symbol not found
Error relocating chrome: random_r: symbol not found
Error relocating chrome: __memmove_chk: symbol not found
Error relocating chrome: __register_atfork: symbol not found
Error relocating chrome: __longjmp_chk: symbol not found
Error relocating chrome: __libc_stack_end: symbol not foundWhich additional Alpine packages do we need to include in our Dockerfile to ensure jsreport works correctly on Alpine?
-
Any reason why not to use our official image as a base? This would make sure you get always the right deps. Here is docummentation
https://jsreport.net/learn/dockerIf you really need to build the image from the scratch, you can get inspiration in our Dockerfile
https://github.com/jsreport/jsreport/blob/master/packages/jsreport/docker/default/Dockerfile
-
Our business case is that we would like to run multiple jsreport images each with their own MS Azure Storage Account. So for each instance we have an account/key pair.
What would be the correct environment variables we need to use to connect to the storage account where the templates are persisted?
-
here is described how to translate configuration objects into environment variables
https://jsreport.net/learn/configuration#environment-variablesIf you plan to store templates into the azure blob storage, then you want to look here
https://jsreport.net/learn/fs-store#azure-storage
-
This is what we end of doing:
jsreport.config.json
{ "store": { "provider": "fs" }, "mountOnAppPath": true, "trustUserCode": true, "extensions": { "fs-store": { "persistence": { "provider": "azure-storage" } }, "fs-store-azure-storage-persistence": { "accountName": "x", "accountKey": "xx" } } }
This is the Dockerfile to create [name].azurecr.io/my-jsreport-image:1.1
FROM jsreport/jsreport:3.9.0 COPY --chown=jsreport:jsreport jsreport.config.json /app #add here the license key COPY --chown=jsreport:jsreport license-key.txt /app RUN npm install @jsreport/jsreport-fs-store-azure-storage-persistence
The deployment to Kubernetes was this
apiVersion: apps/v1 kind: Deployment metadata: name: jsreport labels: app: jsreport spec: replicas: 1 selector: matchLabels: app: jsreport template: metadata: labels: app: jsreport spec: serviceAccountName: jsreport containers: - name: jsreport image: [name].azurecr.io/my-jsreport-image:1.1 ports: - containerPort: 5488 resources: requests: memory: 512Mi cpu: "250m" limits: memory: 3Gi cpu: "2" env: - name: extensions_fsStoreAzureStoragePersistence_accountName value: [account name] - name: extensions_fsStoreAzureStoragePersistence_accountKey value: [account key]