-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.origi
40 lines (29 loc) · 1.21 KB
/
Dockerfile.origi
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
ARG PYTHON_ENV=python:3.10-slim
ARG POETRY_VERSION=1.6.1
FROM $PYTHON_ENV as build
# Allow statements and log messages to immediately appear in the logs
ENV PYTHONUNBUFFERED True
RUN apt-get update && \
apt-get install --yes --no-install-recommends curl g++ libopencv-dev && \
rm -rf /var/lib/apt/lists/*
RUN curl -sSL https://install.python-poetry.org | POETRY_VERSION=${POETRY_VERSION} python3 -
RUN mkdir -p /app
WORKDIR /app
COPY pyproject.toml poetry.lock ./
ENV PATH="/root/.local/bin:$PATH"
RUN poetry config virtualenvs.create false && \
poetry install --no-interaction --no-root
FROM $PYTHON_ENV as prod
# Allow statements and log messages to immediately appear in the logs
ENV PYTHONUNBUFFERED True
# Copy local code to the container image.
ENV APP_HOME /app
WORKDIR $APP_HOME
COPY . ./
COPY magic-pdf.json /root
COPY --from=build /usr/local/lib/python3.10/site-packages /usr/local/lib/python3.10/site-packages
COPY --from=build /usr/lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu
COPY --from=build /usr/local/bin/magic-pdf /usr/local/bin/magic-pdf
COPY --from=build /usr/local/bin/uvicorn /usr/local/bin/uvicorn
RUN python download_models.py
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "3000"]