mrmBot-Matrix/Dockerfile.bot
elitwo 9febf3f9d2
Ensure npm has access to package.json. (#31)
This is a common issue, and I ran into it while installing esmBot. For me, and probably others npm throws a permissions error while building, and no packages will be installed. Simply chown the package.json to the node:node user, and this will work again.
2020-12-22 17:20:05 -06:00

56 lines
1.6 KiB
Docker

# Docker/Kubernetes file for running the bot
FROM node:alpine
RUN apk --no-cache upgrade
RUN apk add --no-cache git msttcorefonts-installer python3 alpine-sdk ffmpeg \
zlib-dev libpng-dev libjpeg-turbo-dev freetype-dev fontconfig-dev perl-dev \
ghostscript-dev libtool tiff-dev lcms2-dev libwebp-dev libxml2-dev libx11-dev \
libxext-dev chrpath libheif-dev pango-dev freetype fontconfig ghostscript \
ghostscript-fonts lcms2 graphviz
# install imagemagick from source rather than using the package
# since the alpine package does not include pango support.
RUN git clone https://github.com/ImageMagick/ImageMagick.git ImageMagick \
&& cd ImageMagick \
&& git checkout 7.0.10-45 \
&& ./configure \
--prefix=/usr \
--sysconfdir=/etc \
--mandir=/usr/share/man \
--infodir=/usr/share/info \
--enable-static \
--disable-openmp \
--with-threads \
--with-x \
--with-tiff \
--with-png \
--with-webp \
--with-gslib \
--with-gs-font-dir=/usr/share/fonts/Type1 \
--with-heic \
--with-modules \
--with-xml \
--with-perl \
--with-perl-options="PREFIX=/usr INSTALLDIRS=vendor" \
--with-pango \
&& make \
&& sudo make install
RUN update-ms-fonts && fc-cache -f
RUN adduser esmBot -s /bin/sh -D
WORKDIR /home/esmBot/.internal
COPY ./assets/caption.otf /home/esmBot/.font/caption.otf
COPY ./assets/caption2.ttf /home/esmBot/.font/caption2.ttf
COPY ./assets/hbc.ttf /home/esmBot/.font/hbc.ttf
RUN fc-cache -f
COPY --chown=node:node ./package.json package.json
COPY --chown=node:node ./package-lock.json package-lock.json
RUN npm install
COPY . .
USER esmBot
ENTRYPOINT ["node", "app.js"]