|
|
|
FROM ubuntu:20.04 |
|
|
|
|
|
RUN apt-get update && apt-get install -y \ |
|
postgresql \ |
|
curl \ |
|
wget \ |
|
gnupg \ |
|
lsb-release \ |
|
software-properties-common \ |
|
&& rm -rf /var/lib/apt/lists/* |
|
|
|
|
|
ENV POSTGRES_DB=mydatabase |
|
ENV POSTGRES_USER=myuser |
|
ENV POSTGRES_PASSWORD=mypassword |
|
ENV PGDATA=/var/lib/postgresql/data |
|
|
|
|
|
RUN mkdir -p /app/uploads/temp |
|
RUN mkdir -p /app/client/public/images/temp |
|
RUN mkdir -p /app/api/logs/ |
|
RUN mkdir -p /app/data |
|
RUN mkdir -p /app/rag_api |
|
|
|
|
|
RUN chmod -R 777 /app/uploads/temp |
|
RUN chmod -R 777 /app/client/public/images |
|
RUN chmod -R 777 /app/api/logs/ |
|
RUN chmod -R 777 /app/data |
|
|
|
|
|
RUN curl -o /app/librechat.yaml https://raw.githubusercontent.com/fuegovic/lc-config-yaml/main/librechat-rw.yaml |
|
|
|
|
|
RUN curl -fsSL https://deb.nodesource.com/setup_16.x | bash - \ |
|
&& apt-get install -y nodejs |
|
|
|
|
|
RUN git clone https://github.com/danny-avila/librechat-dev.git /app/librechat |
|
WORKDIR /app/librechat/api |
|
RUN npm install |
|
|
|
|
|
RUN 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.gz |
|
WORKDIR /app/rag_api |
|
RUN npm install |
|
|
|
|
|
RUN 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.sh |
|
|
|
RUN chmod +x /app/start-services.sh |
|
|
|
|
|
EXPOSE 3080 3081 |
|
|
|
|
|
CMD ["/bin/bash", "/app/start-services.sh"] |
|
|