Reality123b commited on
Commit
c6a4ea2
·
verified ·
1 Parent(s): 16fe24e

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +24 -57
Dockerfile CHANGED
@@ -1,67 +1,32 @@
1
  FROM ghcr.io/huggingface/chat-ui:latest AS base
2
 
3
- # Use a CPU-specific base image for text-generation-inference
4
- FROM ubuntu:22.04 AS final
5
 
6
  ARG MODEL_NAME
7
  ENV MODEL_NAME=${MODEL_NAME}
8
 
9
- ENV TZ=Europe/Paris \
10
- PORT=3000 \
11
- HUGGING_FACE_HUB_TOKEN="" \
12
- MONGO_URL="mongodb://localhost:27017" \
13
- DB_NAME="chat-ui"
14
-
15
- # Install system dependencies for a CPU environment
16
- RUN apt-get update && \
17
- apt-get install -y --no-install-recommends \
18
- wget \
19
- curl \
20
- git \
21
- build-essential \
22
- ca-certificates \
23
- libssl-dev \
24
- libopenblas-dev \
25
- libopenblas-base \
26
- libatlas-base-dev \
27
- libgl1-mesa-glx \
28
- libglib2.0-0 \
29
- python3 \
30
- python3-pip \
31
- && rm -rf /var/lib/apt/lists/*
32
-
33
- # Install text-generation-inference from source for CPU optimization
34
- RUN git clone https://github.com/huggingface/text-generation-inference.git /app/text-generation-inference
35
-
36
- WORKDIR /app/text-generation-inference
37
-
38
- RUN pip3 install --no-cache-dir .
39
-
40
- # Install gnupg to use gpg command
41
- RUN apt-get update && \
42
- apt-get install -y --no-install-recommends \
43
- gnupg && \
44
- rm -rf /var/lib/apt/lists/*
45
-
46
- # mongo installation
47
- RUN curl -fsSL https://www.mongodb.org/static/pgp/server-7.0.asc | \
48
- gpg -o /usr/share/keyrings/mongodb-server-7.0.gpg \
49
- --dearmor
50
 
51
  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
52
 
53
- RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
54
- mongodb-org && \
55
- rm -rf /var/lib/apt/lists/*
56
 
57
- # node installation
58
  RUN curl -fsSL https://deb.nodesource.com/setup_20.x | /bin/bash -
59
 
60
- RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
61
- nodejs && \
62
- rm -rf /var/lib/apt/lists/*
63
 
64
- # image setup
65
  RUN useradd -m -u 1000 user
66
 
67
  RUN mkdir /app
@@ -69,16 +34,16 @@ RUN chown -R 1000:1000 /app
69
  RUN mkdir /data
70
  RUN chown -R 1000:1000 /data
71
 
72
- # Switch to the "user" user
73
  USER user
74
 
75
- ENV HOME=/home/user \
76
- PATH=/home/user/.local/bin:$PATH
77
 
78
  RUN npm config set prefix /home/user/.local
79
  RUN npm install -g dotenv-cli
80
 
81
- # copy chat-ui from base image
82
  COPY --from=base --chown=1000 /app/node_modules /app/node_modules
83
  COPY --from=base --chown=1000 /app/package.json /app/package.json
84
  COPY --from=base --chown=1000 /app/build /app/build
@@ -90,5 +55,7 @@ COPY --chown=1000 entrypoint.sh /app/entrypoint.sh
90
 
91
  RUN chmod +x /app/entrypoint.sh
92
 
93
- # entrypoint
94
- ENTRYPOINT [ "/app/entrypoint.sh" ]
 
 
 
1
  FROM ghcr.io/huggingface/chat-ui:latest AS base
2
 
3
+ FROM ghcr.io/huggingface/text-generation-inference:latest AS final
 
4
 
5
  ARG MODEL_NAME
6
  ENV MODEL_NAME=${MODEL_NAME}
7
 
8
+ ENV TZ=Europe/Paris
9
+ PORT=3000
10
+
11
+ mongo installation
12
+ RUN curl -fsSL https://www.mongodb.org/static/pgp/server-7.0.asc |
13
+ gpg -o /usr/share/keyrings/mongodb-server-7.0.gpg
14
+ --dearmor
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
 
16
  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
17
 
18
+ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends
19
+ mongodb-org &&
20
+ rm -rf /var/lib/apt/lists/*
21
 
22
+ node installation
23
  RUN curl -fsSL https://deb.nodesource.com/setup_20.x | /bin/bash -
24
 
25
+ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends
26
+ nodejs &&
27
+ rm -rf /var/lib/apt/lists/*
28
 
29
+ image setup
30
  RUN useradd -m -u 1000 user
31
 
32
  RUN mkdir /app
 
34
  RUN mkdir /data
35
  RUN chown -R 1000:1000 /data
36
 
37
+ Switch to the "user" user
38
  USER user
39
 
40
+ ENV HOME=/home/user
41
+ PATH=/home/user/.local/bin:$PATH
42
 
43
  RUN npm config set prefix /home/user/.local
44
  RUN npm install -g dotenv-cli
45
 
46
+ copy chat-ui from base image
47
  COPY --from=base --chown=1000 /app/node_modules /app/node_modules
48
  COPY --from=base --chown=1000 /app/package.json /app/package.json
49
  COPY --from=base --chown=1000 /app/build /app/build
 
55
 
56
  RUN chmod +x /app/entrypoint.sh
57
 
58
+ entrypoint
59
+ ENTRYPOINT [ "/app/entrypoint.sh" ]
60
+ (entrypoint)
61
+ #!/bin/bash