diff --git a/Dockerfile b/Dockerfile index 6aba297..ae92506 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,29 @@ + + FROM ubuntu:18.04 MAINTAINER Rick Torzynski "ricktorzynski@gmail.com" -RUN apt-get update -y -RUN apt-get install -y python-pip python-dev build-essential -RUN apt update && apt install -y libsm6 libxext6 -RUN apt-get -y install tesseract-ocr + +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update \ + && apt-get -y install tesseract-ocr \ + && apt-get install -y python3 python3-distutils python3-pip \ + && cd /usr/local/bin \ + && ln -s /usr/bin/python3 python \ + && pip3 --no-cache-dir install --upgrade pip \ + && rm -rf /var/lib/apt/lists/* + + +RUN apt update \ + && apt-get install ffmpeg libsm6 libxext6 -y +RUN pip3 install pytesseract +RUN pip3 install opencv-python +RUN pip3 install pillow + COPY . /app WORKDIR /app -RUN pip install pillow -RUN pip install pytesseract -RUN pip install opencv-contrib-python + + RUN pip install -r requirements.txt -ENTRYPOINT ["python"] -CMD ["app.py"] +ENTRYPOINT ["python3"] +CMD ["app.py"] \ No newline at end of file diff --git a/app.py b/app.py index bdfe04c..8c916b5 100644 --- a/app.py +++ b/app.py @@ -58,4 +58,6 @@ def upload_file(): return render_template("uploaded.html", displaytext=text, fname=filename) if __name__ == '__main__': - app.run(host="0.0.0.0", port=5000, debug=True) + port = int(os.environ.get('PORT', 5000)) + app.run(debug=True, host='0.0.0.0', port=port) + # app.run(host="0.0.0.0", port=5000, debug=True) diff --git a/requirements.txt b/requirements.txt index 455ddbf..7ce613d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,7 +6,7 @@ itsdangerous==1.1.0 Jinja2>=2.10.1 MarkupSafe==1.1.0 numpy==1.15.4 -opencv-contrib-python==4.2.0.32 +opencv-python>=4.0 pillow>=6.2.0 -pytesseract==0.2.6 +pytesseract>=0.2.6 werkzeug==0.15.3