wynai commited on
Commit
cbe4796
·
verified ·
1 Parent(s): d3957f7

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +28 -22
Dockerfile CHANGED
@@ -1,30 +1,36 @@
1
- FROM ghcr.io/open-webui/open-webui:main
2
 
3
- ENV PORT=7860
4
- ENV HOST=0.0.0.0
5
 
6
- USER root
7
-
8
- # Sao chép các file cần thiết
9
- COPY sync_webuidb.sh /app/sync_webuidb.sh
10
  COPY requirements.txt /app/requirements.txt
 
11
  COPY icon.png /app/icon.png
12
 
13
- # Cấp quyền cài requirements
14
- RUN chmod -R 777 /app && \
15
- chmod +x /app/sync_webuidb.sh && \
16
- pip install --no-cache-dir -r /app/requirements.txt || true
17
-
18
- # Ghi đè tất cả icon trong open_webui/static bằng icon.png từ gốc
19
- RUN for file in /app/open_webui/static/*.png; do \
20
- [ "$file" != "/app/icon.png" ] && cp /app/icon.png "$file"; \
21
- done && \
22
- for svg in /app/open_webui/static/*.svg; do \
23
- png="${svg%.svg}.png"; \
24
- [ "$png" != "/app/icon.png" ] && cp /app/icon.png "$png"; \
 
 
 
 
 
 
 
25
  done
26
 
27
- EXPOSE 7860
 
 
 
 
28
 
29
- # Chạy song song script server
30
- CMD bash -c "/app/sync_webuidb.sh & ./start.sh"
 
1
+ FROM python:3.11-slim
2
 
3
+ WORKDIR /app
 
4
 
 
 
 
 
5
  COPY requirements.txt /app/requirements.txt
6
+ COPY sync_webuidb.sh /app/sync_webuidb.sh
7
  COPY icon.png /app/icon.png
8
 
9
+ RUN apt-get update && apt-get install -y build-essential git curl findutils \
10
+ && rm -rf /var/lib/apt/lists/* \
11
+ && pip install --no-cache-dir -r requirements.txt \
12
+ && chmod +x /app/sync_webuidb.sh \
13
+ && chmod -R 777 /app && \
14
+ # Tìm tất cả static folder trong site-packages/backend/open_webui
15
+ for STATIC_DIR in $(find /usr/local/lib/python3.11/site-packages -type d -path "*/backend/open_webui/static"); do \
16
+ echo "Patching icons in: $STATIC_DIR"; \
17
+ if ls "$STATIC_DIR"/*.png 1>/dev/null 2>&1; then \
18
+ for file in "$STATIC_DIR"/*.png; do \
19
+ [ "$file" != "/app/icon.png" ] && cp /app/icon.png "$file"; \
20
+ done; \
21
+ fi; \
22
+ if ls "$STATIC_DIR"/*.svg 1>/dev/null 2>&1; then \
23
+ for svg in "$STATIC_DIR"/*.svg; do \
24
+ png="${svg%.svg}.png"; \
25
+ [ "$png" != "/app/icon.png" ] && cp /app/icon.png "$png"; \
26
+ done; \
27
+ fi; \
28
  done
29
 
30
+ ENV HOST=0.0.0.0 PORT=7860 DATA_DIR=/app/data
31
+
32
+ EXPOSE $PORT
33
+
34
+ USER root
35
 
36
+ CMD ["/bin/bash", "-c", "/app/sync_webuidb.sh & open-webui serve --host $HOST --port $PORT"]