Dockerfile 1.33 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
8
9
# wget embedding model weight from alpine (does not exist from slim-buster)
RUN wget "https://chroma-onnx-models.s3.amazonaws.com/all-MiniLM-L6-v2/onnx.tar.gz"

Timothy J. Baek's avatar
Timothy J. Baek committed
10
COPY package.json package-lock.json ./ 
11
RUN npm ci
12

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

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

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

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

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

ENV OPENAI_API_BASE_URL ""
ENV OPENAI_API_KEY ""

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

WORKDIR /app
Timothy J. Baek's avatar
Timothy J. Baek committed
30

Dave Bauman's avatar
Dave Bauman committed
31
32
33
34
35
# Install 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
36
# copy embedding weight from build
Timothy J. Baek's avatar
Timothy J. Baek committed
37
RUN mkdir -p /root/.cache/chroma/onnx_models/all-MiniLM-L6-v2
Timothy J. Baek's avatar
Timothy J. Baek committed
38
COPY --from=build /app/onnx.tar.gz /root/.cache/chroma/onnx_models/all-MiniLM-L6-v2
Timothy J. Baek's avatar
Timothy J. Baek committed
39
40
41
42
43

RUN cd /root/.cache/chroma/onnx_models/all-MiniLM-L6-v2 &&\
    tar -xzf onnx.tar.gz

# copy built frontend files
Timothy J. Baek's avatar
Timothy J. Baek committed
44
45
46
47
48
COPY --from=build /app/build /app/build

WORKDIR /app/backend

COPY ./backend/requirements.txt ./requirements.txt
Timothy J. Baek's avatar
Timothy J. Baek committed
49

Ismael's avatar
Ismael committed
50
51
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
52

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

COPY ./backend .

57
CMD [ "sh", "start.sh"]