everyone! Maybe someone could help me solve problem with my NodeJS app in docker container. In simple words i have a web scraper with puppeteer and chrome, that gets needed info from website (in Russian language) and displays it to user. It works just fine in my Linux (Fedora) system and in Windows system too, but when i try to deploy it to node-latest or node-alpine images instead of russian letters i am getting this symbols: Íîâîñòè or Îáó÷àþùåå âèäåî or Ýëåêòðîííàÿ ìóçûêà

Here is my Dockefile:

FROM node:20-alpine

ENV MUSL_LOCALE_DEPS cmake make musl-dev gcc gettext-dev libintl
ENV MUSL_LOCPATH /usr/share/i18n/locales/musl

RUN apk add font-vollkorn font-misc-cyrillic font-mutt-misc font-screen-cyrillic font-winitzki-cyrillic font-cronyx-cyrillic

RUN apk add --no-cache \
    $MUSL_LOCALE_DEPS \
    && wget https://gitlab.com/rilian-la-te/musl-locales/-/archive/master/musl-locales-master.zip \
    && unzip musl-locales-master.zip \
      && cd musl-locales-master \
      && cmake -DLOCALE_PROFILE=OFF -D CMAKE_INSTALL_PREFIX:PATH=/usr . && make && make install \
      && cd .. && rm -r musl-locales-master

ENV LANG ru_RU.UTF-8
ENV LANGUAGE ru_RU.UTF-8
ENV LC_ALL ru_RU.UTF-8

RUN apk add --no-cache \
      chromium \
      nss \
      freetype \
      harfbuzz \
      ca-certificates \
      ttf-freefont 

ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser

WORKDIR /app
COPY . /app
RUN cd /app
RUN npm i
RUN npm i -g @nestjs/cli
CMD npm run start

As you can see, i tried to install cyrillic fonts and system LANG LANGUAGE and LC_ALL variables but all attempts failed, i still getting those symbols.

1

There are 1 best solutions below

0
Igor On

Well, not sure what the actual problem is, but i have managed to solve my problem with node:latest and chromium like this:

FROM node:latest

RUN apt-get update -y && apt-get upgrade -y
RUN apt-get -y install chromium
ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium

WORKDIR /app
COPY . /app
RUN cd /app
RUN yarn install --prod
RUN yarn add source-map-support
RUN yarn global add @nestjs/cli
CMD yarn run build && yarn run start