node-export-server
node-export-server copied to clipboard
Docker file for V3
Hello,
Is it possible to provide a docker file for the new release please ? :)
Thanks for the question @Pascal76!
We are planning to create setup guides for different tools/environments, including Docker, soon (after all the bug issues on GitHub are solved). Thus, I'm leaving this issue as open.
In the meantime, I will try to guide you towards a file that works for you, here's a basic setup:
# choose your version of node
FROM node:latest
# set all the Export Server related environment variables
ENV ACCEPT_HIGHCHARTS_LICENSE=1
ENV HIGHCHARTS_VERSION=11.2.0
# get the export server
RUN npm install [email protected] -g
EXPOSE 8080
# ... continue as below
Let me know if that works for you or if you need anything else.
Thanks @jakubSzuminski I got this error:
`sh build.sh [+] Building 3.1s (9/11) docker:default => [internal] load .dockerignore 0.0s => => transferring context: 2B 0.0s => [internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 684B 0.0s => [internal] load metadata for docker.io/library/node:latest 0.6s => [internal] load build context 0.0s => => transferring context: 11.21kB 0.0s => [1/7] FROM docker.io/library/node:latest@sha256:84bb4077fd52933a935e7057ba9991e7cb18487b0ba444835dd44975aa94b7b2 0.0s => CACHED [2/7] ADD [fonts,/usr/share/fonts] 0.0s => [3/7] RUN apt-get -y update 1.1s => [4/7] RUN apt-get -y install git 0.5s => ERROR [5/7] RUN git clone https://github.com/highcharts/node-export-server/#stable 0.9s
[5/7] RUN git clone https://github.com/highcharts/node-export-server/#stable: 0.143 Cloning into '#stable'... 0.856 fatal: https://github.com/highcharts/node-export-server/#stable/info/refs not valid: is this a git repository?
Dockerfile:21
19 | RUN apt-get -y install git 20 | 21 | >>> RUN git clone https://github.com/highcharts/node-export-server/#stable 22 | RUN cd node-export-server && npm install 23 |
ERROR: failed to solve: process "/bin/sh -c git clone https://github.com/highcharts/node-export-server/#stable" did not complete successfully: exit code: 128 `
Here's a working dockerfile: Dockerfile.zip
(it's in a zip because GitHub doesn't like docker for some reason)
Great, thanks! This will be very helpful for us and other users.
FROM node:21
RUN npm install highcharts-export-server -g
RUN apt-get update &&
apt-get install -y wget &&
rm -rf /var/lib/apt/lists/*
RUN wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
RUN apt-get update &&
apt-get install -y
fonts-liberation
libasound2
libatk-bridge2.0-0
libatk1.0-0
libatspi2.0-0
libcups2
libdbus-1-3
libdrm2
libgbm1
libgtk-3-0
libnspr4
libnss3
libu2f-udev
libvulkan1
libxcomposite1
libxdamage1
libxfixes3
libxkbcommon0
libxrandr2
xdg-utils &&
rm -rf /var/lib/apt/lists/*
RUN apt-get install -y ./google-chrome-stable_current_amd64.deb &&
rm google-chrome-stable_current_amd64.deb
EXPOSE 7801
ENTRYPOINT ["highcharts-export-server", "--enableServer", "1", "--port", "7801", "--logLevel", "4"]
There are missing anti slash characters
There are missing anti slash characters
thanks for noting it i have updated
FROM node:21
ENV HIGHCHARTS_VERSION=11.4.0
RUN npm install highcharts-export-server -g
RUN apt-get update && apt-get install -y wget && rm -rf /var/lib/apt/lists/*
RUN wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
RUN apt-get update && apt-get install -y fonts-liberation libasound2 libatk-bridge2.0-0 libatk1.0-0 libatspi2.0-0 libcups2 libdbus-1-3 libdrm2 libgbm1 libgtk-3-0 libnspr4 libnss3 libu2f-udev libvulkan1 libxcomposite1 libxdamage1 libxfixes3 libxkbcommon0 libxrandr2 xdg-utils && rm -rf /var/lib/apt/lists/*
RUN apt-get install -y ./google-chrome-stable_current_amd64.deb && rm google-chrome-stable_current_amd64.deb
ENTRYPOINT ["highcharts-export-server", "--enableServer", "1"]
size: 2.6GB vs 356MB before V3 !
size: 2.6GB vs 356MB before V3 !
The Dockerfile I posted a few comments up is only 723MB and still works fine, just need to bump some version numbers.
Most of that size is chrome and it's deps, which is unavoidable.
wouldnt make it more sense to use the ghcr.io/puppeteer/puppeteer
as the FROM
? Afaik the puppeteer should be used with the same chrome version, for compatibility reasons, so it would make more sense to use the base image which contains both the chrome and the puppeteer already and they are compatible for sure.
see https://pptr.dev/guides/docker
That image requires SYS_ADMIN, which isn't possible in a lot of cloud providers and will fail any security audit.
I don't fully understand why that is reuquired by them (and why it is not just a suggestion). But if you look at the Dockerfile for that, it is quite similar to the above suggested ones. And acutally we were able to run an older version of the highcharts export server without the SYS_ADMIN
privilege in AWS eks. Here is what we did at that time:
FROM ghcr.io/puppeteer/puppeteer:20.9.0
USER pptruser
WORKDIR /home/pptruser
RUN npm i [email protected]
CMD node node_modules/highcharts-export-server/bin/cli.js --enableServer true
My docker file, around 900mb.
FROM node:lts-alpine
ENV NODE_ENV=production
ENV HIGHCHARTS_VERSION=11.4.0
ENV SERVER_ENABLE=true
ENV SERVER_SSL_ENABLE=true
RUN apk add --no-cache \
chromium \
nss \
freetype \
harfbuzz \
ca-certificates \
ttf-freefont \
nodejs \
yarn
ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser
RUN npm install highcharts-export-server -g
COPY . .
EXPOSE 3000
# RUN chown -R node /usr/src/app
# USER node
ENTRYPOINT ["highcharts-export-server", "--enableServer", "1"]
Any ideas why environment variables like SERVER_ENABLE, SERVER_PORT are not used by the export server? I have to pass them as parameters to ENTRYPOINT.
could you tell me the command line to install the master please ?
I tried several methods without success RUN npm install highcharts-export-server@master -g RUN npm install https://github.com/highcharts/node-export-server.git#master -save -g ...
@Pascal76 see https://stackoverflow.com/a/17509764.