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

Docker file for V4 #527

Open
Pascal76 opened this issue May 20, 2024 · 4 comments
Open

Docker file for V4 #527

Pascal76 opened this issue May 20, 2024 · 4 comments

Comments

@Pascal76
Copy link

Hi

Could someone provide a working docker file for the V4 please ?

Thank you.

@ba1dr
Copy link

ba1dr commented May 29, 2024

Built for myself using the one below.
I add some fonts (for example google fonts) - put them into folder fonts.

from node:22

WORKDIR /usr/share/fonts/truetype
ADD fonts/* /usr/share/fonts/truetype/
# ADD src/fonts/OpenSans-Regular.ttf OpenSans-Regular.ttf
# ADD src/fonts/OpenSans-Light.ttf OpenSans-Light.ttf
# ADD src/fonts/OpenSans-Semibold.ttf OpenSans-Semibold.ttf
# ADD src/fonts/OpenSans-Bold.ttf OpenSans-Bold.ttf
# ADD src/fonts/OpenSans-ExtraBold.ttf OpenSans-ExtraBold.ttf
# ADD src/fonts/OpenSans-Italic.ttf OpenSans-Italic.ttf
# ADD src/fonts/OpenSans-LightItalic.ttf OpenSans-LightItalic.ttf
# ADD src/fonts/OpenSans-BoldItalic.ttf OpenSans-BoldItalic.ttf
# ADD src/fonts/OpenSans-SemiboldItalic.ttf OpenSans-SemiboldItalic.ttf
# ADD src/fonts/OpenSans-ExtraBoldItalic.ttf OpenSans-ExtraBoldItalic.ttf

USER root
WORKDIR /

RUN git clone https://github.com/highcharts/node-export-server.git && \
    chown -R node /node-export-server

WORKDIR /node-export-server

USER node 

ENV ACCEPT_HIGHCHARTS_LICENSE="YES" HIGHCHARTS_MOMENT="1"

RUN rm package-lock.json && \
    npm install -S  moment moment-timezone && \
    npm install

USER root
RUN npm link --unsafe-perm
RUN apt update && apt install -y 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 libnss3 lsb-release xdg-utils wget ca-certificates

USER node

WORKDIR /node-export-server

EXPOSE 7801
ENTRYPOINT ["highcharts-export-server", "--enableServer", "1", "--logLevel", "4", "--allowCodeExecution", "1"]

@Pascal76
Copy link
Author

It displays:

(node:7) [DEP0040] DeprecationWarning: The punycode module is deprecated. Please use a userland alternative instead.
(Use node --trace-deprecation ... to show where the warning was created)

Also the "height" on "chart" on the json file is ignored.
It uses the default value :(
I have to add the value as argument on the /usr/local/bin/highcharts-export-server command line.

And the png creation takes 0:02.69 vs 0:00.63 on the old version without pupetter (maybe due the the display of the warning)
(I don't use highcharts as a server)

@baroso
Copy link

baroso commented Jun 13, 2024

@ba1dr, maybe this will help you: #488 (comment)

@baroso
Copy link

baroso commented Jun 17, 2024

FYI, I also made this d029d00 addition, because of this error ...

Mon Jun 17 2024 09:17:00 GMT+0000 [warning] - [chart] Unable to load the default resources.json file. 
 Error: ENOENT: no such file or directory, open 'resources.json'
    at readFileSync (node:fs:448:20)
    at doExport (file:///node-export-server/lib/chart.js:318:27)
    at doStraightInject (file:///node-export-server/lib/chart.js:488:12)
    at startExport (file:///node-export-server/lib/chart.js:102:16)
    at exportHandler (file:///node-export-server/lib/server/routes/export.js:212:11)
    at Layer.handle [as handle_request] (/node-export-server/node_modules/express/lib/router/layer.js:95:5)
    at next (/node-export-server/node_modules/express/lib/router/route.js:149:13)
    at Route.dispatch (/node-export-server/node_modules/express/lib/router/route.js:119:3)
    at Layer.handle [as handle_request] (/node-export-server/node_modules/express/lib/router/layer.js:95:5)
    at /node-export-server/node_modules/express/lib/router/index.js:284:15

... according to --allowFileResources: Controls the ability to inject resources from the filesystem. This setting has no effect when running as a server (defaults to false). mentioned here https://github.com/highcharts/node-export-server/blob/master/README.md#command-line-arguments, the file resources.json should only be checked for when running as a Server (which I didn't check for in my change) and allowFileResources=true.

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

No branches or pull requests

4 participants