Spaces:
Running
Running
| FROM yimik/kkfileview:latest | |
| USER root | |
| RUN apt-get update && apt-get install -y \ | |
| xvfb \ | |
| libxrender1 \ | |
| libxext6 \ | |
| libxi6 \ | |
| libgconf-2-4 \ | |
| fonts-wqy-microhei \ | |
| fonts-wqy-zenhei \ | |
| && rm -rf /var/lib/apt/lists/* | |
| ENV SERVER_PORT=7860 | |
| # 信任所有主机 | |
| 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 cat > /start.sh << 'EOF' | |
| #!/bin/bash | |
| set -e | |
| echo "=== Starting kkFileView on Hugging Face Spaces ===" | |
| echo "Trust host configuration:" | |
| grep trust.host /opt/kkFileView-4.1.0/config/application.properties || echo "Not found" | |
| # 启动虚拟显示 | |
| echo "Starting Xvfb..." | |
| Xvfb :99 -screen 0 1024x768x24 -ac +extension GLX +render -noreset & | |
| export DISPLAY=:99 | |
| sleep 3 | |
| # 启动 kkFileView | |
| echo "Starting kkFileView..." | |
| cd /opt/kkFileView-4.1.0 | |
| bin/startup.sh | |
| # 保持运行并显示日志 | |
| tail -f log/kkFileView.log | |
| EOF | |
| RUN chmod +x /start.sh | |
| EXPOSE 7860 | |
| CMD ["/start.sh"] | |