chansung commited on
Commit
1cf582c
1 Parent(s): e11772a

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +4 -81
Dockerfile CHANGED
@@ -4,50 +4,6 @@ ARG MODEL_PROMPT_TEMPLATE
4
  ARG APP_COLOR
5
  ARG APP_NAME
6
 
7
-
8
- FROM node:20 as chatui-builder
9
- ARG MODEL_NAME
10
- ARG MODEL_PARAMS
11
- ARG APP_COLOR
12
- ARG APP_NAME
13
- ARG MODEL_PROMPT_TEMPLATE
14
-
15
- WORKDIR /app
16
-
17
- RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
18
- git gettext && \
19
- rm -rf /var/lib/apt/lists/*
20
-
21
-
22
- RUN git clone https://github.com/huggingface/chat-ui.git
23
-
24
- WORKDIR /app/chat-ui
25
-
26
-
27
- COPY .env.local.template .env.local.template
28
-
29
- RUN mkdir defaults
30
- ADD defaults /defaults
31
- RUN chmod -R 777 /defaults
32
- RUN --mount=type=secret,id=MONGODB_URL,mode=0444 \
33
- MODEL_NAME="${MODEL_NAME:="$(cat /defaults/MODEL_NAME)"}" && export MODEL_NAME \
34
- && MODEL_PARAMS="${MODEL_PARAMS:="$(cat /defaults/MODEL_PARAMS)"}" && export MODEL_PARAMS \
35
- && MODEL_PROMPT_TEMPLATE="${MODEL_PROMPT_TEMPLATE:="$(cat /defaults/MODEL_PROMPT_TEMPLATE)"}" && export MODEL_PROMPT_TEMPLATE \
36
- && APP_COLOR="${APP_COLOR:="$(cat /defaults/APP_COLOR)"}" && export APP_COLOR \
37
- && APP_NAME="${APP_NAME:="$(cat /defaults/APP_NAME)"}" && export APP_NAME \
38
- && MONGODB_URL=$(cat /run/secrets/MONGODB_URL > /dev/null | grep '^' || cat /defaults/MONGODB_URL) && export MONGODB_URL && \
39
- echo "${MONGODB_URL}" && \
40
- envsubst < ".env.local.template" > ".env.local" \
41
- && rm .env.local.template
42
-
43
-
44
-
45
- RUN --mount=type=cache,target=/app/.npm \
46
- npm set cache /app/.npm && \
47
- npm ci
48
-
49
- RUN npm run build
50
-
51
  FROM ghcr.io/huggingface/text-generation-inference:latest
52
 
53
  ARG MODEL_NAME
@@ -59,8 +15,6 @@ ARG APP_NAME
59
  ENV TZ=Europe/Paris \
60
  PORT=3000
61
 
62
-
63
-
64
  RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
65
  gnupg \
66
  curl \
@@ -72,38 +26,14 @@ RUN mkdir defaults
72
  ADD defaults /defaults
73
  RUN chmod -R 777 /defaults
74
 
75
- RUN --mount=type=secret,id=MONGODB_URL,mode=0444 \
76
- MODEL_NAME="${MODEL_NAME:="$(cat /defaults/MODEL_NAME)"}" && export MODEL_NAME \
77
  && MODEL_PARAMS="${MODEL_PARAMS:="$(cat /defaults/MODEL_PARAMS)"}" && export MODEL_PARAMS \
78
- && MODEL_PROMPT_TEMPLATE="${MODEL_PROMPT_TEMPLATE:="$(cat /defaults/MODEL_PROMPT_TEMPLATE)"}" && export MODEL_PROMPT_TEMPLATE \
79
- && APP_COLOR="${APP_COLOR:="$(cat /defaults/APP_COLOR)"}" && export APP_COLOR \
80
- && APP_NAME="${APP_NAME:="$(cat /defaults/APP_NAME)"}" && export APP_NAME \
81
- && MONGODB_URL=$(cat /run/secrets/MONGODB_URL > /dev/null | grep '^' || cat /defaults/MONGODB_URL) && export MONGODB_URL && \
82
  envsubst < "entrypoint.sh.template" > "entrypoint.sh" \
83
  && rm entrypoint.sh.template
84
 
85
-
86
- RUN curl -fsSL https://www.mongodb.org/static/pgp/server-7.0.asc | \
87
- gpg -o /usr/share/keyrings/mongodb-server-7.0.gpg \
88
- --dearmor
89
-
90
- 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
91
-
92
- RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
93
- mongodb-org && \
94
- rm -rf /var/lib/apt/lists/*
95
-
96
- RUN mkdir -p /data/db
97
- RUN chown -R 1000:1000 /data
98
-
99
- RUN curl -fsSL https://deb.nodesource.com/setup_20.x | /bin/bash -
100
-
101
- RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
102
- nodejs && \
103
- rm -rf /var/lib/apt/lists/*
104
-
105
- RUN mkdir /app
106
- RUN chown -R 1000:1000 /app
107
 
108
  RUN useradd -m -u 1000 user
109
 
@@ -113,13 +43,6 @@ USER user
113
  ENV HOME=/home/user \
114
  PATH=/home/user/.local/bin:$PATH
115
 
116
- RUN npm config set prefix /home/user/.local
117
- RUN npm install -g pm2
118
-
119
- COPY --from=chatui-builder --chown=1000 /app/chat-ui/node_modules /app/node_modules
120
- COPY --from=chatui-builder --chown=1000 /app/chat-ui/package.json /app/package.json
121
- COPY --from=chatui-builder --chown=1000 /app/chat-ui/build /app/build
122
-
123
  RUN pip install gradio
124
  COPY main.py main.py
125
 
 
4
  ARG APP_COLOR
5
  ARG APP_NAME
6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  FROM ghcr.io/huggingface/text-generation-inference:latest
8
 
9
  ARG MODEL_NAME
 
15
  ENV TZ=Europe/Paris \
16
  PORT=3000
17
 
 
 
18
  RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
19
  gnupg \
20
  curl \
 
26
  ADD defaults /defaults
27
  RUN chmod -R 777 /defaults
28
 
29
+ RUN MODEL_NAME="${MODEL_NAME:="$(cat /defaults/MODEL_NAME)"}" && export MODEL_NAME \
 
30
  && MODEL_PARAMS="${MODEL_PARAMS:="$(cat /defaults/MODEL_PARAMS)"}" && export MODEL_PARAMS \
31
+ && MODEL_PROMPT_TEMPLATE="${MODEL_PROMPT_TEMPLATE:="$(cat /defaults/MODEL_PROMPT_TEMPLATE)"}" && export MODEL_PROMPT_TEMPLATE && \
 
 
 
32
  envsubst < "entrypoint.sh.template" > "entrypoint.sh" \
33
  && rm entrypoint.sh.template
34
 
35
+ # RUN mkdir /app
36
+ # RUN chown -R 1000:1000 /app
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
 
38
  RUN useradd -m -u 1000 user
39
 
 
43
  ENV HOME=/home/user \
44
  PATH=/home/user/.local/bin:$PATH
45
 
 
 
 
 
 
 
 
46
  RUN pip install gradio
47
  COPY main.py main.py
48