File size: 1,708 Bytes
16eedf0
aee1b53
16eedf0
aee1b53
e45341a
16eedf0
e45341a
a040483
 
aee1b53
16eedf0
913c8a0
 
 
aee1b53
913c8a0
aee1b53
a040483
 
 
aee1b53
16eedf0
442ab94
aee1b53
a040483
 
 
aee1b53
16eedf0
 
 
a040483
 
16eedf0
 
aee1b53
42d9bcf
a040483
aee1b53
a040483
 
aee1b53
a040483
16eedf0
 
 
 
 
 
 
aee1b53
16eedf0
 
aee1b53
16eedf0
aee1b53
16eedf0
aee1b53
16eedf0
 
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
55
56
57
58
59
60
FROM ghcr.io/huggingface/chat-ui:latest AS base

FROM ghcr.io/huggingface/text-generation-inference:latest AS final

ARG MODEL_NAME
ENV MODEL_NAME=${MODEL_NAME}

ENV TZ=Europe/Paris \
    PORT=3000

# mongo installation
RUN curl -fsSL https://www.mongodb.org/static/pgp/server-7.0.asc | \
    gpg -o /usr/share/keyrings/mongodb-server-7.0.gpg \
   --dearmor

RUN echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-7.0.gpg ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/7.0 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-7.0.list

RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
    mongodb-org && \
    rm -rf /var/lib/apt/lists/*

# node installation
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | /bin/bash -

RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
    nodejs && \
    rm -rf /var/lib/apt/lists/*

# image setup
RUN useradd -m -u 1000 user

RUN mkdir /app
RUN chown -R 1000:1000 /app
RUN mkdir /data
RUN chown -R 1000:1000 /data

# Switch to the "user" user
USER user

ENV HOME=/home/user \
    PATH=/home/user/.local/bin:$PATH

RUN npm config set prefix /home/user/.local
RUN npm install -g dotenv-cli


# copy chat-ui from base image
COPY --from=base --chown=1000 /app/node_modules /app/node_modules
COPY --from=base --chown=1000 /app/package.json /app/package.json
COPY --from=base --chown=1000 /app/build /app/build

COPY --from=base --chown=1000 /app/.env /app/.env
COPY --chown=1000 .env.local /app/.env.local

COPY --chown=1000 entrypoint.sh /app/entrypoint.sh

RUN chmod +x /app/entrypoint.sh

# entrypoint
ENTRYPOINT [ "/app/entrypoint.sh" ]