WebHub360 commited on
Commit
363a2d4
·
verified ·
1 Parent(s): 74dda0a

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +39 -42
Dockerfile CHANGED
@@ -1,66 +1,63 @@
1
- FROM ghcr.io/huggingface/chat-ui:latest AS base
2
 
3
- FROM ghcr.io/huggingface/text-generation-inference:1.2.0 AS final
 
4
 
5
  ARG MODEL_NAME=NousResearch/Hermes-3-Llama-3.1-8B
6
  ENV MODEL_NAME=${MODEL_NAME}
7
 
 
8
  ENV TZ=Europe/Paris \
 
9
  PORT=3000
10
 
11
- # Install Python dependencies directly (avoid using apt for Python)
12
- RUN pip install --no-cache-dir python-dotenv requests
13
 
14
- # Troubleshoot MongoDB installation issues
15
  RUN apt-get update && apt-get install -y --no-install-recommends \
16
- wget gnupg apt-utils && \
17
- apt-get clean && \
18
- rm -rf /var/lib/apt/lists/*
19
-
20
- # MongoDB installation with explicit version
21
- RUN wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | apt-key add - && \
22
- echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-6.0.list && \
23
- apt-get update && \
24
- apt-get install -y --no-install-recommends mongodb-org-server=6.0.11 mongodb-org-mongos=6.0.11 mongodb-org-shell=6.0.11 && \
25
- apt-get clean && \
26
- rm -rf /var/lib/apt/lists/*
27
-
28
- # node installation
29
- RUN curl -fsSL https://deb.nodesource.com/setup_20.x | /bin/bash -
30
-
31
- RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
32
- nodejs && \
33
- rm -rf /var/lib/apt/lists/*
34
-
35
- # image setup
36
  RUN useradd -m -u 1000 user
 
37
 
38
- RUN mkdir /app
39
- RUN chown -R 1000:1000 /app
40
- RUN mkdir /data
41
- RUN chown -R 1000:1000 /data
42
-
43
- # Switch to the "user" user
44
  USER user
45
-
46
  ENV HOME=/home/user \
47
  PATH=/home/user/.local/bin:$PATH
48
 
 
49
  RUN npm config set prefix /home/user/.local
50
  RUN npm install -g dotenv-cli
51
 
 
 
 
 
 
52
 
53
- # copy chat-ui from base image
54
- COPY --from=base --chown=1000 /app/node_modules /app/node_modules
55
- COPY --from=base --chown=1000 /app/package.json /app/package.json
56
- COPY --from=base --chown=1000 /app/build /app/build
57
-
58
- COPY --from=base --chown=1000 /app/.env /app/.env
59
  COPY --chown=1000 .env.local /app/.env.local
60
-
61
  COPY --chown=1000 entrypoint.sh /app/entrypoint.sh
62
-
63
  RUN chmod +x /app/entrypoint.sh
64
 
65
- # entrypoint
66
- ENTRYPOINT [ "/app/entrypoint.sh" ]
 
1
+ FROM ghcr.io/huggingface/chat-ui:latest AS chat-ui
2
 
3
+ # Start with NVIDIA CUDA image for GPU support
4
+ FROM nvidia/cuda:12.1.0-runtime-ubuntu22.04
5
 
6
  ARG MODEL_NAME=NousResearch/Hermes-3-Llama-3.1-8B
7
  ENV MODEL_NAME=${MODEL_NAME}
8
 
9
+ # Set timezone non-interactively
10
  ENV TZ=Europe/Paris \
11
+ DEBIAN_FRONTEND=noninteractive \
12
  PORT=3000
13
 
14
+ # Pre-set timezone to avoid prompts
15
+ RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
16
 
17
+ # Install system dependencies
18
  RUN apt-get update && apt-get install -y --no-install-recommends \
19
+ curl \
20
+ wget \
21
+ gnupg \
22
+ git \
23
+ ca-certificates \
24
+ python3 \
25
+ python3-pip \
26
+ python3-setuptools \
27
+ && rm -rf /var/lib/apt/lists/*
28
+
29
+ # Install Node.js
30
+ RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
31
+ && apt-get update \
32
+ && apt-get install -y --no-install-recommends nodejs \
33
+ && rm -rf /var/lib/apt/lists/*
34
+
35
+ # Install text-generation-inference
36
+ RUN pip install --no-cache-dir "text-generation-inference>=1.4.0"
37
+
38
+ # Setup for chat-ui
39
  RUN useradd -m -u 1000 user
40
+ RUN mkdir -p /app && chown -R 1000:1000 /app
41
 
42
+ # Switch to user
 
 
 
 
 
43
  USER user
 
44
  ENV HOME=/home/user \
45
  PATH=/home/user/.local/bin:$PATH
46
 
47
+ # Install dotenv-cli
48
  RUN npm config set prefix /home/user/.local
49
  RUN npm install -g dotenv-cli
50
 
51
+ # Copy chat-ui from base image
52
+ COPY --from=chat-ui --chown=1000 /app/node_modules /app/node_modules
53
+ COPY --from=chat-ui --chown=1000 /app/package.json /app/package.json
54
+ COPY --from=chat-ui --chown=1000 /app/build /app/build
55
+ COPY --from=chat-ui --chown=1000 /app/.env /app/.env
56
 
57
+ # Copy configuration files
 
 
 
 
 
58
  COPY --chown=1000 .env.local /app/.env.local
 
59
  COPY --chown=1000 entrypoint.sh /app/entrypoint.sh
 
60
  RUN chmod +x /app/entrypoint.sh
61
 
62
+ # Entrypoint
63
+ ENTRYPOINT ["/app/entrypoint.sh"]