Dockerfile 1.38 KB
Newer Older
Timothy J. Baek's avatar
Timothy J. Baek committed
1
2
# syntax=docker/dockerfile:1

3
FROM node:alpine as build
4

Timothy J. Baek's avatar
Timothy J. Baek committed
5
6
WORKDIR /app

Timothy J. Baek's avatar
Timothy J. Baek committed
7
# wget embedding model weight from alpine (does not exist from slim-buster)
Xiaodong Ye's avatar
Xiaodong Ye committed
8
9
RUN wget "https://chroma-onnx-models.s3.amazonaws.com/all-MiniLM-L6-v2/onnx.tar.gz" -O - | \
    tar -xzf - -C /app
Timothy J. Baek's avatar
Timothy J. Baek committed
10

Xiaodong Ye's avatar
Xiaodong Ye committed
11
COPY package.json package-lock.json ./
12
RUN npm ci
13

14
15
COPY . .
RUN npm run build
Timothy J. Baek's avatar
Timothy J. Baek committed
16

Timothy J. Baek's avatar
Timothy J. Baek committed
17

Timothy J. Baek's avatar
Timothy J. Baek committed
18
FROM python:3.11-slim-bookworm as base
Timothy J. Baek's avatar
Timothy J. Baek committed
19
20

ENV ENV=prod
21
ENV PORT ""
Timothy J. Baek's avatar
Timothy J. Baek committed
22
23

ENV OLLAMA_API_BASE_URL "/ollama/api"
Timothy J. Baek's avatar
Timothy J. Baek committed
24
25
26
27

ENV OPENAI_API_BASE_URL ""
ENV OPENAI_API_KEY ""

28
ENV WEBUI_JWT_SECRET_KEY "SECRET_KEY"
Timothy J. Baek's avatar
Timothy J. Baek committed
29
30
31

WORKDIR /app/backend

32
# install python dependencies
Timothy J. Baek's avatar
Timothy J. Baek committed
33
COPY ./backend/requirements.txt ./requirements.txt
Timothy J. Baek's avatar
Timothy J. Baek committed
34

Ismael's avatar
Ismael committed
35
36
RUN pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu --no-cache-dir
RUN pip3 install -r requirements.txt --no-cache-dir
37

Timothy J. Baek's avatar
Timothy J. Baek committed
38
39
40
41
42
43
# Install pandoc
# RUN python -c "import pypandoc; pypandoc.download_pandoc()"
RUN apt-get update \
    && apt-get install -y pandoc \
    && rm -rf /var/lib/apt/lists/*

Timothy J. Baek's avatar
Timothy J. Baek committed
44
# RUN python -c "from sentence_transformers import SentenceTransformer; model = SentenceTransformer('all-MiniLM-L6-v2')"
Timothy J. Baek's avatar
Timothy J. Baek committed
45

46
47
# copy embedding weight from build
RUN mkdir -p /root/.cache/chroma/onnx_models/all-MiniLM-L6-v2
Xiaodong Ye's avatar
Xiaodong Ye committed
48
COPY --from=build /app/onnx /root/.cache/chroma/onnx_models/all-MiniLM-L6-v2/onnx
49
50
51
52
53

# copy built frontend files
COPY --from=build /app/build /app/build

# copy backend files
Timothy J. Baek's avatar
Timothy J. Baek committed
54
55
COPY ./backend .

Xiaodong Ye's avatar
Xiaodong Ye committed
56
CMD [ "sh", "start.sh" ]