【Heroku】How to install service and setup environment variable: Use Tesseract OCR as example
Brief
This is going to lead you to use apt to install service, and setup environment variable.
First - Add apt buildpack into Heroku
The apt buildpack:
All buildpacks in Heroku
On Command-line
To use the latest stable version:
heroku buildpacks:add --index 1 heroku-community/apt
To use the edge version (i.e. the code in this repo):
heroku buildpacks:add --index 1 https://github.com/heroku/heroku-buildpack-apt
On Web:
The web link: https://dashboard.heroku.com/apps/{app_name}/settings
Click “add buildpack”
enter buildpack url
Second - Create “Aptfile” in your app
echo "tesseract-ocr\ntesseract-ocr-eng" >> Aptfile
Third - Set TESSDATA_PREFIX
You have to enter bash and check the tesseract path, and find our target “eng.traineddata path”
heroku run bash~ $ which tesseract
/app/.apt/usr/bin/tesseract~ $ ls /app/.apt/usr/share/tesseract-ocr/4.00/tessdata/
configs eng.traineddata osd.traineddata pdf.ttf tessconfigs
On Command-line
To use the latest stable version:
heroku config:set TESSDATA_PREFIX=/app/.apt/usr/share/tesseract-ocr/4.00/tessdata
To use the edge version (i.e. the code in this repo):
heroku buildpacks:add --index 1 https://github.com/heroku/heroku-buildpack-apt
On Web:
The web link:https://dashboard.heroku.com/apps/{app_name}/settings
If you like this one or feel helpful, please applause or follow to Zam, I am really appreciate you doing that