-
Notifications
You must be signed in to change notification settings - Fork 7
/
Dockerfile-pkg
51 lines (41 loc) · 1.44 KB
/
Dockerfile-pkg
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
FROM ubuntu:22.04
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update --fix-missing \
&& apt-get install -y --no-install-recommends \
build-essential \
cmake \
ghostscript \
libgs-dev \
libleptonica-dev \
libtesseract-dev \
libxml2-dev \
libxslt1-dev \
pkg-config \
python3-pip
COPY CMakeModules /tmp/tesseract-recognize/CMakeModules
COPY pagexml /tmp/tesseract-recognize/pagexml
COPY CMakeLists.txt Dockerfile* PageXML* mock_cv.h tesseract-recognize* /tmp/tesseract-recognize/
RUN cd /tmp/tesseract-recognize \
&& cmake -DCMAKE_BUILD_TYPE=Release . \
&& make
FROM ubuntu:22.04
LABEL maintainer="Mauricio Villegas <[email protected]>"
RUN apt-get update --fix-missing \
&& apt-get install -y --no-install-recommends \
ghostscript \
libxslt1.1 \
tesseract-ocr \
python3-pip \
&& apt-get autoremove -y \
&& apt-get purge -y $(dpkg -l | awk '{if($1=="rc")print $2}') \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
COPY --from=0 /tmp/tesseract-recognize/tesseract-recognize /usr/local/bin/
COPY tesseract_recognize_api.py /usr/local/bin/
RUN sed -n '/^@requirements /{ s|^@requirements ||; p; }' /usr/local/bin/tesseract_recognize_api.py > /tmp/requirements.txt \
&& pip3 install -r /tmp/requirements.txt \
&& rm /tmp/requirements.txt
RUN useradd -m -u 1048 -g 0 tesseract
USER 1048
EXPOSE 5000
ENTRYPOINT /usr/local/bin/tesseract_recognize_api.py --host 0.0.0.0