nxdev-org commited on
Commit
b6b9470
·
verified ·
1 Parent(s): ce6e06f

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +27 -15
Dockerfile CHANGED
@@ -1,23 +1,35 @@
1
- # Use the community all-in-one image
2
  FROM shantanupatil01/overleaf-extended:latest
3
 
4
- # --- Updated Overleaf 5.0+ Configuration ---
5
 
6
- # 1. Force Overleaf to listen on port 7860 (Hugging Face requirement)
7
- ENV OVERLEAF_PORT=7860
8
-
9
- # 2. Ensure it binds to all interfaces for external access
10
- ENV OVERLEAF_LISTEN_IP=0.0.0.0
 
11
 
12
- # 3. Set the public URL (Rename this to match your actual Space URL)
13
- ENV OVERLEAF_SITE_URL=https://huggingface.co
 
14
 
15
- # 4. Database configuration (using the new prefix)
16
- ENV OVERLEAF_MONGO_URL=mongodb://localhost:27017/overleaf
17
- ENV OVERLEAF_REDIS_HOST=localhost
 
 
 
18
 
19
- # Hugging Face permissions (ensures non-root user can write data)
20
- RUN chmod -R 777 /var/lib/overleaf /var/log/overleaf
 
 
 
 
 
 
 
21
 
22
- # Expose the mandatory Hugging Face port
23
  EXPOSE 7860
 
 
 
 
1
  FROM shantanupatil01/overleaf-extended:latest
2
 
3
+ USER root
4
 
5
+ # 1. Install MongoDB 7.0 and Redis
6
+ RUN apt-get update && apt-get install -y wget gnupg curl \
7
+ && curl -fsSL https://mongodb.org | gpg --dearmor -o /usr/share/keyrings/mongodb-server-7.0.gpg \
8
+ && echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-7.0.gpg ] https://mongodb.org jammy/mongodb-org/7.0 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-7.0.list \
9
+ && apt-get update && apt-get install -y mongodb-org redis-server \
10
+ && rm -rf /var/lib/apt/lists/*
11
 
12
+ # 2. Create data directories and set permissions for Hugging Face
13
+ RUN mkdir -p /data/db /var/lib/redis /var/lib/overleaf /var/log/overleaf \
14
+ && chmod -R 777 /data/db /var/lib/redis /var/lib/overleaf /var/log/overleaf
15
 
16
+ # 3. Configure Overleaf to talk to LOCALHOST (since they share the container)
17
+ ENV OVERLEAF_PORT=7860
18
+ ENV OVERLEAF_LISTEN_IP=0.0.0.0
19
+ ENV OVERLEAF_MONGO_URL=mongodb://127.0.0.1:27017/overleaf
20
+ ENV OVERLEAF_REDIS_HOST=127.0.0.1
21
+ ENV OVERLEAF_REDIS_PORT=6379
22
 
23
+ # 4. Create a startup script to run all services
24
+ RUN echo '#!/bin/bash\n\
25
+ redis-server --daemonize yes\n\
26
+ mongod --fork --logpath /var/log/mongodb.log --dbpath /data/db --bind_ip 127.0.0.1\n\
27
+ # Wait for DBs to wake up\n\
28
+ sleep 5\n\
29
+ # Start Overleaf (using its internal init system)\n\
30
+ exec /sbin/my_init\n\
31
+ ' > /entrypoint.sh && chmod +x /entrypoint.sh
32
 
 
33
  EXPOSE 7860
34
+
35
+ ENTRYPOINT ["/entrypoint.sh"]