DockerfileTest 2.8 KB

123456789101112131415161718192021222324252627282930313233
  1. FROM ubuntu:20.04
  2. # 准备 kkFileView、LibreOffice 和 JDK
  3. COPY server/target/kkFileView-4.4.0-SNAPSHOT.tar.gz /opt/
  4. COPY server/tool/jdk-8u202-linux-x64.tar.gz /opt/
  5. COPY server/tool/LibreOffice_7.6.4_Linux_x86-64_deb.tar.gz /opt/
  6. # 升级系统,安装相关的依赖包和字体、安装 JDK、LibreOffice
  7. RUN echo "deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse\ndeb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse\ndeb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse\ndeb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse\ndeb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse\ndeb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse\ndeb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse\ndeb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse\ndeb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse\ndeb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse" > /etc/apt/sources.list &&\
  8. apt-get clean && apt-get update &&\
  9. apt-get install -y --reinstall ca-certificates &&\
  10. apt-get clean && apt-get update &&\
  11. apt-get install -y locales language-pack-zh-hans &&\
  12. localedef -i zh_CN -c -f UTF-8 -A /usr/share/locale/locale.alias zh_CN.UTF-8 && locale-gen zh_CN.UTF-8 &&\
  13. export DEBIAN_FRONTEND=noninteractive &&\
  14. apt-get install -y tzdata && ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime &&\
  15. apt-get install -y fontconfig ttf-mscorefonts-installer ttf-wqy-microhei ttf-wqy-zenhei xfonts-wqy && \
  16. apt-get install -y libxrender1 libxinerama1 libxt6 libxext-dev libfreetype6-dev libcairo2 libcups2 libx11-xcb1 libnss3 &&\
  17. cd /opt && tar -xvf jdk-8u202-linux-x64.tar.gz && mv jdk1.8.0_202 /usr/local/ &&\
  18. tar -xvf kkFileView-4.4.0-SNAPSHOT.tar.gz &&\
  19. tar -xvf LibreOffice_7.6.4_Linux_x86-64_deb.tar.gz &&\
  20. cd LibreOffice_7.6.4.1_Linux_x86-64_deb/DEBS &&\
  21. dpkg -i *.deb &&\
  22. cd ~ && rm -rf /var/lib/apt/lists/*
  23. # 设置环境变量
  24. ENV JAVA_HOME /usr/local/jdk1.8.0_202
  25. ENV CLASSPATH $JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
  26. ENV PATH $PATH:$JAVA_HOME/bin
  27. ENV LANG zh_CN.UTF-8
  28. ENV LC_ALL zh_CN.UTF-8
  29. ENV KKFILEVIEW_BIN_FOLDER /opt/kkFileView-4.4.0-SNAPSHOT/bin
  30. ENV KK_OFFICE_HOME=/opt/libreoffice7.6
  31. ENV KK_TRUST_HOST=cdn.uxianxin.com,fresh-life.oss-cn-shanghai.aliyuncs.com,file.uxianxin.com
  32. # 容器的入口,启动后需要执行的程序
  33. ENTRYPOINT ["java","-Dfile.encoding=UTF-8","-Dspring.config.location=/opt/kkFileView-4.4.0-SNAPSHOT/config/application.properties","-jar","/opt/kkFileView-4.4.0-SNAPSHOT/bin/kkFileView-4.4.0-SNAPSHOT.jar"]