Usha-532 commited on
Commit
0bb6d23
·
verified ·
1 Parent(s): 47f02ea

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +91 -50
Dockerfile CHANGED
@@ -1,61 +1,102 @@
1
- #Pull the base image
2
- FROM ghcr.io/danny-avila/librechat-dev:latest
 
3
 
 
 
 
 
 
 
 
 
 
4
 
5
- #FROM ghcr.io/danny-avila/librechat-dev:d3d7d11ea8cbeef9fdffa1eb45d6b866e6ee182b
 
 
 
 
 
 
 
 
 
 
6
 
 
 
 
7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
 
9
 
10
- # Set environment variables
11
- ENV HOST=0.0.0.0
12
- ENV PORT=7860
13
- ENV SESSION_EXPIRY=900000
14
- ENV REFRESH_TOKEN_EXPIRY=604800000
15
- # ENV MEILI_NO_ANALYTICS=true
16
- # ENV MEILI_HOST=https://librechat-meilisearch.hf.space
17
-
18
- # Create necessary directories
19
- RUN mkdir -p /app/uploads/temp
20
- RUN mkdir -p /app/client/public/images/temp
21
- RUN mkdir -p /app/api/logs/
22
- RUN mkdir -p /app/data
23
- RUN mkdir -p /app/code_interpreter
24
-
25
- # Give write permission to the directory
26
- RUN chmod -R 777 /app/uploads/temp
27
- RUN chmod -R 777 /app/client/public/images
28
- RUN chmod -R 777 /app/api/logs/
29
- RUN chmod -R 777 /app/data
30
- RUN chmod -R 777 /app/code_interpreter
31
-
32
- # RUN cd /app/packages/mcp/src/ && rm -rf manager.ts
33
-
34
- # Copy Custom Endpoints Config
35
- # RUN curl -o /app/librechat.yaml https://raw.githubusercontent.com/LibreChat-AI/librechat-config-yaml/main/librechat-hf.yaml
36
- COPY librechat.yaml /app/librechat.yaml
37
- COPY tests.py /app/tests.py
38
- COPY streamlit_app.py /app/streamlit_app.py
39
- COPY gradio_file.py /app/gradio_file.py
40
 
41
- # Install dependencies
42
- RUN cd /app/api && npm install
43
  USER root
44
- # COPY manager.ts /app/packages/mcp/src/manager.ts
45
-
46
- # Install Python and pip
47
- ENV PYTHONUNBUFFERED=1
48
- RUN apk add --update --no-cache python3-dev git py3-pip gcc libc-dev libc6-compat build-base mpc1-dev && ln -sf python3 /usr/bin/python
49
- # RUN apk --update --no-cache add python3~3.10 --repository=http://dl-cdn.alpinelinux.org/alpine/edge/main
50
- # RUN apk add --update --no-cache git gcc libc-dev libc6-compat build-base mpc1-dev && ln -sf python3 /usr/bin/python
51
 
52
- # RUN python3 -m ensurepip
 
53
 
54
- RUN pip3 install --no-cache --upgrade --break-system-packages pip setuptools mcp mcp-simple-pubmed mcp-simple-arxiv e2b-code-interpreter==1.0.4b litellm gradio XlsxWriter openpyxl google-genai requests-futures
55
- # RUN cd /app/packages && git clone --branch patch-1 https://github.com/vaibhavard/actors-mcp-server
56
- # RUN cd /app/packages/actors-mcp-server/ && npm install && npm run build && npm link
57
- # RUN git clone https://github.com/e2b-dev/mcp-server && cd mcp-server/packages/js/ && npm install && npm run build && npm link
58
- # to run on container start
59
- RUN git clone https://github.com/AIGENHACKER/mcp-hfspace && cd mcp-hfspace && npm install && npm run build && npm link
60
- RUN git clone https://github.com/exa-labs/exa-mcp-server && cd exa-mcp-server && npm install --save axios dotenv && npm run build && npm link
61
  CMD ["npm", "run", "backend"]
 
1
+ # Pull the base image
2
+ FROM vaibhavarduino/librechat:latest
3
+ # FROM librechat/librechat-dev:latest
4
 
5
+ # Set environment variables (Consider moving sensitive ones like ngrok token to build args or runtime envs)
6
+ ENV HOST=0.0.0.0 \
7
+ PORT=7860 \
8
+ SESSION_EXPIRY=900000 \
9
+ REFRESH_TOKEN_EXPIRY=604800000 \
10
+ # MEILI_NO_ANALYTICS=true \
11
+ # MEILI_HOST=https://librechat-meilisearch.hf.space \
12
+ PYTHONUNBUFFERED=1 \
13
+ NGROK_AUTHTOKEN=2vPTfcN3MOK2T12aE2fxtBzjxue_6ejqTQUkkWqZfRm2QAN49
14
 
