XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet
公开
关注 0 Fork 0 Star 0
返回提交历史

XFEstudio/gpt4free

Update base image of main docker image

036d41b9
hlohaus <983577+hlohaus@users.noreply.github.com>
提交于

代码差异

7 个文件 +25 -81
Modified README.md +12 -10
@@ -99,22 +99,24 @@ Is your site on this repository and you want to take it down? Send an email to t
99 99 ### 🐳 Using Docker
100 100 1. **Install Docker:** [Download and install Docker](https://docs.docker.com/get-docker/).
101 101 2. **Set Up Directories:** Before running the container, make sure the necessary data directories exist or can be created. For example, you can create and set ownership on these directories by running:
102 ```bash
102 ```bash
103 103 mkdir -p ${PWD}/har_and_cookies ${PWD}/generated_images
104 chown -R 1000:1000 ${PWD}/har_and_cookies ${PWD}/generated_images
105 ```
104 sudo chown -R 1200:1201 ${PWD}/har_and_cookies ${PWD}/generated_images
105 ```
106 106 3. **Run the Docker Container:** Use the following commands to pull the latest image and start the container:
107 ```bash
107 ```bash
108 108 docker pull hlohaus789/g4f
109 docker run -p 8080:8080 -p 1337:1337 -p 7900:7900 \
109 docker run -p 8080:8080 -p 7900:7900 \
110 110 --shm-size="2g" \
111 111 -v ${PWD}/har_and_cookies:/app/har_and_cookies \
112 112 -v ${PWD}/generated_images:/app/generated_images \
113 113 hlohaus789/g4f:latest
114 ```
114 ```
115 115
116 4. **Running the Slim Docker Image:** Use the following command to run the Slim Docker image. This command also updates the `g4f` package at startup and installs any additional dependencies:
117 ```bash
116 4. **Running the Slim Docker Image:** And use the following commands to run the Slim Docker image. This command also updates the `g4f` package at startup and installs any additional dependencies:
117 ```bash
118 mkdir -p ${PWD}/har_and_cookies ${PWD}/generated_images
119 chown -R 1000:1000 ${PWD}/har_and_cookies ${PWD}/generated_images
118 120 docker run \
119 121 -p 1337:1337 \
120 122 -v ${PWD}/har_and_cookies:/app/har_and_cookies \
@@ -126,8 +128,8 @@ Is your site on this repository and you want to take it down? Send an email to t
126 128 ```
127 129
128 130 5. **Access the Client Interface:**
129 - **To use the included client, navigate to:** [http://localhost:8080/chat/](http://localhost:8080/chat/) or [http://localhost:1337/chat/](http://localhost:1337/chat/)
130 - **Or set the API base for your client to:** [http://localhost:1337/v1](http://localhost:1337/v1)
131 - **To use the included client, navigate to:** [http://localhost:8080/chat/](http://localhost:8080/chat/)
132 - **Or set the API base for your client to:** [http://localhost:8080/v1](http://localhost:8080/v1)
131 133
132 134 6. **(Optional) Provider Login:**
133 135 If required, you can access the container's desktop here: http://localhost:7900/?autoconnect=1&resize=scale&password=secret for provider login purposes.
Modified docker-compose-slim.yml +4 -15
@@ -1,25 +1,14 @@
1 1 version: '3'
2 2
3 3 services:
4 g4f-gui:
5 container_name: g4f-gui
4 g4f-slim:
5 container_name: g4f-slim
6 6 image: hlohaus789/g4f:latest-slim
7 7 build:
8 8 context: .
9 9 dockerfile: docker/Dockerfile-slim
10 command: python -m g4f.cli gui -debug
10 command: python -m g4f --debug --port 8080
11 11 volumes:
12 12 - .:/app
13 13 ports:
14 - '8080:8080'
15 g4f-api:
16 container_name: g4f-api
17 image: hlohaus789/g4f:latest-slim
18 build:
19 context: .
20 dockerfile: docker/Dockerfile-slim
21 command: python -m g4f.cli api
22 volumes:
23 - .:/app
24 ports:
25 - '1337:1337'
14 - '8080:8080'
Modified docker-compose.yml +0 -1
@@ -11,7 +11,6 @@ services:
11 11 - .:/app
12 12 ports:
13 13 - '8080:8080'
14 - '1337:1337'
15 14 - '7900:7900'
16 15 environment:
17 16 - OLLAMA_HOST=host.docker.internal
Modified docker/Dockerfile +7 -41
@@ -1,26 +1,11 @@
1 FROM seleniarm/node-chromium
1 FROM selenium/node-chrome
2 2
3 3 ARG G4F_VERSION
4 ARG G4F_USER=g4f
5 ARG G4F_USER_ID=1000
6 ARG G4F_NO_GUI
7 ARG G4F_PASS=secret
8
9 4 ENV G4F_VERSION $G4F_VERSION
10 ENV G4F_USER $G4F_USER
11 ENV G4F_USER_ID $G4F_USER_ID
12 ENV G4F_NO_GUI $G4F_NO_GUI
13 5
14 6 ENV SE_SCREEN_WIDTH 1850
15 ENV PYTHONUNBUFFERED 1
16 7 ENV G4F_DIR /app
17 ENV G4F_LOGIN_URL http://localhost:7900/?autoconnect=1&resize=scale&password=$G4F_PASS
18 ENV HOME /home/$G4F_USER
19 ENV PATH $PATH:$HOME/.local/bin
20 ENV SE_DOWNLOAD_DIR $HOME/Downloads
21 ENV SEL_USER $G4F_USER
22 ENV SEL_UID $G4F_USER_ID
23 ENV SEL_GID $G4F_USER_ID
8 ENV G4F_LOGIN_URL http://localhost:7900/?autoconnect=1&resize=scale&password=secret
24 9
25 10 USER root
26 11
@@ -43,30 +28,15 @@ RUN apt-get -qqy update \
43 28 # Update entrypoint
44 29 COPY docker/supervisor.conf /etc/supervisor/conf.d/selenium.conf
45 30 COPY docker/supervisor-api.conf /etc/supervisor/conf.d/api.conf
46 COPY docker/supervisor-gui.conf /etc/supervisor/conf.d/gui.conf
47
48 # If no gui
49 RUN if [ "$G4F_NO_GUI" ] ; then \
50 rm /etc/supervisor/conf.d/gui.conf \
51 ; fi
52 31
53 32 # Change background image
54 33 COPY docker/background.png /usr/share/images/fluxbox/ubuntu-light.png
55 34
56 35 # Add user, fix permissions
57 RUN groupadd -g $G4F_USER_ID $G4F_USER \
58 && useradd -rm -G sudo -u $G4F_USER_ID -g $G4F_USER_ID $G4F_USER \
59 && echo "${G4F_USER}:${G4F_PASS}" | chpasswd \
60 && mkdir "${SE_DOWNLOAD_DIR}" \
61 && chown "${G4F_USER_ID}:${G4F_USER_ID}" $SE_DOWNLOAD_DIR /var/run/supervisor /var/log/supervisor \
62 && chown "${G4F_USER_ID}:${G4F_USER_ID}" -R /opt/bin/ /usr/bin/chromedriver /opt/selenium/
36 RUN chown "${SEL_UID}:${SEL_GID}" $HOME/.local
63 37
64 38 # Switch user
65 USER $G4F_USER_ID
66
67 # Set VNC password
68 RUN mkdir -p ${HOME}/.vnc \
69 && x11vnc -storepasswd ${G4F_PASS} ${HOME}/.vnc/passwd
39 USER $SEL_UID
70 40
71 41 # Set the working directory in the container.
72 42 WORKDIR $G4F_DIR
@@ -76,14 +46,10 @@ COPY requirements.txt $G4F_DIR
76 46
77 47 # Upgrade pip for the latest features and install the project's Python dependencies.
78 48 RUN pip install --break-system-packages --upgrade pip \
79 && pip install --break-system-packages -r requirements.txt \
80 && pip install --break-system-packages \
81 undetected-chromedriver selenium-wire \
82 && pip uninstall -y --break-system-packages \
83 pywebview
49 && pip install --break-system-packages -r requirements.txt
84 50
85 51 # Copy the entire package into the container.
86 ADD --chown=$G4F_USER:$G4F_USER g4f $G4F_DIR/g4f
52 ADD --chown=$SEL_UID:$SEL_GID g4f $G4F_DIR/g4f
87 53
88 54 # Expose ports
89 EXPOSE 8080 1337 7900
55 EXPOSE 8080 7900
Modified docker/supervisor-api.conf +1 -1
@@ -1,6 +1,6 @@
1 1 [program:g4f-api]
2 2 priority=15
3 command=python -m g4f.cli api
3 command=python -m g4f --port 8080 --debug
4 4 directory=/app
5 5 stopasgroup=true
6 6 autostart=true
Deleted docker/supervisor-gui.conf +0 -12
@@ -1,12 +0,0 @@
1 [program:g4f-gui]
2 priority=15
3 command=python -m g4f.cli gui -debug
4 directory=/app
5 stopasgroup=true
6 autostart=true
7 autorestart=true
8
9 ;Logs (all Hub activity redirected to stdout so it can be seen through "docker logs"
10 redirect_stderr=true
11 stdout_logfile=/dev/stdout
12 stdout_logfile_maxbytes=0
Modified g4f/version.py +1 -1
@@ -86,7 +86,7 @@ class VersionUtils:
86 86 except CalledProcessError:
87 87 pass
88 88
89 raise VersionNotFoundError("Version not found")
89 return None
90 90
91 91 @property
92 92 def latest_version(self) -> str: