Update Dockerfile
Browse files1234567891011121314151617181920212223241 unmodified line2627282930313233343536373839404142434445464748495051525354FROM ghcr.io/danny-avila/librechat-dev:latest# Set environment variables for librechatENV HOST=0.0.0.0ENV PORT=3080ENV SESSION_EXPIRY=900000ENV REFRESH_TOKEN_EXPIRY=604800000# Uncomment the following ENV to enable search# Feel free to clone our meilisearch space and update the URL with your own# ENV SEARCH=true# ENV MEILI_NO_ANALYTICS=true# ENV MEILI_HOST=https://librechat-meilisearch.hf.space# ENV MEILI_HTTP_ADDR=https://librechat-meilisearch.hf.space# Create necessary directoriesRUN mkdir -p /app/uploads/tempRUN mkdir -p /app/client/public/images/tempRUN mkdir -p /app/api/logs/RUN mkdir -p /app/data# Give write permission to the directoryRUN chmod -R 777 /app/uploads/temp1 unmodified lineRUN chmod -R 777 /app/api/logs/RUN chmod -R 777 /app/data# Copy Custom Endpoints ConfigRUN curl -o /app/librechat.yaml https://raw.githubusercontent.com/fuegovic/lc-config-yaml/main/librechat-rw.yaml# COPY librechat.yaml /app/librechat.yaml # Uncomment this and comment out the previous line to use the local librechat.yaml# Install dependenciesRUN cd /app/api && npm install# Add rag_apiRUN curl -Lo /app/rag_api.tar.gz https://github.com/danny-avila/librechat-rag-api-dev/archive/refs/heads/main.tar.gz \&& tar -xzvf /app/rag_api.tar.gz -C /app/ \&& rm /app/rag_api.tar.gz \&& mv /app/librechat-rag-api-dev-main /app/rag_api# Install dependencies for rag_apiRUN cd /app/rag_api && npm install# Create a script to start both servicesRUN echo '#!/bin/bash\n\cd /app/api && npm run backend &\n\cd /app/rag_api && npm start &\n\wait' > /app/start-services.shRUN chmod +x /app/start-services.sh# Command to run on container startCMD ["/bin/bash", "/app/start-services.sh"]123456789101112131415161718192021222324252627281 unmodified line30313233343536373839404142434445464748495051525354555657585960616263646566676869707172# Start with a base image that supports multiple servicesFROM ubuntu:20.04# Install dependenciesRUN apt-get update && apt-get install -y \postgresql \curl \wget \gnupg \lsb-release \software-properties-common \&& rm -rf /var/lib/apt/lists/*# Set environment variables for PostgreSQLENV POSTGRES_DB=mydatabaseENV POSTGRES_USER=myuserENV POSTGRES_PASSWORD=mypasswordENV PGDATA=/var/lib/postgresql/data# Create necessary directoriesRUN mkdir -p /app/uploads/tempRUN mkdir -p /app/client/public/images/tempRUN mkdir -p /app/api/logs/RUN mkdir -p /app/dataRUN mkdir -p /app/rag_api# Give write permission to the directoryRUN chmod -R 777 /app/uploads/temp1 unmodified lineRUN chmod -R 777 /app/api/logs/RUN chmod -R 777 /app/data# Copy Custom Endpoints Config for LibreChatRUN curl -o /app/librechat.yaml https://raw.githubusercontent.com/fuegovic/lc-config-yaml/main/librechat-rw.yaml# Install Node.js and npmRUN curl -fsSL https://deb.nodesource.com/setup_16.x | bash - \&& apt-get install -y nodejs# Clone and set up librechatRUN git clone https://github.com/danny-avila/librechat-dev.git /app/librechatWORKDIR /app/librechat/apiRUN npm install# Clone and set up rag_apiRUN curl -Lo /app/rag_api.tar.gz https://github.com/danny-avila/librechat-rag-api-dev/archive/refs/heads/main.tar.gz \&& tar -xzvf /app/rag_api.tar.gz -C /app/rag_api --strip-components=1 \&& rm /app/rag_api.tar.gzWORKDIR /app/rag_apiRUN npm install# Create a script to start all servicesRUN echo '#!/bin/bash\n\# Start PostgreSQL service\n\/etc/init.d/postgresql start\n\# Configure PostgreSQL\n\su postgres -c "psql --command \\"CREATE DATABASE $POSTGRES_DB;\\""\n\su postgres -c "psql --command \\"CREATE USER $POSTGRES_USER WITH PASSWORD \x27$POSTGRES_PASSWORD\x27;\\""\n\su postgres -c "psql --command \\"GRANT ALL PRIVILEGES ON DATABASE $POSTGRES_DB TO $POSTGRES_USER;\\""\n\# Start librechat\n\cd /app/librechat/api && npm run backend &\n\# Start rag_api\n\cd /app/rag_api && DB_HOST=localhost DB_PORT=5432 POSTGRES_DB=$POSTGRES_DB POSTGRES_USER=$POSTGRES_USER POSTGRES_PASSWORD=$POSTGRES_PASSWORD npm start &\n\wait' > /app/start-services.shRUN chmod +x /app/start-services.sh# Expose the ports for librechat and rag_apiEXPOSE 3080 3081# Command to run on container startCMD ["/bin/bash", "/app/start-services.sh"]
Dockerfile+45-27