-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
49 lines (33 loc) · 1.25 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.10.2-slim-bullseye as base
ENV PYTHONFAULTHANDLER=1 \
PYTHONHASHSEED=random \
PYTHONUNBUFFERED=1
WORKDIR /app
RUN apt-get update && \
apt-get install -y --no-install-recommends libgmp10=2:6.2.1+dfsg-1+deb11u1 && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
FROM base as builder
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
ENV PIP_DEFAULT_TIMEOUT=100 \
PIP_DISABLE_PIP_VERSION_CHECK=1 \
PIP_NO_CACHE_DIR=1 \
POETRY_VERSION=1.1.4
RUN pip install "poetry==$POETRY_VERSION"
RUN apt-get update && \
apt-get install -y --no-install-recommends apt-utils=2.2.4 && \
apt-get install -y --no-install-recommends build-essential=12.9
RUN python -m venv /venv
# This is needed because pkuseg has an undeclared install time dependency for numpy.
RUN /venv/bin/pip install numpy==1.22.0
COPY pyproject.toml poetry.lock ./
RUN poetry export --without-hashes -f requirements.txt | /venv/bin/pip install -r /dev/stdin
COPY . .
RUN poetry build && /venv/bin/pip install dist/*.whl
FROM base as final
# Make sure gunicorn is on the path
ENV PATH="/venv/bin:${PATH}"
COPY --from=builder /venv /venv
COPY language_service /app/
EXPOSE 8000
CMD ["gunicorn", "LanguageService:app", "--config=gunicorn.conf.py"]