Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bryntum PDF Export Docker image doesn't work #10

Open
Aarbel opened this issue Apr 23, 2023 · 10 comments
Open

Bryntum PDF Export Docker image doesn't work #10

Aarbel opened this issue Apr 23, 2023 · 10 comments

Comments

@Aarbel
Copy link

Aarbel commented Apr 23, 2023

Impossible to use docker image of pdf-export server for dev test, even for production, do you need help to change it ? @bmblb

image

image

#0 7.621 Reading state information...
#0 7.680 E: Unable to locate package google-chrome-stable
------
failed to solve: executor failed running [/bin/sh -c apt-get update     && apt-get install -y wget gnupg ca-certificates     && wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -     && sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'     && apt-get update     && apt-get install -y google-chrome-stable fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst fonts-freefont-ttf --no-install-recommends     gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4     libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1     libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1     libnss3 lsb-release xdg-utils     && rm -rf /var/lib/apt/lists/*]: exit code: 100
@Aarbel Aarbel changed the title Docker image doesn't work Bryntum PDF Export Docker image doesn't work Apr 23, 2023
@Aarbel
Copy link
Author

Aarbel commented Apr 23, 2023

Putting FROM --platform=linux/amd64 node:16.15.0 in the Dockerfile looks to solve the E: Unable to locate package google-chrome-stable problem, cf https://dev.to/docker/unable-to-locate-package-google-chrome-stable-b62

In addition to that, to run well the container on Macbook Pro M1 with silicon ship, i had to follow this Docker doc: https://collabnix.com/warning-the-requested-images-platform-linux-amd64-does-not-match-the-detected-host-platform-linux-arm64-v8/

Inside Docker

  • Use Rosetta for x86/amd64 emulation on Apple Silicon (Settings > General)
  • Use Virtualization framework (Settings > Features in Develoment)

And run

docker build --platform linux/amd64 -t bryntum_pdfexport_server .
docker run --platform linux/amd64 bryntum_pdfexport_server

But i still have the hummus issue while running the container:
image

 | node:internal/modules/cjs/loader:1189
 |   return process.dlopen(module, path.toNamespacedPath(filename));
 |                  ^
 | 
 | Error: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.29' not found (required by /home/pptruser/node_modules/hummus/binding/hummus.node)
 |     at Object.Module._extensions..node (node:internal/modules/cjs/loader:1189:18)
 |     at Module.load (node:internal/modules/cjs/loader:981:32)
 |     at Function.Module._load (node:internal/modules/cjs/loader:822:12)
 |     at Module.require (node:internal/modules/cjs/loader:1005:19)
 |     at require (node:internal/modules/cjs/helpers:102:18)
 |     at Object.<anonymous> (/home/pptruser/node_modules/hummus/hummus.js:5:31)
 |     at Module._compile (node:internal/modules/cjs/loader:1105:14)
 |     at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
 |     at Module.load (node:internal/modules/cjs/loader:981:32)
 |     at Function.Module._load (node:internal/modules/cjs/loader:822:12) {
 |   code: 'ERR_DLOPEN_FAILED'
 | }
exited with code 1

@Aarbel
Copy link
Author

Aarbel commented Apr 23, 2023

I also don't understand what i should do reading this code block in the dockerfile

# If running Docker >= 1.13.0 use docker run's --init arg to reap zombie processes, otherwise
# uncomment the following lines to have `dumb-init` as PID 1
# ADD https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64 /usr/local/bin/dumb-init
# RUN chmod +x /usr/local/bin/dumb-init
# ENTRYPOINT ["dumb-init", "--"]

Is this Dockerfile basically made for docker version < 1.13 (we are now at version 4 of docker)

@Aarbel
Copy link
Author

Aarbel commented Apr 23, 2023

Also this one is not clear about "in which cases it should be useful"

Cf

# Uncomment to skip the chromium download when installing puppeteer. If you do,
# you'll need to launch puppeteer with:
#     browser.launch({executablePath: 'google-chrome-stable'})
# ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true

@bmblb
Copy link
Collaborator

bmblb commented Apr 23, 2023

Impossible to use docker image of pdf-export server for dev test, even for production

Not so long ago I successfully built this image and uploaded to dockerhub. In fact I did it for our M1 user and it works for him in production. I suggest to grab container from docker hub.

do you need help to change it ?

Feel free to prepare a PR, I'll take a look

@Aarbel
Copy link
Author

Aarbel commented Apr 23, 2023

@bmblb

i can't use the docker hub one as i have the error

image

Using default tag: latest
Error response from daemon: manifest for bryntum/pdf-export-server:latest not found: manifest unknown: manifest unknown

Are you sure you are using last version of Docker ?

I'm on 4.18.0 (104112)

@bmblb
Copy link
Collaborator

bmblb commented Apr 23, 2023

try bryntum/pdf-export-server:1.0.1

@Aarbel
Copy link
Author

Aarbel commented Apr 23, 2023

I solved this problem using ChatGPT:

 | node:internal/modules/cjs/loader:1189
 |   return process.dlopen(module, path.toNamespacedPath(filename));
 |                  ^
 | 
 | Error: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.29' not found (required by /home/pptruser/node_modules/hummus/binding/hummus.node)
 |     at Object.Module._extensions..node (node:internal/modules/cjs/loader:1189:18)
 |     at Module.load (node:internal/modules/cjs/loader:981:32)
 |     at Function.Module._load (node:internal/modules/cjs/loader:822:12)
 |     at Module.require (node:internal/modules/cjs/loader:1005:19)
 |     at require (node:internal/modules/cjs/helpers:102:18)
 |     at Object.<anonymous> (/home/pptruser/node_modules/hummus/hummus.js:5:31)
 |     at Module._compile (node:internal/modules/cjs/loader:1105:14)
 |     at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
 |     at Module.load (node:internal/modules/cjs/loader:981:32)
 |     at Function.Module._load (node:internal/modules/cjs/loader:822:12) {
 |   code: 'ERR_DLOPEN_FAILED'
 | }
exited with code 1

Magic result:

It seems like the issue is caused by a mismatch between the required glibc version and the one available in the Docker image. The error message indicates that the required version is GLIBC_2.29, but it's not found in your current image.

To fix this issue, you can try updating the base image to a newer version of Node that might include the required glibc version. Here's an updated version of your Dockerfile with a newer base image:

FROM --platform=linux/amd64 node:17

# Rest of the Dockerfile remains the same.

This worked for me but if that still doesn't work, you can try using a different base image with the required glibc version. In this case, you can use the ubuntu:20.04 image and install Node.js manually:

FROM --platform=linux/amd64 ubuntu:20.04

# Install Node.js
RUN apt-get update && \
    apt-get install -y curl && \
    curl -sL https://deb.nodesource.com/setup_16.x | bash - && \
    apt-get install -y nodejs

# Rest of the Dockerfile remains the same.

This should provide you with a more recent version of glibc that satisfies the required dependencies. Make sure to adjust the rest of the Dockerfile accordingly, as some commands or package names might be different between base images.

@Aarbel
Copy link
Author

Aarbel commented Apr 23, 2023

But i still hadthe error:

Http server started on port 8081
node:events:505
      throw er; // Unhandled 'error' event
      ^

Error: listen EADDRINUSE: address already in use :::8081

Which i solved removing other Docker runs (the lsofcommand wasn't working idk why)

@bmblb
Copy link
Collaborator

bmblb commented Apr 23, 2023

port forwarding issue can be resolved using docker compose config

@Aarbel
Copy link
Author

Aarbel commented Apr 24, 2023

Cf bryntum/support#4449

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants