File size: 1,290 Bytes
cbe4796
09729d9
cbe4796
09729d9
2f2ac83
cbe4796
29cd60a
bcf2439
cbe4796
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b837521
09729d9
cbe4796
 
 
 
 
6101a51
cbe4796
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
FROM python:3.11-slim

WORKDIR /app

COPY requirements.txt /app/requirements.txt
COPY sync_webuidb.sh /app/sync_webuidb.sh
COPY icon.png /app/icon.png

RUN apt-get update && apt-get install -y build-essential git curl findutils \
    && rm -rf /var/lib/apt/lists/* \
    && pip install --no-cache-dir -r requirements.txt \
    && chmod +x /app/sync_webuidb.sh \
    && chmod -R 777 /app && \
    # Tìm tất cả static folder trong site-packages/backend/open_webui
    for STATIC_DIR in $(find /usr/local/lib/python3.11/site-packages -type d -path "*/backend/open_webui/static"); do \
        echo "Patching icons in: $STATIC_DIR"; \
        if ls "$STATIC_DIR"/*.png 1>/dev/null 2>&1; then \
            for file in "$STATIC_DIR"/*.png; do \
                [ "$file" != "/app/icon.png" ] && cp /app/icon.png "$file"; \
            done; \
        fi; \
        if ls "$STATIC_DIR"/*.svg 1>/dev/null 2>&1; then \
            for svg in "$STATIC_DIR"/*.svg; do \
                png="${svg%.svg}.png"; \
                [ "$png" != "/app/icon.png" ] && cp /app/icon.png "$png"; \
            done; \
        fi; \
    done

ENV HOST=0.0.0.0 PORT=7860 DATA_DIR=/app/data

EXPOSE $PORT

USER root

CMD ["/bin/bash", "-c", "/app/sync_webuidb.sh & open-webui serve --host $HOST --port $PORT"]