-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Support for alpine-node? #866
Comments
|
@zbjornson I'm also interested in this. Is there any place that would ave a reference on how to build for alpine? |
@goliatone I don't think any part of the process will be specific to node-canvas, aside from what the dependencies actually are (as listed in the install wiki), so hopefully any tutorial about Alpine will be relevant. I don't know enough about Alpine to help much more, sorry. |
@goliatone You might try installing Hope this helps. |
I believe this should do it:
|
I was finally able to try this and the build is still failing due to an error while installing node-canvas, which is a dependency of a dependency. I have the generated npm-debug.log file if that would be helpful. The following is a copy paste from the error message I got:
|
@goliatone This is what we do, on top of
|
My FROM node:6.10-alpine
ENV NODE_DIR /var/www
WORKDIR $NODE_DIR
# .npm-deps https://github.com/Automattic/node-canvas/issues/866
RUN apk add --no-cache --virtual .health-check curl \
&& apk add --no-cache --virtual .build-deps git build-base g++ \
&& apk add --no-cache --virtual .npm-deps cairo-dev libjpeg-turbo-dev pango
# cache npm
COPY src/package.json /tmp/
RUN cd /tmp \
&& npm install \
&& apk del .build-deps
COPY src $NODE_DIR
RUN cp -a /tmp/node_modules $NODE_DIR/
HEALTHCHECK --interval=5s --timeout=3s \
CMD curl --silent --fail http://localhost:3000/ping || exit 1
CMD [ "node", "--harmony", "/var/www/app.js" ] |
Yes, same thing for me, it would not build on Alpine. |
@goliatone did you try the Dockerfile that @willfarrell posted? |
Installed on alpine
successfully, but fonts seems not to be found, getting squares instead of letters. Can anyone give me clue how to overcome this issue? PS: upgraded 1.4.0 -> 1.6.5 |
Whith canvas I have this problem (beause of color-thief used the canvas 1.4.0) with alpine:node-6 :
This is my install in the docker alpine :
The problem is : Alpine has only libpng16, not libpng12 :/ |
I managed to make it work with the following Dockerfile : FROM mhart/alpine-node:8.5.0
RUN apk add --no-cache \
build-base \
g++ \
cairo-dev \
jpeg-dev \
pango-dev \
bash \
imagemagick
# [...] |
Thanks @TooTallNate! Miss you much 😄 |
Node canvas does not work fine on alpine (or any other official node image). |
This was acting up for me again recently, and in addition to the packages listed in #866 (comment), adding either |
@michbil Same issue here. It works more or less, but the fonts are rendered as [] But works fine on OSX. Did you find a workaround in the end? |
I'm using CC @TooTallNate |
@jacktuck alpine is a bare-bones distro with basically no system fonts. You need to install fonts for them to show up. There's info on registering your own font files in the readme: https://github.com/Automattic/node-canvas#registerfont-for-bundled-fonts. You can also install system fonts with your package manager. |
@zbjornson I think ur onto something. I specified a bunch of fonts and it would appear to work now
|
Don't really care for any custom fonts just want the default system ones to kick in |
That's great, thanks! I had used |
@dmsnell Voting for re-open because this is still a problem! There should at least be a clear mention in the Installation section of the README, that states exactly what system dependencies this library needs during the installation. |
This is what I've run, I mostly assume that the
The Hope this helps people get a hold of buildtime and runtime deps and save a few polar bears named Greta. |
Error: Error loading shared library libcairo.so.2: No such file or directory. |
This is my Dockerfile, which seems to work (including fixed fonts):
|
Hi there, I'm writing this because I'm currently running into the exact same issue as described above. I am currently using a Dockerfile with node:alpine to build a NextJS website, and am experiencing this issue. FROM node:alpine AS deps
RUN apk add --no-cache libc6-compat
RUN apk add --update --no-cache \
build-base \
g++ \
cairo-dev \
jpeg-dev \
pango-dev \
giflib-dev
# and so on, and so forth This used to work for a while, up until very recently, where for some reason it has just completely stopped working. Is there any reason for this? |
@ColdDev just to mention, I recently got hit by this but decided that it's easier to just use |
@ceefour thanks for this pointer! Do you know why busterslim works, and what is the benefit of using alpine instead? |
Seems like something one can research on their own, but tl;dr: |
@SimenB thanks a lot for stepping in :D Very helpful |
@vongohren can be replaced with |
Thank you for that insight! Node docker world has exploded since I last had
to focus on this!
…On Sat, Jun 18, 2022, 14:45 Hendy Irawan ***@***.***> wrote:
@vongohren <https://github.com/vongohren> can be replaced with
node:lts-bullseye-slim for a more recent Debian at the time of this
writing, and should work as well.
—
Reply to this email directly, view it on GitHub
<#866 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAHXCV7KMLG3GZP3KEKGIX3VPXAGXANCNFSM4C4KOVZA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
In my case, I was trying to use the mhart's alpine-node image ... so I changed
to
and it's now working correctly. |
For those interested, some comments here helped me while setting up an alpine install. Let me share for future visitors: WORKDIR /the-thing
COPY package*.json ./
# see https://github.com/Automattic/node-canvas/issues/866
RUN apk add --no-cache --virtual .build-deps \
build-base \
g++ \
cairo-dev \
jpeg-dev \
pango-dev \
giflib-dev \
&& apk add --no-cache --virtual .runtime-deps \
cairo \
jpeg \
pango \
giflib \
&& npm ci
# later on our release stage, we cleanup .build-deps Thanks to everybody who share knowledge 🤟 |
PS: Maybe a wiki page could stop us spaming on this thread? 🤔 I may contribute one, if maintainers want |
For others' reference: i found that the only additional dependency that i needed to make text rendering work was |
I am trying to add to docker to no avail, the dockerfile file i am using is for next.js It is possible to add? |
|
For anyone who is facing error "build without SVG support", you need to install all to your NPM packages with |
@bharathnayak03 @lorenzogrv do you have any advice? I have tried your dockerfile but no luck. using node:18-alpine but still getting
|
I tried using 'node:16.18.1-alpine3.17', but I encountered issues with node-gyp not recognizing the Python installation. I switched to '16.18.1-buster-slim' and it resolved all my problems. Here's my installation: RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
libcairo2-dev \
libjpeg-dev \
libpango1.0-dev \
libgif-dev \
&& rm -rf /var/lib/apt/lists/* |
Hola I've successfully created a Docker setup for a project using Node.js with SvelteKit 2 and node-canvas. It's designed to ensuring all necessary dependencies for node-canvas are correctly installed. Here's the Dockerfile I've been working with:
This setup has worked well for me, and I hope it helps others looking for a similar solution |
@Sliffcak Sorry for the late reply. It seems you aren't installing the |
You must set python path for node-gyp
|
Feature?
I want to install canvas in docker container with image(node:6.9.4-alpine), is it support?
I can`t install canvas , because I had not install pkg-config. (how to install it in alpine)
Steps to Reproduce
Your Environment
The text was updated successfully, but these errors were encountered: