nxdev-org commited on
Commit
632c0d2
·
1 Parent(s): d7ca863

update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +25 -11
Dockerfile CHANGED
@@ -1,16 +1,34 @@
1
  # HuggingFace Spaces Dockerfile for Overleaf with Japanese LaTeX
2
  #
3
- # FIXED: MongoDB/Redis must start before migrations run
4
  #
5
  # Features:
6
  # - Full TeX Live 2025 with Japanese support
7
- # - MongoDB 8.0 embedded
8
- # - Redis embedded
9
  # - Port 7860
10
 
11
  FROM fifof16/sharelatex-with-texlive-full:latest
12
 
13
- # Create directories
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  RUN mkdir -p /data/{mongo,redis,overleaf,git-bridge} \
15
  /var/log/{mongodb,redis} \
16
  && chmod -R 777 /data /var/log
@@ -19,7 +37,7 @@ RUN mkdir -p /data/{mongo,redis,overleaf,git-bridge} \
19
  RUN chmod -R 777 /etc 2>/dev/null || true
20
 
21
  # ============================================
22
- # STEP 1: REMOVE DEFAULT MONGO CHECK SCRIPTS
23
  # ============================================
24
  RUN rm -f /etc/my_init.d/500_check_db_access.sh 2>/dev/null || true
25
  RUN rm -f /etc/my_init.d/500_check_mongo.sh 2>/dev/null || true
@@ -27,9 +45,8 @@ RUN rm -f /etc/runit/mongo 2>/dev/null || true
27
  RUN rm -f /etc/runit/redis 2>/dev/null || true
28
 
29
  # ============================================
30
- # STEP 2: CREATE CUSTOM INIT SCRIPT EARLY
31
  # ============================================
32
- # Run FIRST to start MongoDB before ANYTHING else
33
  RUN cat > /etc/my_init.d/00_start_services.sh << 'EOFSCRIPT'
34
  #!/bin/bash
35
  set -e
@@ -72,7 +89,7 @@ EOFSCRIPT
72
  RUN chmod +x /etc/my_init.d/00_start_services.sh
73
 
74
  # ============================================
75
- # STEP 3: SET ENVIRONMENT (critical for my_init)
76
  # ============================================
77
  RUN mkdir -p /etc/container_environment
78
  RUN printf "mongodb://127.0.0.1:27017/sharelatex" > /etc/container_environment/OVERLEAF_MONGO_URL
@@ -83,7 +100,6 @@ RUN printf "7860" > /etc/container_environment/OVERLEAF_PORT
83
 
84
  RUN chmod 644 /etc/container_environment/OVERLEAF_*
85
 
86
- # Also update /etc/overleaf/env.sh
87
  RUN printf "OVERLEAF_MONGO_URL=mongodb://127.0.0.1:27017/sharelatex\n" >> /etc/overleaf/env.sh
88
  RUN printf "OVERLEAF_REDIS_HOST=127.0.0.1\n" >> /etc/overleaf/env.sh
89
  RUN printf "OVERLEAF_REDIS_PORT=6379\n" >> /etc/overleaf/env.sh
@@ -91,10 +107,8 @@ RUN printf "OVERLEAF_LISTEN_IP=0.0.0.0\n" >> /etc/overleaf/env.sh
91
  RUN printf "OVERLEAF_PORT=7860\n" >> /etc/overleaf/env.sh
92
  RUN chmod 644 /etc/overleaf/env.sh
93
 
94
- # Stay as root
95
  USER root
96
 
97
  EXPOSE 7860
98
 
99
- # Run my_init - it will run 00_start_services.sh BEFORE migrations
100
  CMD ["/sbin/my_init"]
 
1
  # HuggingFace Spaces Dockerfile for Overleaf with Japanese LaTeX
2
  #
3
+ # FIXED: MongoDB not found - install it first!
4
  #
5
  # Features:
6
  # - Full TeX Live 2025 with Japanese support
7
+ # - MongoDB 8.0
8
+ # - Redis
9
  # - Port 7860
10
 
11
  FROM fifof16/sharelatex-with-texlive-full:latest
12
 
13
+ # ============================================
14
+ # STEP 1: INSTALL MONGODB
15
+ # ============================================
16
+ RUN apt-get update && apt-get install -y \
17
+ wget \
18
+ gnupg \
19
+ curl \
20
+ && rm -rf /var/lib/apt/lists/*
21
+
22
+ # Add MongoDB repository and install MongoDB 8.0
23
+ RUN wget -qO - https://www.mongodb.org/static/pgp/server-8.0.asc | apt-key add - \
24
+ && echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/8.0 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-8.0.list \
25
+ && apt-get update \
26
+ && apt-get install -y mongodb-org \
27
+ && rm -rf /var/lib/apt/lists/*
28
+
29
+ # ============================================
30
+ # STEP 2: CREATE DIRECTORIES
31
+ # ============================================
32
  RUN mkdir -p /data/{mongo,redis,overleaf,git-bridge} \
33
  /var/log/{mongodb,redis} \
34
  && chmod -R 777 /data /var/log
 
37
  RUN chmod -R 777 /etc 2>/dev/null || true
38
 
39
  # ============================================
40
+ # STEP 3: REMOVE DEFAULT MONGO CHECK SCRIPTS
41
  # ============================================
42
  RUN rm -f /etc/my_init.d/500_check_db_access.sh 2>/dev/null || true
43
  RUN rm -f /etc/my_init.d/500_check_mongo.sh 2>/dev/null || true
 
45
  RUN rm -f /etc/runit/redis 2>/dev/null || true
46
 
47
  # ============================================
48
+ # STEP 4: CREATE CUSTOM INIT SCRIPT
49
  # ============================================
 
50
  RUN cat > /etc/my_init.d/00_start_services.sh << 'EOFSCRIPT'
51
  #!/bin/bash
52
  set -e
 
89
  RUN chmod +x /etc/my_init.d/00_start_services.sh
90
 
91
  # ============================================
92
+ # STEP 5: SET ENVIRONMENT
93
  # ============================================
94
  RUN mkdir -p /etc/container_environment
95
  RUN printf "mongodb://127.0.0.1:27017/sharelatex" > /etc/container_environment/OVERLEAF_MONGO_URL
 
100
 
101
  RUN chmod 644 /etc/container_environment/OVERLEAF_*
102
 
 
103
  RUN printf "OVERLEAF_MONGO_URL=mongodb://127.0.0.1:27017/sharelatex\n" >> /etc/overleaf/env.sh
104
  RUN printf "OVERLEAF_REDIS_HOST=127.0.0.1\n" >> /etc/overleaf/env.sh
105
  RUN printf "OVERLEAF_REDIS_PORT=6379\n" >> /etc/overleaf/env.sh
 
107
  RUN printf "OVERLEAF_PORT=7860\n" >> /etc/overleaf/env.sh
108
  RUN chmod 644 /etc/overleaf/env.sh
109
 
 
110
  USER root
111
 
112
  EXPOSE 7860
113
 
 
114
  CMD ["/sbin/my_init"]