nsarrazin HF staff commited on
Commit
29bbaa5
1 Parent(s): 655fa05
Files changed (2) hide show
  1. Dockerfile +13 -7
  2. inject.sh +0 -7
Dockerfile CHANGED
@@ -13,17 +13,20 @@ WORKDIR /app/chat-ui
13
 
14
 
15
  COPY .template.env.local .template.env.local
16
- COPY --chmod=777 inject.sh inject.sh
17
  RUN mkdir defaults
18
  ADD defaults /defaults
19
  RUN chmod -R 777 /defaults
20
-
21
  RUN --mount=type=secret,id=MODEL_NAME,mode=0444 \
22
  --mount=type=secret,id=MODEL_PARAMS,mode=0444 \
23
  --mount=type=secret,id=MONGODB_URL,mode=0444 \
24
  --mount=type=secret,id=APP_COLOR,mode=0444 \
25
  --mount=type=secret,id=APP_NAME,mode=0444 \
26
- ./inject.sh \
 
 
 
 
27
  && envsubst < ".template.env.local" > ".env.local"
28
 
29
 
@@ -39,21 +42,24 @@ FROM ghcr.io/huggingface/text-generation-inference:latest
39
  ENV TZ=Europe/Paris \
40
  PORT=3000
41
 
42
-
43
  COPY entrypoint.sh.template entrypoint.sh.template
44
- COPY --chmod=777 inject.sh inject.sh
45
  RUN mkdir defaults
46
  ADD defaults /defaults
47
  RUN chmod -R 777 /defaults
48
-
49
  RUN --mount=type=secret,id=MODEL_NAME,mode=0444 \
50
  --mount=type=secret,id=MODEL_PARAMS,mode=0444 \
51
  --mount=type=secret,id=MONGODB_URL,mode=0444 \
52
  --mount=type=secret,id=APP_COLOR,mode=0444 \
53
  --mount=type=secret,id=APP_NAME,mode=0444 \
54
- ./inject.sh \
 
 
 
 
55
  && envsubst < "entrypoint.sh.template" > "entrypoint.sh"
56
 
 
57
  RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
58
  gnupg \
59
  curl && \
 
13
 
14
 
15
  COPY .template.env.local .template.env.local
16
+
17
  RUN mkdir defaults
18
  ADD defaults /defaults
19
  RUN chmod -R 777 /defaults
 
20
  RUN --mount=type=secret,id=MODEL_NAME,mode=0444 \
21
  --mount=type=secret,id=MODEL_PARAMS,mode=0444 \
22
  --mount=type=secret,id=MONGODB_URL,mode=0444 \
23
  --mount=type=secret,id=APP_COLOR,mode=0444 \
24
  --mount=type=secret,id=APP_NAME,mode=0444 \
25
+ MODEL_NAME=$(cat /run/secrets/MODEL_NAME 2> /dev/null | grep '^' || cat /defaults/MODEL_NAME) && export MODEL_NAME \
26
+ && MODEL_PARAMS=$(cat /run/secrets/MODEL_PARAMS 2> /dev/null | grep '^' ||cat /defaults/MODEL_PARAMS) && export MODEL_PARAMS \
27
+ && MONGODB_URL=$(cat /run/secrets/MONGODB_URL 2> /dev/null | grep '^' || cat /defaults/MONGODB_URL) && export MONGODB_URL \
28
+ && APP_COLOR=$(cat /run/secrets/APP_COLOR 2> /dev/null | grep '^' || cat /defaults/APP_COLOR) && export APP_COLOR \
29
+ && APP_NAME=$(cat /run/secrets/APP_NAME 2> /dev/null | grep '^' || cat /defaults/APP_NAME) && export APP_NAME \
30
  && envsubst < ".template.env.local" > ".env.local"
31
 
32
 
 
42
  ENV TZ=Europe/Paris \
43
  PORT=3000
44
 
 
45
  COPY entrypoint.sh.template entrypoint.sh.template
46
+
47
  RUN mkdir defaults
48
  ADD defaults /defaults
49
  RUN chmod -R 777 /defaults
 
50
  RUN --mount=type=secret,id=MODEL_NAME,mode=0444 \
51
  --mount=type=secret,id=MODEL_PARAMS,mode=0444 \
52
  --mount=type=secret,id=MONGODB_URL,mode=0444 \
53
  --mount=type=secret,id=APP_COLOR,mode=0444 \
54
  --mount=type=secret,id=APP_NAME,mode=0444 \
55
+ MODEL_NAME=$(cat /run/secrets/MODEL_NAME 2> /dev/null | grep '^' || cat /defaults/MODEL_NAME) && export MODEL_NAME \
56
+ && MODEL_PARAMS=$(cat /run/secrets/MODEL_PARAMS 2> /dev/null | grep '^' ||cat /defaults/MODEL_PARAMS) && export MODEL_PARAMS \
57
+ && MONGODB_URL=$(cat /run/secrets/MONGODB_URL 2> /dev/null | grep '^' || cat /defaults/MONGODB_URL) && export MONGODB_URL \
58
+ && APP_COLOR=$(cat /run/secrets/APP_COLOR 2> /dev/null | grep '^' || cat /defaults/APP_COLOR) && export APP_COLOR \
59
+ && APP_NAME=$(cat /run/secrets/APP_NAME 2> /dev/null | grep '^' || cat /defaults/APP_NAME) && export APP_NAME \
60
  && envsubst < "entrypoint.sh.template" > "entrypoint.sh"
61
 
62
+
63
  RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
64
  gnupg \
65
  curl && \
inject.sh DELETED
@@ -1,7 +0,0 @@
1
- #!/bin/bash
2
- MODEL_NAME=$(cat /run/secrets/MODEL_NAME 2> /dev/null | grep '^' || cat /defaults/MODEL_NAME)
3
- MODEL_PARAMS=$(cat /run/secrets/MODEL_PARAMS 2> /dev/null | grep '^' ||cat /defaults/MODEL_PARAMS)
4
- MONGODB_URL=$(cat /run/secrets/MONGODB_URL 2> /dev/null | grep '^' || cat /defaults/MONGODB_URL)
5
- APP_COLOR=$(cat /run/secrets/APP_COLOR 2> /dev/null | grep '^' || cat /defaults/APP_COLOR)
6
- APP_NAME=$(cat /run/secrets/APP_NAME 2> /dev/null | grep '^' || cat /defaults/APP_NAME)
7
- $*