mu-semtech / mu-javascript-template

Template for running javascript/express microservices
4 stars 17 forks source link

locale support #24

Open nvdk opened 3 years ago

nvdk commented 3 years ago

Unfortunately the alpine base image does not support different locales and for some projects we do have a need of localizing date formats. Currently it seems using musl-locale seems the most straightforward way to support this.

I'm creating this issue so it's easier to find a solution for people running into the same thing + perhaps consider adding musl_locale to the base javascript template?

See also https://grrr.tech/posts/2020/add-locales-to-alpine-linux-docker-image/

For basic locale support, add the following to your docker file

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

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