1.源码修改
基于《使用Docker部署Stirling PDF》这篇文章展开说,主要是针对Stirling这个项目进行定制,在前述的文章中代码中
services:
stirling-pdf:
image: frooodle/s-pdf:0.32.0
ports:
- '8080:8080'
volumes:
- ./StirlingPDF/trainingData:/usr/share/tessdata # Required for extra OCR languages
- ./StirlingPDF/extraConfigs:/configs
- ./StirlingPDF/customFiles:/customFiles/
- ./StirlingPDF/logs:/logs/
- ./StirlingPDF/pipeline:/pipeline/
environment:
- DOCKER_ENABLE_SECURITY=false
- LANGS=en_GB
通过volumes的形式,来提供宿主机和容器内文件进行映射,extraConfigs中需要修改custom_settings.yml内容,这个文件内容会覆盖settings.yml内容。目前主要修改的方式是复制settings.yml到custom_settings.yml中,对特定内容进行修改。下面显示的都是需要修改的部分,其余的内容都保留就行了。
system:
customHTMLFiles: true # enable to have files placed in /customFiles/templates override the existing template HTML files
ui:
appName: 'Full PDF' # application's visible name
homeDescription: '' # short description or tagline shown on the homepage
appNameNavbar: 'Full PDF' # name displayed on the navigation bar
endpoints:
toRemove: ['pipeline','view-pdf','replace-and-invert-color-pdf','split-pdf-by-chapters', 'ocr-pdf'] # list endpoints to disable (e.g. ['img-to-pdf', 'remove-pages'])
groupsToRemove: ['pipeline','view-pdf', 'replace-and-invert-color-pdf','split-pdf-by-chapters', 'ocr-pdf'] # list groups to disable (e.g. ['LibreOffice'])
customFiles文件夹中新建static和templates两个文件夹,其中static中添加的都是照片,templates文件夹中添加fragments文件夹和home.html文件,文件目录需要和github中的源码进行对应。源码目录
这个是本地已经修改的文件夹,里面包括修改的源码和照片fullpdf
2.项目部署
本地部署和线上部署有区别,本地部署docker restart 镜像id, 线上部署的需要重新pull,docker-compose up(ubuntu)。
3.todo
目前图片处理是使用付费的chatgpt在处理,需要寻找免费的图片处理工具;在暗黑的情况下,网站的logo显示有问题,这个需要解决。