diff --git a/Dockerfile b/Dockerfile index 7db38dd..7a55e2d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,7 +9,9 @@ RUN apt-get update \ WORKDIR /install -COPY ./api . +COPY . . + +WORKDIR /install/api # get Polish language train data # RUN wget -P /usr/share/tesseract-ocr/4.00/tessdata/ https://github.com/tesseract-ocr/tessdata/raw/4.00/pol.traineddata @@ -20,7 +22,8 @@ RUN pip3 install pipenv_to_requirements gunicorn && \ pipenv run pipenv_to_requirements && \ pip3 install --no-cache -r requirements.txt -WORKDIR /install/api + +WORKDIR /install diff --git a/Jenkinsfile b/Jenkinsfile index 2004aeb..0c7e00c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -4,12 +4,14 @@ pipeline { stages { stage('Build') { steps { - sh 'python api/main.py -i api/img/biedra.jpg' + echo 'Building..' } } stage('Test') { steps { echo 'Testing..' + sh scripts/check_tesseract.sh + sh 'python api/main.py -i api/img/biedra.jpg' } } } diff --git a/scripts/check_tesseract.sh b/scripts/check_tesseract.sh new file mode 100644 index 0000000..908f596 --- /dev/null +++ b/scripts/check_tesseract.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +# check if tesseract is avaliable +if [ -x "$(command -v tesseract)" ] +then + echo "> [Tesseract] tesseract command available..."; +else + echo "> [Tesseract] could find tesseract command!"; + exit -1; +fi + +# check if tesseract is avaliable +if tesseract --list-langs | grep -q 'pol' +then + echo "> [Tesseract] polish langauge avaliable"; +else + echo "> [Tesseract] polish langage unavaliable..."; + exit -1; +fi