|
FROM ghcr.io/open-webui/open-webui:main |
|
|
|
|
|
RUN apt-get update && apt-get install -y python3 python3-pip --no-install-recommends && \ |
|
pip3 install --no-cache-dir huggingface_hub && \ |
|
apt-get clean && \ |
|
rm -rf /var/lib/apt/lists/* |
|
|
|
|
|
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 /app/sync_data.sh |
|
|
|
|
|
RUN echo '#!/bin/bash\n\ |
|
# 在后台启动备份进程\n\ |
|
if [ -f "/app/sync_data.sh" ]; then\n\ |
|
(nohup bash /app/sync_data.sh > /tmp/sync.log 2>&1 &)\n\ |
|
fi\n\ |
|
\n\ |
|
# 启动原始应用\n\ |
|
exec /app/start.sh "$@"\n\ |
|
' > /app/custom_start.sh && \ |
|
chmod +x /app/custom_start.sh |
|
|
|
|
|
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 /app/sync_data.sh |
|
|
|
|
|
ENTRYPOINT ["/app/custom_start.sh"] |
|
|