-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
113 lines (89 loc) · 3.97 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
FROM ubuntu:lunar
ARG HTTP_PROXY
ARG HTTPS_PROXY
ARG NO_PROXY
ARG http_proxy
ARG https_proxy
ARG no_proxy
ENV HTTP_PROXY=$HTTP_PROXY
ENV HTTPS_PROXY=$HTTPS_PROXY
ENV NO_PROXY=$NO_PROXY
ENV http_proxy=$HTTP_PROXY
ENV https_proxy=$HTTPS_PROXY
ENV no_proxy=$NO_PROXY
ENV DEBIAN_FRONTEND=noninteractive
ENV DEBIAN_PRIORITY=critical
ENV NVIDIA_VISIBLE_DEVICES all
ENV NVIDIA_DRIVER_CAPABILITIES compute,utility,display
# Keeps Python from generating .pyc files in the container
ENV PYTHONDONTWRITEBYTECODE 1
# Turns off buffering for easier container logging
ENV PYTHONUNBUFFERED 1
# default user
USER root
# Update and install python3
RUN apt-get update && apt-get upgrade -y && \
apt-get install -y software-properties-common
# add extra repos
RUN apt-add-repository multiverse && \
apt-add-repository universe && \
add-apt-repository ppa:graphics-drivers/ppa && \
apt-get update && apt-get upgrade -y
RUN apt-get update && apt-get upgrade -y
# install req packages
RUN apt-get install -y python3.11 python3.11-dev python3.11-venv python3.11-doc python3-dev python3-pip
RUN apt-get update && apt-get upgrade -y && \
apt-get --force-yes -o Dpkg::Options::="--force-confold" --force-yes -o Dpkg::Options::="--force-confdef" -fuy dist-upgrade && \
apt-get install -y \
pkg-config \
gnupg \
libssl-dev \
wget \
curl \
gnupg \
gnupg-agent \
dirmngr \
ca-certificates \
apt-transport-https \
fonts-dejavu \
build-essential \
unixodbc \
unixodbc-dev \
gfortran \
gcc \
g++
##### utils for python and TESSERACT
RUN echo "ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true" | debconf-set-selections
RUN apt-get install -y --no-install-recommends fontconfig ttf-mscorefonts-installer
RUN fc-cache -f -v
RUN apt-get install -y libimage-exiftool-perl libtcnative-1 && \
apt-get install -y ttf-mscorefonts-installer fontconfig && \
apt-get install -y --fix-missing libsm6 libxext6 gstreamer1.0-libav fonts-deva fonts-dejavu fonts-gfs-didot fonts-gfs-didot-classic fonts-junicode fonts-ebgaramond fonts-noto-cjk fonts-takao-gothic fonts-vlgothic && \
apt-get install -y --fix-missing ghostscript ghostscript-x gsfonts gsfonts-other gsfonts-x11 fonts-croscore fonts-crosextra-caladea fonts-crosextra-carlito fonts-liberation fonts-open-sans fonts-noto-core fonts-ibm-plex fonts-urw-base35 && \
apt-get install -y --fix-missing imagemagick libcairo2-dev tesseract-ocr tesseract-ocr-eng tesseract-ocr-osd tesseract-ocr-lat tesseract-ocr-fra tesseract-ocr-deu libtesseract5 libtesseract-dev libleptonica-dev liblept5 && \
apt-get install -y --fix-missing libpcre3 libpcre3-dev && \
apt-get install -y --fix-missing mesa-opencl-icd pocl-opencl-icd && \
apt-get install -y --fix-missing libvips-tools libvips libvips-dev
# Pillow package requirements
RUN apt-get install -y python3-tk tcl8.6-dev tk8.6-dev libopenjp2-7-dev libharfbuzz-dev libfribidi-dev libxcb1-dev libtiff5-dev libjpeg8-dev zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev
RUN apt-get clean autoclean && \
apt-get autoremove --purge -y
# other openCL packages
# beignet-opencl-icd
# python3 poppler requirement
RUN apt-get install poppler-utils -y
RUN apt-get install -y --no-install-recommends default-jre libreoffice-java-common libreoffice libreoffice-script-provider-python
RUN rm -rf /var/lib/apt/lists/*
# python3 packages
RUN python3.11 -m pip install --upgrade pip --break-system-packages
RUN python3.11 -m pip install setuptools numpy matplotlib --break-system-packages
RUN python3.11 -m pip install wheel virtualenv cython uwsgi --break-system-packages
RUN python3.11 -m pip install opencv-python-headless --break-system-packages
# create and copy the app
RUN mkdir /ocr_service
COPY ./ /ocr_service
WORKDIR /ocr_service
# Install requirements for the app
RUN python3.11 -m pip install --no-cache-dir --break-system-packages -r ./requirements.txt
# Now run the simple api
CMD ["/bin/bash", "start_service_production.sh"]