Skip to content

Docker file for V3 #451

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

Open
Pascal76 opened this issue Nov 26, 2023 · 15 comments
Open

Docker file for V3 #451

Pascal76 opened this issue Nov 26, 2023 · 15 comments

Comments

@Pascal76
Copy link

Hello,

Is it possible to provide a docker file for the new release please ? :)

@jszuminski
Copy link
Contributor

jszuminski commented Nov 27, 2023

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.

@Pascal76
Copy link
Author

Pascal76 commented Nov 27, 2023

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
`

@davidseverwright
Copy link

Here's a working dockerfile:
Dockerfile.zip

(it's in a zip because GitHub doesn't like docker for some reason)

@jszuminski
Copy link
Contributor

Great, thanks! This will be very helpful for us and other users.

@ArvinthKP
Copy link

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"]

@Pascal76
Copy link
Author

Pascal76 commented Mar 5, 2024

There are missing anti slash characters

@ArvinthKP
Copy link

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"]

@Pascal76
Copy link
Author

Pascal76 commented Mar 9, 2024

size: 2.6GB vs 356MB before V3 !

@davidseverwright
Copy link

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.

@tibberg
Copy link

tibberg commented Mar 19, 2024

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

@davidseverwright
Copy link

That image requires SYS_ADMIN, which isn't possible in a lot of cloud providers and will fail any security audit.

@tibberg
Copy link

tibberg commented Mar 19, 2024

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

@hubaksis
Copy link

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.

@Pascal76
Copy link
Author

Pascal76 commented Mar 20, 2024

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
...

@DanielRuf
Copy link

@Pascal76 see https://stackoverflow.com/a/17509764.

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

7 participants