Skip to content

Commit

Permalink
Install Glibc for Chinese of multilingual & i18n support better
Browse files Browse the repository at this point in the history
  • Loading branch information
Kingwayer committed Jun 26, 2024
1 parent 7acd479 commit 319f6fa
Showing 1 changed file with 50 additions and 3 deletions.
53 changes: 50 additions & 3 deletions alpine/5/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@ ARG INVOICENINJA_VERSION
ARG REPOSITORY=invoiceninja/invoiceninja
ARG FILENAME=invoiceninja.tar

RUN set -eux; apk add curl unzip grep
# Optional for repo source changed, You can enable it if you are inside of China
#RUN echo -e 'https://mirrors.aliyun.com/alpine/v3.20/main/\nhttps://mirrors.aliyun.com/alpine/v3.20/community/' > /etc/apk/repositories \
# && apk update \
# && apk upgrade


RUN set -eux; apk add curl unzip grep nano wget tzdata ca-certificates

RUN DOWNLOAD_URL=$(curl -s "https://api.github.com/repos/invoiceninja/invoiceninja/releases/latest" | grep -o '"browser_download_url": "[^"]*invoiceninja.tar"' | cut -d '"' -f 4) && \
curl -LJO "$DOWNLOAD_URL" && \
Expand Down Expand Up @@ -46,8 +52,49 @@ RUN set -eux; \
mysql-client \
chromium \
ttf-freefont \
ttf-dejavu
font-noto-cjk \
ttf-dejavu \
bash \
&& apk add --no-cache --virtual .build-deps \
wget \
&& rm -rf /var/cache/apk/*

# Ensure Chinese fonts installed
RUN mkfontscale && mkfontdir && fc-cache -fv

# Ensure applied while restart
CMD ["/bin/sh"]


# Install necessary packages for localedef setup LANG
RUN set -eux; \
apk add build-base \
binutils \
build-base \
gcc \
musl-dev \
libc-dev \
gettext


# Install Glibc for Chinese of multilingual & i18n support better
RUN curl -L -o /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub
RUN curl -s 'https://api.github.com/repos/sgerrand/alpine-pkg-glibc/releases/latest' | grep 'browser_download_url' | sed -E 's/.*"([^"]+)".*/\1/' | xargs -n 1 curl -LO

RUN apk add --force-overwrite glibc-*.apk && \
rm glibc-*.apk

RUN export PATH=/usr/glibc-compat/bin:$PATH

RUN apk --no-cache add glibc-i18n && \
/usr/glibc-compat/bin/localedef -i en_US -f UTF-8 en_US.UTF-8 && \
echo "export LANG=en_US.UTF-8" > /etc/profile.d/locale.sh

# Enable below if need choice timezone to go.
#RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
#&& echo "Asia/Shanghai" > /etc/timezon


RUN install-php-extensions \
bcmath \
exif \
Expand Down Expand Up @@ -115,4 +162,4 @@ ENV LOG errorlog
ENV SNAPPDF_EXECUTABLE_PATH /usr/bin/chromium-browser

ENTRYPOINT ["docker-entrypoint"]
CMD ["supervisord"]
CMD ["supervisord"]

0 comments on commit 319f6fa

Please sign in to comment.