cloudpasteview / Dockerfile
dragg2's picture
Update Dockerfile
ffca0b3 verified
raw
history blame
1.96 kB
FROM yimik/kkfileview:latest
USER root
# 安装依赖
RUN apt-get update && apt-get install -y \
xvfb \
libxrender1 \
libxext6 \
&& rm -rf /var/lib/apt/lists/*
# 环境变量
ENV SERVER_PORT=7860
# 添加执行权限
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..." && \
sed -i '/trust.host/d' "$CONFIG_FILE" && \
echo "" >> "$CONFIG_FILE" && \
echo "# Trust all hosts for Hugging Face Spaces" >> "$CONFIG_FILE" && \
echo "trust.host = default" >> "$CONFIG_FILE" && \
echo "" >> "$CONFIG_FILE" && \
echo "# Port configuration" >> "$CONFIG_FILE" && \
echo "server.port = 7860" >> "$CONFIG_FILE" && \
echo "Configuration updated successfully" && \
tail -10 "$CONFIG_FILE"; \
else \
echo "ERROR: Config file not found at $CONFIG_FILE" && \
exit 1; \
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 ""' >> /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"]