|
|
FROM arm64v8/ubuntu:20.04
|
|
|
MAINTAINER chenjh "842761733@qq.com"
|
|
|
# 内置一些常用的中文字体,避免普遍性乱码
|
|
|
COPY fonts/* /usr/share/fonts/chinese/
|
|
|
RUN apt-get clean && apt-get update &&\
|
|
|
sed -i 's/http:\/\/archive.ubuntu.com/https:\/\/mirrors.aliyun.com/g' /etc/apt/sources.list &&\
|
|
|
sed -i 's/# deb/deb/g' /etc/apt/sources.list &&\
|
|
|
apt-get install -y --reinstall ca-certificates &&\
|
|
|
apt-get clean && apt-get update &&\
|
|
|
apt-get install -y locales language-pack-zh-hans &&\
|
|
|
localedef -i zh_CN -c -f UTF-8 -A /usr/share/locale/locale.alias zh_CN.UTF-8 && locale-gen zh_CN.UTF-8 &&\
|
|
|
export DEBIAN_FRONTEND=noninteractive &&\
|
|
|
apt-get install -y tzdata && ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime &&\
|
|
|
apt-get install -y fontconfig ttf-mscorefonts-installer ttf-wqy-microhei ttf-wqy-zenhei xfonts-wqy &&\
|
|
|
apt-get install -y wget
|
|
|
# 安装 arm64-jre8
|
|
|
RUN apt-get install -y openjdk-8-jre
|
|
|
# 编译 libreoffice
|
|
|
RUN apt-get install -y git build-essential zip ccache junit4 libkrb5-dev nasm graphviz python3 python3-dev qtbase5-dev libkf5coreaddons-dev libkf5i18n-dev libkf5config-dev libkf5windowsystem-dev libkf5kio-dev autoconf libcups2-dev libfontconfig1-dev gperf default-jdk doxygen libxslt1-dev xsltproc libxml2-utils libxrandr-dev libx11-dev bison flex libgtk-3-dev libgstreamer-plugins-base1.0-dev libgstreamer1.0-dev ant ant-optional libnss3-dev libavahi-client-dev libxt-dev &&\
|
|
|
# 安装 ccache(重复编译时加快速度)
|
|
|
apt-get install ccache &&\
|
|
|
ccache -M 10G &&\
|
|
|
# clone主代码
|
|
|
mkdir /opt/libreoffice
|
|
|
WORKDIR /opt/libreoffice
|
|
|
RUN git clone --depth=1 --branch libreoffice-7-5 git://go.suokunlong.cn/lo/core ./libreoffice-7-5
|
|
|
# 配置&抓取子模块
|
|
|
WORKDIR /opt/libreoffice/libreoffice-7-5
|
|
|
RUN git submodule init &&\
|
|
|
git config --unset-all submodule.dictionaries.active &&\
|
|
|
git config --unset-all submodule.dictionaries.url &&\
|
|
|
git config --unset-all submodule.helpcontent2.active &&\
|
|
|
git config --unset-all submodule.helpcontent2.url &&\
|
|
|
git submodule update --progress --depth=1 &&\
|
|
|
# 下载第三方依赖
|
|
|
mkdir -p /opt/libreoffice/ext &&\
|
|
|
wget --recursive --no-parent --no-check-certificate -P /opt/libreoffice/ext https://go.suokunlong.cn:88/dl/libreoffice/external_tarballs/
|
|
|
RUN mv /opt/libreoffice/ext/go.suokunlong.cn:88/dl/libreoffice/external_tarballs/* /opt/libreoffice/ext
|
|
|
# 配置编译选项
|
|
|
RUN cat << EOF > autogen.input \
|
|
|
&& echo "--without-help" >> autogen.input \
|
|
|
&& echo "--without-helppack-integration" >> autogen.input \
|
|
|
&& echo "--with-lang=zh-CN zh-TW" >> autogen.input \
|
|
|
&& echo "--disable-online-update" >> autogen.input \
|
|
|
&& echo "--disable-breakpad" >> autogen.input \
|
|
|
&& echo "--disable-odk" >> autogen.input \
|
|
|
&& echo "--without-doxygen" >> autogen.input \
|
|
|
&& echo "--with-external-tar=/opt/libreoffice/ext" >> autogen.input \
|
|
|
&& echo "--without-java" >> autogen.input \
|
|
|
&& echo "--enable-firebird-sdbc" >> autogen.input \
|
|
|
&& echo "--without-system-firebird" >> autogen.input \
|
|
|
&& echo "--enable-python=internal" >> autogen.input
|
|
|
# 预编译
|
|
|
RUN ./autogen.sh
|
|
|
# 因为libreoffice的安全策略,不允许root用户执行编译操作(可以改Makefile文件解决),所以新建用户
|
|
|
RUN useradd libreoffice
|
|
|
# 切换用户
|
|
|
RUN su libreoffice
|
|
|
# 在普通用户下编译
|
|
|
RUN make || true
|
|
|
# !!!编译40分钟左右会报错,此时需要执行以下操作重新编译
|
|
|
RUN cp ./workdir/UnpackedTarball/python3/build/lib.linux-aarch64-3.8/_sysconfigdata__linux_aarch64-linux-gnu.py ./workdir/UnpackedTarball/python3/build/lib.linux-aarch64-3.8/_sysconfigdata__linux_aarch64-unknown-linux-gnu.py
|
|
|
# 重新编译
|
|
|
RUN make &&\
|
|
|
make install
|
|
|
|
|
|
RUN ln -s /usr/local/lib/libreoffice/program/soffice /usr/bin/libreoffice
|
|
|
|
|
|
# 清理临时文件
|
|
|
RUN rm -rf /tmp/* && rm -rf /var/lib/apt/lists/* &&\
|
|
|
cd /usr/share/fonts/chinese &&\
|
|
|
mkfontscale &&\
|
|
|
mkfontdir &&\
|
|
|
fc-cache -fv
|
|
|
ENV LANG zh_CN.UTF-8
|
|
|
ENV LC_ALL zh_CN.UTF-8
|
|
|
CMD ["/bin/bash"]
|