Load fonts directly from assets directory, fix image buffer issues

This commit is contained in:
Essem 2022-09-22 23:44:54 -05:00
parent 273e5b94d7
commit 4f66519aa7
No known key found for this signature in database
GPG key ID: 7D497397CC3A2A8C
22 changed files with 188 additions and 111 deletions

View file

@ -12,15 +12,6 @@ RUN apk add --no-cache git cmake msttcorefonts-installer python3 alpine-sdk ffmp
RUN --mount=type=cache,id=pnpm-store,target=/root/.pnpm-store \
npm install -g pnpm@6.27.1
# gets latest version of twemoji
RUN mkdir /tmp/twemoji \
&& cd /tmp/twemoji \
&& package=$(wget --quiet -O - https://fedora.mirror.liteserver.nl/linux/development/rawhide/Everything/aarch64/os/Packages/t/ | grep -Po '(?<=href=")twitter-twemoji-fonts-[^"]*' | tail -1) \
&& wget https://fedora.mirror.liteserver.nl/linux/development/rawhide/Everything/aarch64/os/Packages/t/$package \
&& rpm2cpio $package | cpio -ivd \
&& cp ./usr/share/fonts/twemoji/Twemoji.ttf /usr/share/fonts/Twemoji.ttf \
&& rm -r /tmp/twemoji
# liblqr needs to be built manually for magick to work
# and because alpine doesn't have it in their repos
RUN git clone https://github.com/carlobaldassi/liblqr \
@ -53,17 +44,12 @@ RUN git clone https://github.com/ImageMagick/ImageMagick.git ImageMagick \
RUN update-ms-fonts && fc-cache -f
RUN adduser esmBot -s /bin/sh -D
USER esmBot
WORKDIR /home/esmBot/.internal
COPY ./assets/caption.otf /usr/share/fonts/caption.otf
COPY ./assets/caption2.ttf /usr/share/fonts/caption2.ttf
COPY ./assets/hbc.ttf /usr/share/fonts/hbc.ttf
COPY ./assets/reddit.ttf /usr/share/fonts/reddit.ttf
COPY ./assets/whisper.otf /usr/share/fonts/whisper.otf
RUN fc-cache -fv
COPY --chown=node:node ./package.json package.json
COPY --chown=node:node ./pnpm-lock.yaml pnpm-lock.yaml
COPY --chown=esmBot:esmBot ./package.json package.json
COPY --chown=esmBot:esmBot ./pnpm-lock.yaml pnpm-lock.yaml
RUN pnpm install
COPY . .
RUN rm .env
@ -81,6 +67,4 @@ RUN mkdir /home/esmBot/.internal/logs \
&& chown esmBot:esmBot /home/esmBot/.internal/logs \
&& chmod 777 /home/esmBot/.internal/logs
USER esmBot
ENTRYPOINT ["node", "app.js"]