-
Notifications
You must be signed in to change notification settings - Fork 16
Enhancement docker build & words and bounds results #49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
levinunnink
wants to merge
7
commits into
shelfio:master
Choose a base branch
from
Droplr:enhancement-docker-build
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
c8c5c58
Dockerize build process so we dont have to SSH into EC2 instances
641f720
Updates the node library so words and bounds can be extracted using t…
6815697
Update readme
42818a9
Remove bash scripts from root
12ab917
Update readme for better example of how to stream to tesseract
1b74bf3
Update tsv parsing to use stable library
5191fb4
Fix readme url
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
*.swo | ||
*.swp | ||
.git | ||
.DS_Store | ||
node_modules | ||
bin | ||
build | ||
scripts | ||
coverage | ||
.nyc_output | ||
. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ node_modules/ | |
.DS_Store | ||
yarn.lock | ||
*.tar.gz | ||
build |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from lambci/lambda:build-nodejs8.10 | ||
|
||
RUN yum install -y autoconf aclocal automake install libtool libjpeg-devel \ | ||
libpng-devel libtiff-devel zlib-devel wget gzip make cmakegcc freetype-devel \ | ||
gcc gcc-c++ git lcms2-devel libjpeg-turbo-devel autogen libpng-devel \ | ||
libtiff-devel libwebp-devel libzip-devel zlib-devel libgcc | ||
|
||
RUN yum groupinstall "Development Tools" -y | ||
|
||
RUN yum install -y cmake | ||
|
||
COPY . . | ||
|
||
RUN wget https://github.com/google/brotli/archive/v1.0.7.tar.gz | ||
RUN tar -zxvf v1.0.7.tar.gz | ||
RUN cd brotli-1.0.7 && mkdir out && cd out && ../configure-cmake && make && make test && make install |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
NAME=aws-lambda-tesseract | ||
PWD=$(shell pwd) | ||
|
||
build: build-docker build-tesseract compress-tesseract | ||
|
||
build-dist: build-tesseract compress-tesseract | ||
|
||
build-docker: | ||
docker build -f Dockerfile -t $(NAME) . | ||
|
||
version: | ||
@echo $(shell git rev-parse HEAD) | ||
|
||
build-tesseract: | ||
docker run -it -v $(PWD)/scripts:/scripts -v $(PWD)/build:/build -v $(PWD)/build:/build $(NAME) /scripts/compile-tesseract.sh | ||
|
||
compress-tesseract: | ||
docker run -it -v $(PWD)/scripts:/scripts -v $(PWD)/build:/build $(NAME) /scripts/compress-with-brotli.sh |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#!/usr/bin/env bash | ||
|
||
echo "Building" | ||
# Build leptonica | ||
wget http://www.leptonica.com/source/leptonica-1.77.0.tar.gz | ||
tar -zxvf leptonica-1.77.0.tar.gz | ||
ls -la ./ | ||
cd leptonica-1.77.0 | ||
ls -la | ||
./configure | ||
make | ||
make install | ||
|
||
# Build tesseract 4.0 | ||
cd .. | ||
wget https://github.com/tesseract-ocr/tesseract/archive/4.0.0.tar.gz | ||
tar -zxvf 4.0.0.tar.gz | ||
cd tesseract-4.0.0/ | ||
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig | ||
./autogen.sh | ||
./configure | ||
make | ||
make install | ||
ldconfig | ||
|
||
cd ~ | ||
mkdir tesseract-standalone | ||
|
||
# trim unneeded ~ 15 MB | ||
strip ./tesseract-standalone/**/* | ||
|
||
# copy files | ||
cd tesseract-standalone | ||
cp /usr/local/bin/tesseract . | ||
mkdir lib | ||
cp /usr/local/lib/libtesseract.so.4 lib/ | ||
cp /usr/local/lib/liblept.so.5 lib/ | ||
# cp /usr/lib64/* lib/ | ||
cp /usr/lib64/libjpeg.so.62 lib/ | ||
cp /usr/lib64/libwebp.so.4 lib/ | ||
cp /usr/lib64/libstdc++.so.6 lib/ | ||
cp /usr/lib64/libpng15.so.15 lib/ | ||
cp /usr/lib64/libtiff.so.5 lib/ | ||
cp /usr/lib64/libgomp.so.1 lib/ | ||
cp /usr/lib64/libjbig.so.2.0 lib/ | ||
|
||
# copy training data | ||
mkdir tessdata | ||
cd tessdata | ||
wget https://github.com/tesseract-ocr/tessdata_fast/raw/master/eng.traineddata | ||
|
||
# Create configs | ||
mkdir configs | ||
echo "tessedit_create_tsv 1" > configs/tsv | ||
|
||
# archive | ||
cd ~ | ||
tar -zcvf tesseract.tar.gz tesseract-standalone | ||
mv tesseract.tar.gz /build/ | ||
|
||
echo "Done!" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/usr/bin/env bash | ||
|
||
tar -C /build -zxvf /build/tesseract.tar.gz | ||
mv /build/tesseract-standalone /build/tesseract | ||
cd /build | ||
tar -cf tt.tar tesseract | ||
rm -rf tesseract | ||
echo "Running brotli (this can take a few minutes)" | ||
brotli --best --force --verbose /build/tt.tar | ||
echo "Done" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.