Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +16 -25
Dockerfile
CHANGED
@@ -30,18 +30,20 @@ RUN mkdir defaults
|
|
30 |
ADD defaults /defaults
|
31 |
RUN chmod -R 777 /defaults
|
32 |
RUN --mount=type=secret,id=MONGODB_URL,mode=0444 \
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
&&
|
37 |
-
&&
|
38 |
-
&&
|
39 |
-
|
40 |
-
|
|
|
|
|
|
|
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
|
@@ -78,21 +80,9 @@ RUN --mount=type=secret,id=MONGODB_URL,mode=0444 \
|
|
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 |
-
&&
|
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 |
|
@@ -115,12 +105,13 @@ ENV HOME=/home/user \
|
|
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 |
ENTRYPOINT ["/bin/bash"]
|
124 |
-
CMD ["entrypoint.sh"]
|
125 |
-
|
126 |
-
|
|
|
30 |
ADD defaults /defaults
|
31 |
RUN chmod -R 777 /defaults
|
32 |
RUN --mount=type=secret,id=MONGODB_URL,mode=0444 \
|
33 |
+
--mount=type=secret,id=BASEURL,mode=0444 \
|
34 |
+
--mount=type=secret,id=HF_TOKEN,mode=0444 \
|
35 |
+
export MODEL_NAME="${MODEL_NAME:=$(cat /defaults/MODEL_NAME)}" \
|
36 |
+
&& export MODEL_PARAMS="${MODEL_PARAMS:=$(cat /defaults/MODEL_PARAMS)}" \
|
37 |
+
&& export MODEL_PROMPT_TEMPLATE="${MODEL_PROMPT_TEMPLATE:=$(cat /defaults/MODEL_PROMPT_TEMPLATE)}" \
|
38 |
+
&& export APP_COLOR="${APP_COLOR:=$(cat /defaults/APP_COLOR)}" \
|
39 |
+
&& export APP_NAME="${APP_NAME:=$(cat /defaults/APP_NAME)}" \
|
40 |
+
&& export MONGODB_URL=$(cat /run/secrets/MONGODB_URL | grep '^') \
|
41 |
+
&& export BASEURL=$(cat /run/secrets/BASEURL | grep '^') \
|
42 |
+
&& export HF_TOKEN=$(cat /run/secrets/HF_TOKEN | grep '^') \
|
43 |
+
&& envsubst < ".env.local.template" > ".env.local" \
|
44 |
&& rm .env.local.template
|
45 |
|
46 |
|
|
|
47 |
RUN --mount=type=cache,target=/app/.npm \
|
48 |
npm set cache /app/.npm && \
|
49 |
npm ci
|
|
|
80 |
&& MODEL_PROMPT_TEMPLATE="${MODEL_PROMPT_TEMPLATE:="$(cat /defaults/MODEL_PROMPT_TEMPLATE)"}" && export MODEL_PROMPT_TEMPLATE \
|
81 |
&& APP_COLOR="${APP_COLOR:="$(cat /defaults/APP_COLOR)"}" && export APP_COLOR \
|
82 |
&& APP_NAME="${APP_NAME:="$(cat /defaults/APP_NAME)"}" && export APP_NAME \
|
83 |
+
&& envsubst < "entrypoint.sh.template" > "entrypoint.sh" \
|
|
|
84 |
&& rm entrypoint.sh.template
|
85 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
RUN mkdir -p /data/db
|
87 |
RUN chown -R 1000:1000 /data
|
88 |
|
|
|
105 |
|
106 |
RUN npm config set prefix /home/user/.local
|
107 |
RUN npm install -g pm2
|
108 |
+
RUN npm install -g dotenv-cli
|
109 |
|
110 |
COPY --from=chatui-builder --chown=1000 /app/chat-ui/node_modules /app/node_modules
|
111 |
COPY --from=chatui-builder --chown=1000 /app/chat-ui/package.json /app/package.json
|
112 |
COPY --from=chatui-builder --chown=1000 /app/chat-ui/build /app/build
|
113 |
+
COPY --from=chatui-builder --chown=1000 /app/chat-ui/.env /app/.env
|
114 |
+
COPY --from=chatui-builder --chown=1000 /app/chat-ui/.env.local /app/.env.local
|
115 |
|
116 |
ENTRYPOINT ["/bin/bash"]
|
117 |
+
CMD ["entrypoint.sh"]
|
|
|
|