eggacheb commited on
Commit
576d05a
·
verified ·
1 Parent(s): df1a817

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +19 -53
Dockerfile CHANGED
@@ -1,28 +1,25 @@
1
- # Start with a base image that supports multiple services
2
- FROM ubuntu:20.04
3
 
4
- # Install dependencies
5
- RUN apt-get update && apt-get install -y \
6
- postgresql \
7
- curl \
8
- wget \
9
- gnupg \
10
- lsb-release \
11
- software-properties-common \
12
- && rm -rf /var/lib/apt/lists/*
13
 
14
- # Set environment variables for PostgreSQL
15
- ENV POSTGRES_DB=mydatabase
16
- ENV POSTGRES_USER=myuser
17
- ENV POSTGRES_PASSWORD=mypassword
18
- ENV PGDATA=/var/lib/postgresql/data
19
 
20
  # Create necessary directories
21
  RUN mkdir -p /app/uploads/temp
22
  RUN mkdir -p /app/client/public/images/temp
23
  RUN mkdir -p /app/api/logs/
24
  RUN mkdir -p /app/data
25
- RUN mkdir -p /app/rag_api
26
 
27
  # Give write permission to the directory
28
  RUN chmod -R 777 /app/uploads/temp
@@ -30,43 +27,12 @@ RUN chmod -R 777 /app/client/public/images
30
  RUN chmod -R 777 /app/api/logs/
31
  RUN chmod -R 777 /app/data
32
 
33
- # Copy Custom Endpoints Config for LibreChat
34
  RUN curl -o /app/librechat.yaml https://raw.githubusercontent.com/fuegovic/lc-config-yaml/main/librechat-rw.yaml
 
35
 
36
- # Install Node.js and npm
37
- RUN curl -fsSL https://deb.nodesource.com/setup_16.x | bash - \
38
- && apt-get install -y nodejs
39
-
40
- # Clone and set up librechat
41
- RUN git clone https://github.com/danny-avila/librechat-dev.git /app/librechat
42
- WORKDIR /app/librechat/api
43
- RUN npm install
44
-
45
- # Clone and set up rag_api
46
- RUN curl -Lo /app/rag_api.tar.gz https://github.com/danny-avila/librechat-rag-api-dev/archive/refs/heads/main.tar.gz \
47
- && tar -xzvf /app/rag_api.tar.gz -C /app/rag_api --strip-components=1 \
48
- && rm /app/rag_api.tar.gz
49
- WORKDIR /app/rag_api
50
- RUN npm install
51
-
52
- # Create a script to start all services
53
- RUN echo '#!/bin/bash\n\
54
- # Start PostgreSQL service\n\
55
- /etc/init.d/postgresql start\n\
56
- # Configure PostgreSQL\n\
57
- su postgres -c "psql --command \\"CREATE DATABASE $POSTGRES_DB;\\""\n\
58
- su postgres -c "psql --command \\"CREATE USER $POSTGRES_USER WITH PASSWORD \x27$POSTGRES_PASSWORD\x27;\\""\n\
59
- su postgres -c "psql --command \\"GRANT ALL PRIVILEGES ON DATABASE $POSTGRES_DB TO $POSTGRES_USER;\\""\n\
60
- # Start librechat\n\
61
- cd /app/librechat/api && npm run backend &\n\
62
- # Start rag_api\n\
63
- 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\
64
- wait' > /app/start-services.sh
65
-
66
- RUN chmod +x /app/start-services.sh
67
-
68
- # Expose the ports for librechat and rag_api
69
- EXPOSE 3080 3081
70
 
71
  # Command to run on container start
72
- CMD ["/bin/bash", "/app/start-services.sh"]
 
1
+ FROM ghcr.io/danny-avila/librechat-dev:latest
2
+ EXPOSE 3080
3
 
4
+ # Set environment variables
5
+ ENV HOST=0.0.0.0
6
+ ENV PORT=3080
7
+ ENV SESSION_EXPIRY=900000
8
+ ENV REFRESH_TOKEN_EXPIRY=604800000
9
+
10
+ # Uncomment the following ENV to enable search
11
+ # Feel free to clone our meilisearch space and update the URL with your own
 
12
 
13
+ # ENV SEARCH=true
14
+ # ENV MEILI_NO_ANALYTICS=true
15
+ # ENV MEILI_HOST=https://librechat-meilisearch.hf.space
16
+ # ENV MEILI_HTTP_ADDR=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
 
24
  # Give write permission to the directory
25
  RUN chmod -R 777 /app/uploads/temp
 
27
  RUN chmod -R 777 /app/api/logs/
28
  RUN chmod -R 777 /app/data
29
 
30
+ # Copy Custom Endpoints Config
31
  RUN curl -o /app/librechat.yaml https://raw.githubusercontent.com/fuegovic/lc-config-yaml/main/librechat-rw.yaml
32
+ # COPY librechat.yaml /app/librechat.yaml # Uncomment this and comment out the previous line to use the local librechat.yaml
33
 
34
+ # Install dependencies
35
+ RUN cd /app/api && npm install
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
 
37
  # Command to run on container start
38
+ CMD ["npm", "run", "backend"]