File size: 1,094 Bytes
e29055a
 
 
 
 
8f59964
e29055a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23cf937
e29055a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41ee59e
e29055a
 
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
FROM pytorch/pytorch

# if you forked EasyOCR, you can pass in your own GitHub username to use your fork
# i.e. gh_username=myname
ARG gh_username=JaidedAI
ARG service_home="/home/ubuntu/EasyOCR"

# Configure apt and install packages
RUN apt-get update -y && \
    apt-get install -y \
    libglib2.0-0 \
    libsm6 \
    libxext6 \
    libxrender-dev \
    libgl1-mesa-dev \
    git \
    # cleanup
    && apt-get autoremove -y \
    && apt-get clean -y \
    && rm -rf /var/lib/apt/li

# Clone EasyOCR repo
RUN mkdir -p "$service_home" \
    && git clone "https://github.com/$gh_username/EasyOCR.git" "$service_home" \
    && cd "$service_home" \
    && git remote add upstream "https://github.com/JaidedAI/EasyOCR.git" \
    && git pull upstream master

# Build
RUN cd "$service_home" \
    && python setup.py build_ext --inplace -j 4 \
    && python -m pip install -e .

ADD ./recognition.py /home/ubuntu/
WORKDIR /home/ubuntu/

RUN pip install Flask

EXPOSE 2000
RUN alias python=python3
RUN mkdir -p /.EasyOCR; chmod 777 /.EasyOCR
ENTRYPOINT ["python"]
CMD ["/home/ubuntu/recognition.py"]