Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files11 unmodified lines12131415151617181819202119202122232425262728262729303132333435363738394041424344453334354647484950515253545556575859606162636465666768697071727374757677787911 unmodified lines fonts-wqy-zenhei \ && rm -rf /var/lib/apt/lists/*
# 设置端口# 设置端口和信任主机ENV SERVER_PORT=7860ENV TRUST_HOST=default
# 信任所有主机RUN sed -i 's/trust.host=.*/trust.host=default/g' \ /opt/kkFileView-4.1.0/config/application.properties || \ echo "trust.host=default" >> /opt/kkFileView-4.1.0/config/application.properties# 添加执行权限RUN chmod +x /opt/kkFileView-*/bin/*.sh
# 查找并修改配置文件RUN find /opt/kkFileView-* -name "application.properties" -type f -exec sed -i 's/trust.host=.*/trust.host=default/g' {} \; || \ find /opt/kkFileView-* -name "application.properties" -type f -exec sh -c 'echo "trust.host=default" >> {}' \;
# 创建启动脚本RUN printf '#!/bin/bash\n\echo "=== Starting kkFileView on Hugging Face Spaces ==="\n\echo "Trust host configuration:"\n\grep trust.host /opt/kkFileView-4.1.0/config/application.properties || echo "Not found"\n\echo "Port: $SERVER_PORT"\n\echo "Trust Host: $TRUST_HOST"\n\\n\# 查找配置文件并显示\n\CONFIG_FILE=$(find /opt/kkFileView-* -name "application.properties" -type f | head -n 1)\n\if [ -n "$CONFIG_FILE" ]; then\n\ echo "Config file: $CONFIG_FILE"\n\ echo "Trust host setting:"\n\ grep -i "trust.host" "$CONFIG_FILE" || echo "trust.host not found in config"\n\fi\n\\n\echo "Starting Xvfb..."\n\Xvfb :99 -screen 0 1024x768x24 -ac +extension GLX +render -noreset &\n\export DISPLAY=:99\n\sleep 3\n\\n\echo "Starting kkFileView..."\n\cd /opt/kkFileView-4.1.0\n\bin/startup.sh\n\tail -f log/kkFileView.log\n' > /start.sh && \KKVIEW_DIR=$(find /opt -maxdepth 1 -type d -name "kkFileView-*" | head -n 1)\n\if [ -z "$KKVIEW_DIR" ]; then\n\ echo "Error: kkFileView directory not found"\n\ exit 1\n\fi\n\\n\echo "kkFileView directory: $KKVIEW_DIR"\n\cd "$KKVIEW_DIR"\n\\n\# 使用绝对路径启动\n\if [ -f "$KKVIEW_DIR/bin/startup.sh" ]; then\n\ echo "Executing: $KKVIEW_DIR/bin/startup.sh"\n\ bash "$KKVIEW_DIR/bin/startup.sh"\n\else\n\ echo "Error: startup.sh not found at $KKVIEW_DIR/bin/startup.sh"\n\ ls -la "$KKVIEW_DIR/bin/"\n\ exit 1\n\fi\n\\n\# 等待服务启动\n\sleep 5\n\\n\# 查找并跟踪日志\n\LOG_FILE=$(find "$KKVIEW_DIR" -name "kkFileView.log" -o -name "*.log" | head -n 1)\n\if [ -n "$LOG_FILE" ]; then\n\ echo "Following log: $LOG_FILE"\n\ tail -f "$LOG_FILE"\n\else\n\ echo "Log file not found, keeping container alive..."\n\ sleep infinity\n\fi\n' > /start.sh && \ chmod +x /start.sh
EXPOSE 7860Dockerfile+51-10