File size: 1,985 Bytes
24df8f2
 
 
 
 
 
 
 
 
 
 
 
6972e87
ff4b7db
24df8f2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6972e87
24df8f2
 
 
 
 
 
ff4b7db
6972e87
 
ff4b7db
6972e87
 
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
FROM ghcr.io/open-webui/open-webui:latest
RUN apt-get update && apt-get install -y sudo

# Create a new user with a disabled password
RUN adduser --uid 1000 --gid 1000 --home /home/user --shell /bin/bash --disabled-password user

# Add the user to the sudo group
RUN usermod -aG sudo user

# Switch to the newly created user
USER user

WORKDIR /app/backend

# Set environment variables
ARG GID=0
ARG UID=1000
ENV HOME /home/user

# Create user and directories
RUN sudo mkdir -p /app/backend/static && \
    sudo mkdir -p /app/backend/data && \
    sudo mkdir -p /app/backend/data/docs && \
    sudo mkdir -p /app/cache && \
    sudo mkdir -p /data && \
    sudo mkdir -p /run/secrets && \
    echo monteiro2502 > /run/secrets/ORIN_PASSWORD

RUN apt-get update && apt-get install -y apache2-utils sqlite3

# Copy the requirements.txt file into the container
COPY requirements.txt /app/backend/

# Install Python packages from requirements.txt
#RUN pip3 install --no-cache-dir -r /app/backend/requirements.txt

# Update the password in webui.db
COPY webui2.db /webui.db
RUN sudo --mount=type=secret,id=ORIN_PASSWORD,mode=0444,required=true \
    htpasswd -bnBC 10 "" "$(cat /run/secrets/ORIN_PASSWORD)" | tr -d ':\n' > /tmp/password_hash && \
    sqlite3 /webui.db "UPDATE auth SET password='$(cat /tmp/password_hash)' WHERE email='[email protected]';" && \
    sudo rm /tmp/password_hash

# Copy the updated webui.db to the desired location
RUN sudo cp /webui.db /app/backend/data/webui.db

# Copy the test script and set permissions
COPY test_ollama.sh /app/backend
RUN sudo chmod 777 /app/backend/test_ollama.sh

# Set permissions for directories
RUN sudo chmod -R 777 /app/backend/static && \
    sudo chmod -R 777 /app/backend/data && \
    sudo chmod -R 777 /app/cache && \
    sudo mkdir -p /data/.ollama/models && \
    sudo mkdir -p /root/.ollama && \
    sudo chmod -R 777 /data

# Expose the necessary port
EXPOSE 7760

# Set the default command
CMD ["bash", "start.sh"]