File tree 2 files changed +32
-2
lines changed
2 files changed +32
-2
lines changed Original file line number Diff line number Diff line change
1
+ ARG VERSION=latest
2
+
3
+ FROM b3log/siyuan:${VERSION}
4
+
5
+ RUN apk update && apk add --no-cache --update tesseract-ocr
6
+
7
+ RUN cd /usr/share/tessdata \
8
+ && wget https://github.com/tesseract-ocr/tessdata/raw/main/eng.traineddata \
9
+ && wget https://github.com/tesseract-ocr/tessdata/raw/main/chi_sim.traineddata \
10
+ && wget https://github.com/tesseract-ocr/tessdata/raw/main/chi_tra.traineddata
11
+ # Add more langs if needed
12
+
13
+ ENTRYPOINT ["/opt/siyuan/entrypoint.sh"]
14
+
15
+ CMD ["/opt/siyuan/kernel"]
Original file line number Diff line number Diff line change @@ -187,7 +187,7 @@ func IsTesseractExtractable(p string) bool {
187
187
var tesseractOCRLock = sync.Mutex {}
188
188
189
189
func Tesseract (imgAbsPath string ) (ret []map [string ]interface {}) {
190
- if ContainerStd != Container || ! TesseractEnabled {
190
+ if ! TesseractEnabled {
191
191
return
192
192
}
193
193
@@ -343,8 +343,23 @@ func filterTesseractLangs(langs []string) (ret []string) {
343
343
return ret
344
344
}
345
345
346
+ func isContainerTesseractSupported (container string ) bool {
347
+ supportedContainers := []string {
348
+ ContainerStd ,
349
+ ContainerDocker ,
350
+ }
351
+
352
+ for _ , v := range supportedContainers {
353
+ if v == container {
354
+ return true
355
+ }
356
+ }
357
+
358
+ return false
359
+ }
360
+
346
361
func getTesseractVer () (ret string ) {
347
- if ContainerStd != Container {
362
+ if ! isContainerTesseractSupported ( Container ) {
348
363
return
349
364
}
350
365
You can’t perform that action at this time.
0 commit comments