2021-04-12 14:02:19 +00:00
|
|
|
###############
|
|
|
|
# Solution #1 #
|
|
|
|
###############
|
|
|
|
# https://github.com/geekduck/docker-node-canvas
|
|
|
|
# Took 20m 55s
|
|
|
|
|
|
|
|
#FROM node:12
|
|
|
|
#
|
|
|
|
#RUN apt-get update \
|
|
|
|
# && apt-get install -qq build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev
|
|
|
|
#
|
|
|
|
#RUN mkdir -p /opt/node/js \
|
|
|
|
# && cd /opt/node \
|
|
|
|
# && npm i canvas
|
|
|
|
#
|
|
|
|
#WORKDIR /opt/node/js
|
|
|
|
#
|
|
|
|
#ENTRYPOINT ["node"]
|
|
|
|
|
|
|
|
###############
|
|
|
|
# Solution #2 #
|
|
|
|
###############
|
|
|
|
# https://github.com/Automattic/node-canvas/issues/729#issuecomment-352991456
|
|
|
|
# Took 22m 50s
|
|
|
|
|
|
|
|
#FROM ubuntu:xenial
|
|
|
|
#
|
|
|
|
#RUN apt-get update && apt-get install -y \
|
|
|
|
# curl \
|
|
|
|
# git
|
|
|
|
#
|
|
|
|
#RUN curl -sL https://deb.nodesource.com/setup_8.x | bash - \
|
|
|
|
# && curl -sL https://deb.nodesource.com/setup_8.x | bash - \
|
|
|
|
# && curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \
|
|
|
|
# && echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
|
|
|
|
#
|
|
|
|
#RUN apt-get update && apt-get install -y \
|
|
|
|
# nodejs \
|
|
|
|
# yarn \
|
|
|
|
# libcairo2-dev \
|
|
|
|
# libjpeg-dev \
|
|
|
|
# libpango1.0-dev \
|
|
|
|
# libgif-dev \
|
|
|
|
# libpng-dev \
|
|
|
|
# build-essential \
|
|
|
|
# g++
|
|
|
|
|
|
|
|
###############
|
|
|
|
# Solution #3 #
|
|
|
|
###############
|
|
|
|
# https://github.com/Automattic/node-canvas/issues/866#issuecomment-330001221
|
|
|
|
# Took 7m 29s
|
|
|
|
|
2021-05-21 19:42:15 +00:00
|
|
|
FROM node:current-alpine
|
|
|
|
FROM mhart/alpine-node:latest
|
2021-04-12 14:02:19 +00:00
|
|
|
|
|
|
|
RUN apk add --no-cache \
|
|
|
|
build-base \
|
|
|
|
g++ \
|
|
|
|
cairo-dev \
|
|
|
|
jpeg-dev \
|
|
|
|
pango-dev \
|
|
|
|
bash \
|
|
|
|
imagemagick
|
|
|
|
|
|
|
|
# The rest of the commands to execute
|
2020-08-31 19:15:41 +00:00
|
|
|
|
|
|
|
COPY . .
|
|
|
|
|
2020-08-31 19:18:44 +00:00
|
|
|
RUN npm i
|
|
|
|
|
2020-08-31 19:15:41 +00:00
|
|
|
RUN npm run build
|
|
|
|
|
2021-05-21 19:42:15 +00:00
|
|
|
CMD ["npm", "start"]
|