支持通过docker构建镜像
This commit is contained in:
34
document-docker/Dockerfile
Normal file
34
document-docker/Dockerfile
Normal file
@@ -0,0 +1,34 @@
|
||||
FROM lscr.io/linuxserver/libreoffice:latest
|
||||
|
||||
RUN echo "https://mirrors.tencent.com/alpine/v$(cut -d'.' -f1,2 /etc/alpine-release)/main/" > /etc/apk/repositories
|
||||
RUN echo "https://mirrors.tencent.com/alpine/v$(cut -d'.' -f1,2 /etc/alpine-release)/community/" >> /etc/apk/repositories
|
||||
|
||||
RUN apk update
|
||||
RUN apk add --no-cache openjdk17-jre
|
||||
RUN rm -rf /var/cache/apk/*
|
||||
|
||||
WORKDIR /app
|
||||
RUN mkdir -p /app/logs
|
||||
|
||||
COPY app/document-server-*.jar /app/application.jar
|
||||
COPY app/application.yml /app/application.yml
|
||||
|
||||
COPY fonts /usr/share/fonts/truetype
|
||||
|
||||
COPY entrypoint.sh /entrypoint.sh
|
||||
RUN chmod +x /entrypoint.sh
|
||||
|
||||
#see https://hub.docker.com/r/linuxserver/libreoffice
|
||||
ENV PUID=1000
|
||||
ENV PGID=1000
|
||||
ENV TZ=Asia/Shanghai
|
||||
ENV LC_ALL=zh_CN.UTF-8
|
||||
ENV TITLE="Libre Office"
|
||||
ENV CUSTOM_PORT=3000
|
||||
ENV CUSTOM_HTTPS_PORT1=3001
|
||||
|
||||
ENV DOCUMENT_SERVER_PORT=9004
|
||||
ENV PORT_NUMBERS=2002
|
||||
ENV MAX_TASKS_PER_PROCESS=200
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
34
document-docker/build.sh
Normal file
34
document-docker/build.sh
Normal file
@@ -0,0 +1,34 @@
|
||||
#!/bin/bash
|
||||
# 设置Maven路径
|
||||
export PATH=$PATH:/Volumes/Working/Software/apache-maven-3.9.3/bin
|
||||
|
||||
# 创建临时目录存放需要运行的jar
|
||||
mkdir -p app
|
||||
|
||||
# 构建jar
|
||||
echo 构建jar
|
||||
mvn -f ../document-server/jodconverter-document-server/pom.xml clean package -Dmaven.test.skip=true
|
||||
echo jar构建完成
|
||||
|
||||
# 复制所需文件
|
||||
cp ../document-server/jodconverter-document-server/target/document-server-*.jar app/
|
||||
cp ../document-server/jodconverter-document-server/target/application.yml app/
|
||||
|
||||
# 执行构建
|
||||
|
||||
#amd64
|
||||
echo 开始构建amd64镜像...
|
||||
docker buildx build --platform linux/amd64 -t document-server:1.0 ./
|
||||
rm -rf document-server-1.0.tar.gz
|
||||
docker save document-server:1.0 | gzip > document-server-1.0.tar.gz
|
||||
echo amd64镜像构建成功.
|
||||
|
||||
#arm64
|
||||
echo 开始构建arm64镜像...
|
||||
docker buildx build --platform linux/arm64 -t document-server:1.0.arm64 ./
|
||||
rm -rf document-server-1.0.arm64.tar.gz
|
||||
docker save document-server:1.0.arm64 | gzip > document-server-1.0.arm64.tar.gz
|
||||
echo arm64镜像构建成功.
|
||||
|
||||
# 清理临时文件
|
||||
rm -rf app
|
||||
20
document-docker/entrypoint.sh
Normal file
20
document-docker/entrypoint.sh
Normal file
@@ -0,0 +1,20 @@
|
||||
#!/bin/sh
|
||||
|
||||
# 确保目录存在
|
||||
mkdir -p /etc/services.d/java
|
||||
|
||||
# 创建Java服务启动脚本
|
||||
cat > /etc/services.d/java/run <<EOF
|
||||
#!/bin/sh
|
||||
exec java -jar /app/application.jar \
|
||||
--server.port=${DOCUMENT_SERVER_PORT} \
|
||||
--spring.config.location=/app/application.yml \
|
||||
--jodconverter.local.port-numbers=${PORT_NUMBERS} \
|
||||
--jodconverter.local.max-tasks-per-process=${MAX_TASKS_PER_PROCESS}
|
||||
EOF
|
||||
|
||||
# 设置可执行权限
|
||||
chmod +x /etc/services.d/java/run
|
||||
|
||||
# 启动s6-overlay(它会自动管理所有服务)
|
||||
exec /init
|
||||
BIN
document-docker/fonts/Deng.ttf
Executable file
BIN
document-docker/fonts/Deng.ttf
Executable file
Binary file not shown.
BIN
document-docker/fonts/Dengb.ttf
Executable file
BIN
document-docker/fonts/Dengb.ttf
Executable file
Binary file not shown.
BIN
document-docker/fonts/Dengl.ttf
Executable file
BIN
document-docker/fonts/Dengl.ttf
Executable file
Binary file not shown.
BIN
document-docker/fonts/FZSTK.TTF
Executable file
BIN
document-docker/fonts/FZSTK.TTF
Executable file
Binary file not shown.
BIN
document-docker/fonts/FZYTK.TTF
Executable file
BIN
document-docker/fonts/FZYTK.TTF
Executable file
Binary file not shown.
BIN
document-docker/fonts/SIMLI.TTF
Executable file
BIN
document-docker/fonts/SIMLI.TTF
Executable file
Binary file not shown.
BIN
document-docker/fonts/SIMYOU.TTF
Executable file
BIN
document-docker/fonts/SIMYOU.TTF
Executable file
Binary file not shown.
BIN
document-docker/fonts/STCAIYUN.TTF
Executable file
BIN
document-docker/fonts/STCAIYUN.TTF
Executable file
Binary file not shown.
BIN
document-docker/fonts/STFANGSO.TTF
Executable file
BIN
document-docker/fonts/STFANGSO.TTF
Executable file
Binary file not shown.
BIN
document-docker/fonts/STHUPO.TTF
Executable file
BIN
document-docker/fonts/STHUPO.TTF
Executable file
Binary file not shown.
BIN
document-docker/fonts/STKAITI.TTF
Executable file
BIN
document-docker/fonts/STKAITI.TTF
Executable file
Binary file not shown.
BIN
document-docker/fonts/STLITI.TTF
Executable file
BIN
document-docker/fonts/STLITI.TTF
Executable file
Binary file not shown.
BIN
document-docker/fonts/STSONG.TTF
Executable file
BIN
document-docker/fonts/STSONG.TTF
Executable file
Binary file not shown.
BIN
document-docker/fonts/STXIHEI.TTF
Executable file
BIN
document-docker/fonts/STXIHEI.TTF
Executable file
Binary file not shown.
BIN
document-docker/fonts/STXINGKA.TTF
Executable file
BIN
document-docker/fonts/STXINGKA.TTF
Executable file
Binary file not shown.
BIN
document-docker/fonts/STXINWEI.TTF
Executable file
BIN
document-docker/fonts/STXINWEI.TTF
Executable file
Binary file not shown.
BIN
document-docker/fonts/STZHONGS.TTF
Executable file
BIN
document-docker/fonts/STZHONGS.TTF
Executable file
Binary file not shown.
BIN
document-docker/fonts/msyh.ttc
Executable file
BIN
document-docker/fonts/msyh.ttc
Executable file
Binary file not shown.
BIN
document-docker/fonts/msyhbd.ttc
Executable file
BIN
document-docker/fonts/msyhbd.ttc
Executable file
Binary file not shown.
BIN
document-docker/fonts/msyhl.ttc
Executable file
BIN
document-docker/fonts/msyhl.ttc
Executable file
Binary file not shown.
BIN
document-docker/fonts/simfang.ttf
Executable file
BIN
document-docker/fonts/simfang.ttf
Executable file
Binary file not shown.
BIN
document-docker/fonts/simhei.ttf
Executable file
BIN
document-docker/fonts/simhei.ttf
Executable file
Binary file not shown.
BIN
document-docker/fonts/simkai.ttf
Executable file
BIN
document-docker/fonts/simkai.ttf
Executable file
Binary file not shown.
BIN
document-docker/fonts/simsun.ttc
Executable file
BIN
document-docker/fonts/simsun.ttc
Executable file
Binary file not shown.
6
document-docker/install-fonts.sh
Executable file
6
document-docker/install-fonts.sh
Executable file
@@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
echo installing fonts
|
||||
sudo mkdir -p /usr/share/fonts/truetype
|
||||
sudo cp -r ./fonts/* /usr/share/fonts/truetype/
|
||||
sudo fc-cache -fv
|
||||
echo fonts installed
|
||||
Reference in New Issue
Block a user