-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
54 lines (35 loc) · 1.89 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
50
51
52
53
54
# dep-builder: builds venv with all deps
FROM ubuntu:22.04 AS dep-builder
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
RUN apt-get update && \
apt-get install -y python3 \
python3-venv \
python3-dev \
python3-pip && \
pip install "poetry==1.6.1" && \
python3 -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
COPY pyproject.toml poetry.lock .
RUN poetry export -f requirements.txt --without-hashes | pip install -r /dev/stdin
FROM ubuntu:22.04
# Keeps Python from generating .pyc files in the container
ENV PYTHONDONTWRITEBYTECODE=1
# Turns off buffering for easier container logging
ENV PYTHONUNBUFFERED=1
ENV MODEL_RATES='{"gpt-4":{"unit":"token","prompt_price":"0.00003","completion_price":"0.00006"},"gpt-35-turbo":{"unit":"token","prompt_price":"0.0000015","completion_price":"0.000002"},"gpt-4-32k":{"unit":"token","prompt_price":"0.00006","completion_price":"0.00012"},"text-embedding-ada-002":{"unit":"token","prompt_price":"0.0000001"},"chat-bison@001":{"unit":"char_without_whitespace","prompt_price":"0.0000005","completion_price":"0.0000005"}}'
ENV TOPIC_MODEL="davanstrien/chat_topics"
ENV TOPIC_EMBEDDINGS_MODEL="all-mpnet-base-v2"
# Creates a non-root user with an explicit UID
RUN adduser -u 1001 --disabled-password --gecos "" appuser
WORKDIR /
# Install ca-certificates is required for https connection to InfluxDB
RUN apt-get update && \
apt-get install -y python3 ca-certificates
COPY --from=dep-builder --chown=appuser /opt/venv /opt/venv
COPY --chown=appuser ./aidial_analytics_realtime /aidial_analytics_realtime
ENV PATH="/opt/venv/bin:$PATH"
USER appuser
# During debugging, this entry point will be overridden. For more information, please refer to https://aka.ms/vscode-docker-python-debug
EXPOSE 5000
CMD ["uvicorn", "aidial_analytics_realtime.app:app", "--host", "0.0.0.0", "--port", "5000"]