web / Dockerfile
nbugs's picture
Update Dockerfile
cef1ede verified
raw
history blame
1.17 kB
FROM ghcr.io/open-webui/open-webui:v0.6.0
RUN apt-get update && apt-get install -y python3 python3-pip
RUN pip3 install --no-cache-dir huggingface_hub
# 复制自定义文件
COPY custom.css /app/build/assets/
COPY custom.js /app/build/assets/
COPY editor.css /app/build/assets/
COPY editor.js /app/build/assets/
# 替换为优化版的备份脚本
COPY sync_data.sh /tmp/sync_data.sh
# 创建一个启动脚本
RUN echo '#!/bin/bash\n\
# 启动备份服务\n\
if [ -f "/tmp/sync_data.sh" ]; then\n\
bash /tmp/sync_data.sh &\n\
fi\n\
\n\
# 启动原始应用\n\
exec /app/start.sh "$@"\n\
' > /app/custom_start.sh && \
chmod +x /app/custom_start.sh
# 修改HTML引用
RUN sed -i 's|</head>|<link rel="stylesheet" href="assets/editor.css"></link><link rel="stylesheet" href="assets/custom.css"></link></head>|' /app/build/index.html && \
sed -i 's|</body>|<script src="assets/editor.js"></script><script src="assets/custom.js"></script></body>|' /app/build/index.html
# 设置权限
RUN chmod -R 777 ./data && \
chmod -R 777 /app/backend/open_webui/static && \
chmod +x /tmp/sync_data.sh
# 使用新的启动脚本
ENTRYPOINT ["/app/custom_start.sh"]