Spaces:
Runtime error
Runtime error
update Dockerfile
Browse files- Dockerfile +36 -48
Dockerfile
CHANGED
|
@@ -1,59 +1,47 @@
|
|
| 1 |
# HuggingFace Spaces Dockerfile for Overleaf with Japanese LaTeX
|
| 2 |
-
#
|
| 3 |
-
#
|
| 4 |
-
# - Full TeX Live 2025 with Japanese support
|
| 5 |
-
# - MongoDB 8.0 embedded
|
| 6 |
-
# - Redis embedded
|
| 7 |
-
# - Port 7860 (HF Spaces default)
|
| 8 |
-
# - Data persistence in /data
|
| 9 |
|
| 10 |
FROM fifof16/sharelatex-with-texlive-full:latest
|
| 11 |
|
| 12 |
-
# Create directories
|
| 13 |
RUN mkdir -p /data/{mongo,redis,overleaf,git-bridge} \
|
| 14 |
/var/log/{mongodb,redis} \
|
| 15 |
&& chmod -R 777 /data /var/log
|
| 16 |
|
| 17 |
-
# Fix all permissions
|
| 18 |
-
RUN chmod -R 777 /etc
|
| 19 |
-
|
| 20 |
-
#
|
| 21 |
-
RUN
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
#
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
echo "
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
# Start Redis
|
| 48 |
-
echo "Starting Redis..."
|
| 49 |
-
redis-server --daemonize yes --dir /data/redis --logfile /var/log/redis/redis.log 2>/dev/null || true
|
| 50 |
-
|
| 51 |
-
echo "Starting Overleaf..."
|
| 52 |
-
exec /sbin/my_init
|
| 53 |
-
EOF
|
| 54 |
-
|
| 55 |
-
RUN chmod +x /init.sh
|
| 56 |
|
| 57 |
EXPOSE 7860
|
| 58 |
|
| 59 |
-
|
|
|
|
|
|
|
|
|
| 1 |
# HuggingFace Spaces Dockerfile for Overleaf with Japanese LaTeX
|
| 2 |
+
#
|
| 3 |
+
# Key: Set correct MongoDB/Redis URLs BEFORE /sbin/my_init runs
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
FROM fifof16/sharelatex-with-texlive-full:latest
|
| 6 |
|
| 7 |
+
# Create directories
|
| 8 |
RUN mkdir -p /data/{mongo,redis,overleaf,git-bridge} \
|
| 9 |
/var/log/{mongodb,redis} \
|
| 10 |
&& chmod -R 777 /data /var/log
|
| 11 |
|
| 12 |
+
# Fix all permissions
|
| 13 |
+
RUN chmod -R 777 /etc 2>/dev/null || true
|
| 14 |
+
|
| 15 |
+
# Remove original check scripts - they use wrong hostnames
|
| 16 |
+
RUN rm -f /etc/my_init.d/500_check_db_access.sh 2>/dev/null || true
|
| 17 |
+
RUN rm -f /etc/my_init.d/500_check_mongo.sh 2>/dev/null || true
|
| 18 |
+
|
| 19 |
+
# Override environment BEFORE my_init runs (this is critical!)
|
| 20 |
+
# The container_environment files are sourced by /sbin/my_init
|
| 21 |
+
RUN mkdir -p /etc/container_environment
|
| 22 |
+
RUN echo "mongodb://127.0.0.1:27017/sharelatex" > /etc/container_environment/OVERLEAF_MONGO_URL
|
| 23 |
+
RUN echo "127.0.0.1" > /etc/container_environment/OVERLEAF_REDIS_HOST
|
| 24 |
+
RUN echo "6379" > /etc/container_environment/OVERLEAF_REDIS_PORT
|
| 25 |
+
RUN echo "0.0.0.0" > /etc/container_environment/OVERLEAF_LISTEN_IP
|
| 26 |
+
RUN echo "7860" > /etc/container_environment/OVERLEAF_PORT
|
| 27 |
+
|
| 28 |
+
RUN chmod 644 /etc/container_environment/OVERLEAF_*
|
| 29 |
+
|
| 30 |
+
# Also update /etc/overleaf/env.sh
|
| 31 |
+
RUN chown root:root /etc/overleaf/env.sh 2>/dev/null || true
|
| 32 |
+
RUN sed -i 's|dockerhost|127.0.0.1|g; s|mongod://|mongodb://127.0.0.1:|g' /etc/overleaf/env.sh 2>/dev/null || true
|
| 33 |
+
RUN echo "OVERLEAF_MONGO_URL=mongodb://127.0.0.1:27017/sharelatex" >> /etc/overleaf/env.sh
|
| 34 |
+
RUN echo "OVERLEAF_REDIS_HOST=127.0.0.1" >> /etc/overleaf/env.sh
|
| 35 |
+
RUN echo "OVERLEAF_REDIS_PORT=6379" >> /etc/overleaf/env.sh
|
| 36 |
+
RUN echo "OVERLEAF_LISTEN_IP=0.0.0.0" >> /etc/overleaf/env.sh
|
| 37 |
+
RUN echo "OVERLEAF_PORT=7860" >> /etc/overleaf/env.sh
|
| 38 |
+
RUN chmod 644 /etc/overleaf/env.sh
|
| 39 |
+
|
| 40 |
+
# Stay as root
|
| 41 |
+
USER root
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
|
| 43 |
EXPOSE 7860
|
| 44 |
|
| 45 |
+
# Run my_init directly - it will start MongoDB/Redis from their runit services
|
| 46 |
+
# and use our overridden environment variables
|
| 47 |
+
CMD ["/sbin/my_init"]
|