Spaces:
Running
Running
File size: 3,633 Bytes
d8913ed 1afc99f d8913ed ece0691 d8913ed ca59b57 70e0304 d8913ed 009b841 a7890d8 d8913ed 5efefc7 d8913ed b7d063d 9828d6f 54c124a d8913ed d81b2f1 d8913ed d81b2f1 80fb6e4 d8913ed 877c479 e60d88a d8913ed 001d086 6175d63 ce0723a fb04ff4 d81b2f1 d8913ed 91a7855 808c7fb 001d086 91a7855 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# Pull the base image
FROM vaibhavarduino/librechat:latest
# FROM librechat/librechat-dev:latest
# Set environment variables (Consider moving sensitive ones like ngrok token to build args or runtime envs)
ENV HOST=0.0.0.0 \
PORT=7860 \
SESSION_EXPIRY=900000 \
REFRESH_TOKEN_EXPIRY=604800000 \
# MEILI_NO_ANALYTICS=true \
# MEILI_HOST=https://librechat-meilisearch.hf.space \
PYTHONUNBUFFERED=1 \
NGROK_AUTHTOKEN=2vPTfcN3MOK2T12aE2fxtBzjxue_6ejqTQUkkWqZfRm2QAN49
# Combine directory creation and permission setting
RUN mkdir -p /app/uploads/temp \
/app/client/public/images/temp \
/app/api/logs/ \
/app/data \
/app/code_interpreter && \
chmod -R 777 /app/uploads/temp \
/app/client/public/images \
/app/api/logs/ \
/app/data \
/app/code_interpreter
# Copy configuration and tests
COPY librechat.yaml /app/librechat.yaml
COPY tests.py /app/tests.py
# --- Build Stage ---
# Temporarily switch to root for package installation
USER root
RUN sed -i 's/#\(.*\/community\)/\1/' /etc/apk/repositories
# Install Node.js dependencies first (leverages layer cache if package.json doesn't change often)
# Assuming package.json is in /app/api in the base image or copied before
# If not, uncomment and adjust COPY commands if needed:
# COPY api/package.json api/package-lock.json* ./api/
RUN cd /app/api && npm install --omit=dev --no-audit --no-fund --prefer-offline && npm cache clean --force
# Note: Using --omit=dev might break if runtime needs dev deps. Remove if necessary.
# --prefer-offline might help if network is slow/flaky, uses cache more aggressively.
# npm cache clean --force might free up a little space within the layer.
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
# Install system dependencies (including build tools), Python packages, and cleanup in one RUN command
# Reduces layers and removes build tools afterwards
RUN apk add --no-cache --virtual .build-deps \
build-base \
gcc \
libc-dev \
mpc1-dev \
python3-dev && \
apk add --no-cache \
bash \
git \
expect \
busybox-suid \
libc6-compat \
py3-pip \
openjdk21 \
zlib-dev \
python3 && \
ln -sf python3 /usr/bin/python && \
# Consider specific versions if needed: python3~=3.10
echo "Starting pip install..." && \
pip3 install --no-cache-dir --upgrade --break-system-packages \
pip \
setuptools \
mcp \
mcp-simple-pubmed \
mcp-simple-arxiv \
mpxj \
jpype1 \
litellm==1.67.2 \
gradio \
XlsxWriter \
openpyxl \
google-genai \
matplotlib \
requests-futures \
pexpect && \
# (Add back commented packages here if needed, e.g., actors-mcp-server)
echo "Pip install finished. Cleaning up..." && \
apk del .build-deps && \
rm -rf /var/cache/apk/* /root/.cache /tmp/* && \
echo "Cleanup finished."
# RUN su root
USER root
WORKDIR /app
RUN git clone https://github.com/AIGENHACKER/mcp-hfspace && cd mcp-hfspace && npm install && npm run build && npm link
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
EXPOSE 7860
USER root
RUN npm install -g express ejs chart.js && npm cache clean --force
USER node
RUN ngrok config add-authtoken 2vPTfcN3MOK2T12aE2fxtBzjxue_6ejqTQUkkWqZfRm2QAN49
USER root
CMD ["npm", "run", "backend"] |