15
+ # Combine directory creation and permission setting
16
+ RUN mkdir -p /app/uploads/temp \
17
+ /app/client/public/images/temp \
18
+ /app/api/logs/ \
19
+ /app/data \
20
+ /app/code_interpreter && \
21
+ chmod -R 777 /app/uploads/temp \
22
+ /app/client/public/images \
23
+ /app/api/logs/ \
24
+ /app/data \
25
+ /app/code_interpreter
26
 
27
+ # Copy configuration and tests
28
+ COPY librechat.yaml /app/librechat.yaml
29
+ COPY tests.py /app/tests.py
30
 
31
+ # --- Build Stage ---
32
+ # Temporarily switch to root for package installation
33
+ USER root
34
+ RUN sed -i 's/#\(.*\/community\)/\1/' /etc/apk/repositories
35
+ # Install Node.js dependencies first (leverages layer cache if package.json doesn't change often)
36
+ # Assuming package.json is in /app/api in the base image or copied before
37
+ # If not, uncomment and adjust COPY commands if needed:
38
+ # COPY api/package.json api/package-lock.json* ./api/
39
+ RUN cd /app/api && npm install --omit=dev --no-audit --no-fund --prefer-offline && npm cache clean --force
40
+ # Note: Using --omit=dev might break if runtime needs dev deps. Remove if necessary.
41
+ # --prefer-offline might help if network is slow/flaky, uses cache more aggressively.
42
+ # npm cache clean --force might free up a little space within the layer.
43
+ RUN wget https://bin.equinox.io/c/bNyj1mQVY4c/ngrok-v3-stable-linux-amd64.tgz -O ngrok.tgz && tar xvzf ngrok.tgz && cp ngrok /usr/local/bin && rm ngrok.tgz
44
+ # Install system dependencies (including build tools), Python packages, and cleanup in one RUN command
45
+ # Reduces layers and removes build tools afterwards
46
+ RUN apk add --no-cache --virtual .build-deps \
47
+ build-base \
48
+ gcc \
49
+ libc-dev \
50
+ mpc1-dev \
51
+ python3-dev && \
52
+ apk add --no-cache \
53
+ bash \
54
+ git \
55
+ expect \
56
+ busybox-suid \
57
+ libc6-compat \
58
+ py3-pip \
59
+ openjdk21 \
60
+ zlib-dev \
61
+ python3 && \
62
+ ln -sf python3 /usr/bin/python && \
63
+ # Consider specific versions if needed: python3~=3.10
64
+ echo "Starting pip install..." && \
65
+ pip3 install --no-cache-dir --upgrade --break-system-packages \
66
+ pip \
67
+ setuptools \
68
+ mcp \
69
+ mcp-simple-pubmed \
70
+ mcp-simple-arxiv \
71
+ mpxj \
72
+ jpype1 \
73
+ litellm==1.67.2 \
74
+ gradio \
75
+ XlsxWriter \
76
+ openpyxl \
77
+ google-genai \
78
+ matplotlib \
79
+ requests-futures \
80
+ pexpect && \
81
+ # (Add back commented packages here if needed, e.g., actors-mcp-server)
82
+ echo "Pip install finished. Cleaning up..." && \
83
+ apk del .build-deps && \
84
+ rm -rf /var/cache/apk/* /root/.cache /tmp/* && \
85
+ echo "Cleanup finished."
86
 
87
 
88
+ # RUN su root
89
+ USER root
90
+ WORKDIR /app
91
+ RUN git clone https://github.com/AIGENHACKER/mcp-hfspace && cd mcp-hfspace && npm install && npm run build && npm link
92
+ RUN git clone https://github.com/exa-labs/exa-mcp-server && cd exa-mcp-server && npm install --save axios dotenv && npm run build && npm link
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93
 
94
+ EXPOSE 7860
 
95
  USER root
96
+ RUN npm install -g express ejs chart.js && npm cache clean --force
 
 
 
 
 
 
97
 
98
+ USER node
99
+ RUN ngrok config add-authtoken 2vPTfcN3MOK2T12aE2fxtBzjxue_6ejqTQUkkWqZfRm2QAN49
100
 
101
+ USER root
 
 
 
 
 
 
102
  CMD ["npm", "run", "backend"]