Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files12345679 unmodified lines1718191819202120212223242526272829303132333435361 unmodified line38394029414243323344454647484950515253545556575838395960616241636465456667484968697071725573FROM yimik/kkfileview:latest
FROM keking/kkfileview:4.1.0
USER root
# 安装依赖9 unmodified lines# 添加执行权限RUN chmod -R 755 /opt/kkFileView-*/bin/
# 修改配置文件RUN CONFIG_FILE="/opt/kkFileView-4.1.0/config/application.properties" && \ if [ -f "$CONFIG_FILE" ]; then \ echo "Modifying config file..." && \# 先查看目录结构,找到配置文件RUN echo "=== Searching for kkFileView installation ===" && \ ls -la /opt/ && \ echo "" && \ echo "=== Searching for config directory ===" && \ find /opt -type d -name "config" && \ echo "" && \ echo "=== Searching for application.properties ===" && \ find /opt -name "application.properties" -type f
# 自动查找并修改配置文件RUN CONFIG_FILE=$(find /opt -name "application.properties" -type f | head -n 1) && \ if [ -n "$CONFIG_FILE" ]; then \ echo "Found config file at: $CONFIG_FILE" && \ sed -i '/trust.host/d' "$CONFIG_FILE" && \ echo "" >> "$CONFIG_FILE" && \ echo "# Trust all hosts for Hugging Face Spaces" >> "$CONFIG_FILE" && \1 unmodified line echo "" >> "$CONFIG_FILE" && \ echo "# Port configuration" >> "$CONFIG_FILE" && \ echo "server.port = 7860" >> "$CONFIG_FILE" && \ echo "Configuration updated successfully" && \ echo "Configuration updated successfully:" && \ tail -10 "$CONFIG_FILE"; \ else \ echo "ERROR: Config file not found at $CONFIG_FILE" && \ exit 1; \ echo "WARNING: application.properties not found, will use environment variables" && \ echo "Creating config directory..." && \ mkdir -p /opt/kkFileView-4.1.0/config && \ cat > /opt/kkFileView-4.1.0/config/application.properties << 'EOFCONFIG' && \server.port = 7860trust.host = defaultcache.enabled = trueoffice.preview.switch.disabled = falseEOFCONFIG echo "Created new config file" && \ cat /opt/kkFileView-4.1.0/config/application.properties; \ fi
# 启动脚本RUN echo '#!/bin/bash' > /start.sh && \ echo 'echo "=== kkFileView Configuration ==="' >> /start.sh && \ echo 'grep -E "trust.host|server.port" /opt/kkFileView-4.1.0/config/application.properties || echo "Config not found"' >> /start.sh && \ echo 'echo "=== kkFileView Startup ==="' >> /start.sh && \ echo 'echo "Configuration:"' >> /start.sh && \ echo 'find /opt -name "application.properties" -exec cat {} \;' >> /start.sh && \ echo 'echo ""' >> /start.sh && \ echo 'echo "Starting Xvfb..."' >> /start.sh && \ echo 'Xvfb :99 -screen 0 1024x768x24 &' >> /start.sh && \ echo 'export DISPLAY=:99' >> /start.sh && \ echo 'sleep 2' >> /start.sh && \ echo 'echo "Starting kkFileView..."' >> /start.sh && \ echo 'cd /opt/kkFileView-4.1.0' >> /start.sh && \ echo 'bash /opt/kkFileView-4.1.0/bin/startup.sh' >> /start.sh && \ echo 'echo ""' >> /start.sh && \ echo 'echo "Service started. Access at: http://localhost:7860"' >> /start.sh && \ echo 'tail -f /opt/kkFileView-4.1.0/log/*.log' >> /start.sh && \ chmod +x /start.sh
EXPOSE 7860
CMD ["/start.sh"]CMD ["/start.sh"]Dockerfile+32-14