-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
49 lines (36 loc) · 1.88 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
FROM python:3.8 as requirements-stage
LABEL maintainer="Omar Arab Oghli <[email protected]>"
WORKDIR /tmp
RUN pip install poetry
COPY ./pyproject.toml ./poetry.lock* /tmp/
RUN poetry export -f requirements.txt --output requirements.txt --without-hashes
# Splitting in two stages gets rid of poetry, as for now, since it's not required for the application itself.
FROM ubuntu:bionic
LABEL maintainer="Omar Arab Oghli <[email protected]>"
# Install java for ExtractTable
# Install python 3.8
# Register the python version in alternatives
# Set python 3.8 as the default python
# Upgrade pip to latest version
RUN apt-get clean && apt-get update && \
apt-get -qqy install locales curl python3.8 python3.8-dev python3.8-distutils wget default-jre && \
update-alternatives --install /usr/bin/python python /usr/bin/python3.8 1 && \
update-alternatives --set python /usr/bin/python3.8 && \
curl -s https://bootstrap.pypa.io/get-pip.py -o get-pip.py && \
python get-pip.py --force-reinstall && \
rm get-pip.py
# Set the locale needed for onnxruntime
RUN apt-get install -y locales && \
sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && locale-gen
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
# Install pdf2htmlEX for ConvertPdf
RUN wget -O pdf2html.deb https://github.com/pdf2htmlEX/pdf2htmlEX/releases/download/v0.18.8.rc1/pdf2htmlEX-0.18.8.rc1-master-20200630-Ubuntu-bionic-x86_64.deb && \
apt-get -qqy install ./pdf2html.deb
WORKDIR /orkg-nlp-api
COPY --from=requirements-stage /tmp/requirements.txt /orkg-nlp-api/requirements.txt
RUN pip install --upgrade pip
RUN pip install --no-cache-dir --upgrade -r /orkg-nlp-api/requirements.txt
COPY ./app /orkg-nlp-api/app
CMD ["gunicorn", "app.main:app", "--workers", "1", "--timeout", "0", "--worker-class", "uvicorn.workers.UvicornWorker", "--bind", "0.0.0.0:4321", "--access-logfile=-", "--error-logfile=-"]