BUYN-35 gunicron - Docker ready to deploy!

This commit is contained in:
Stanislaw-Golebiewski 2019-12-08 23:00:18 +01:00
parent be8f6fce0c
commit 2f6263725c
6 changed files with 27 additions and 6 deletions

View File

@ -9,15 +9,17 @@ RUN apt-get update \
WORKDIR /install
COPY ./bk_api .
COPY ./bk_api ./bk_api
RUN mv ./bk_api/ocr_module/tesseract_data/pol.traineddata /usr/share/tesseract-ocr/4.00/tessdata
WORKDIR /install/bk_api
RUN mv ./ocr_module/tesseract_data/pol.traineddata /usr/share/tesseract-ocr/4.00/tessdata
RUN pip3 install pipenv_to_requirements gunicorn && \
pipenv run pipenv_to_requirements && \
pip3 install --no-cache -r requirements.txt
# WORKDIR /install
CMD exec gunicorn bk_api.wsgi:application --bind 0.0.0.0:8000 --workers 3

6
Jenkinsfile vendored
View File

@ -9,10 +9,10 @@ pipeline {
}
stage('Test') {
steps {
echo 'Testing..'
echo '> Test tesseract installation...'
sh 'sh scripts/check_tesseract.sh'
sh 'ls -la /usr/share/tesseract-ocr/4.00/tessdata/'
sh 'python api/main.py -i api/img/biedra.jpg'
echo '> Test OCR api module...'
sh 'python bk_api/ocr_module/main.py -i bk_api/ocr_module/img/biedra.jpg'
}
}
}

16
Makefile Normal file
View File

@ -0,0 +1,16 @@
.PHONY: build run logs
build:
docker build --tag bk_api -f Dockerfile .
run:
docker run -d --name api -p 127.0.0.1:3000:8000 bk_api
logs:
docker logs api --follow
start:
docker start api
stop:
docker stop api

View File

View File

@ -13,6 +13,7 @@ Including another URLconf
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.contrib import admin
from django.urls import include, path
@ -20,3 +21,5 @@ urlpatterns = [
path('polls/', include('core.urls')),
path('admin/', admin.site.urls),
]
urlpatterns += staticfiles_urlpatterns()