mirror of
https://github.com/xtekky/gpt4free.git
synced 2025-09-26 20:31:14 +08:00
Add live update
This commit is contained in:
@@ -112,11 +112,10 @@ docker run -p 8080:8080 -p 7900:7900 \
|
|||||||
mkdir -p ${PWD}/har_and_cookies ${PWD}/generated_media
|
mkdir -p ${PWD}/har_and_cookies ${PWD}/generated_media
|
||||||
chown -R 1000:1000 ${PWD}/har_and_cookies ${PWD}/generated_media
|
chown -R 1000:1000 ${PWD}/har_and_cookies ${PWD}/generated_media
|
||||||
docker run \
|
docker run \
|
||||||
-p 1337:1337 \
|
-p 1337:1337 -p 8080:1337 \
|
||||||
-v ${PWD}/har_and_cookies:/app/har_and_cookies \
|
-v ${PWD}/har_and_cookies:/app/har_and_cookies \
|
||||||
-v ${PWD}/generated_media:/app/generated_media \
|
-v ${PWD}/generated_media:/app/generated_media \
|
||||||
hlohaus789/g4f:latest-slim \
|
hlohaus789/g4f:latest-slim
|
||||||
/bin/sh -c 'rm -rf /app/g4f && pip install -U g4f[slim] && python -m g4f --debug'
|
|
||||||
```
|
```
|
||||||
|
|
||||||
5. **Access the Client Interface:**
|
5. **Access the Client Interface:**
|
||||||
|
@@ -7,9 +7,9 @@ services:
|
|||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: docker/Dockerfile-slim
|
dockerfile: docker/Dockerfile-slim
|
||||||
command: python -m g4f --debug --port 8080
|
|
||||||
volumes:
|
volumes:
|
||||||
- .:/app
|
- ./generated_media:/app/generated_media
|
||||||
|
- ./har_and_cookies:/app/har_and_cookies
|
||||||
ports:
|
ports:
|
||||||
- '8080:8080'
|
- '8080:8080'
|
||||||
- '1337:8080'
|
- '1337:8080'
|
@@ -31,7 +31,8 @@ ENV HOME /home/$G4F_USER
|
|||||||
ENV PATH "${HOME}/.local/bin:${PATH}"
|
ENV PATH "${HOME}/.local/bin:${PATH}"
|
||||||
|
|
||||||
RUN git clone https://github.com/xtekky/gpt4free.git $G4F_DIR
|
RUN git clone https://github.com/xtekky/gpt4free.git $G4F_DIR
|
||||||
RUN crontab docker/update-cron
|
RUN printf "0 * * * * python -m etc.update\n" > cronfile
|
||||||
|
RUN crontab cronfile
|
||||||
RUN pip install --no-cache-dir -r requirements-slim.txt
|
RUN pip install --no-cache-dir -r requirements-slim.txt
|
||||||
|
|
||||||
CMD python -m g4f --debug --reload
|
CMD python -m g4f --debug --reload
|
@@ -1,2 +0,0 @@
|
|||||||
0 * * * * g4f python -m etc.update
|
|
||||||
#
|
|
19
etc/tool/update.py
Normal file
19
etc/tool/update.py
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
import os
|
||||||
|
from g4f import version
|
||||||
|
from subprocess import call, STDOUT
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
if not os.getenv("G4F_LIVE"):
|
||||||
|
print("Live mode is not enabled. Exiting update script.")
|
||||||
|
exit(0)
|
||||||
|
command = ["git", "fetch"]
|
||||||
|
call(command, stderr=STDOUT)
|
||||||
|
command = ["git", "reset", "--hard", "master"]
|
||||||
|
call(command, stderr=STDOUT)
|
||||||
|
command = ["git" ,"pull", "origin", "main"]
|
||||||
|
call(command, stderr=STDOUT)
|
||||||
|
current_version = version.get_git_version()
|
||||||
|
with open("g4f/debug.py", "a") as f:
|
||||||
|
f.write(f"\nversion: str = '{current_version}'\n")
|
||||||
|
command = ["pip", "install", "-U", "-r" , "requirements-slim.txt"]
|
||||||
|
call(command, stderr=STDOUT)
|
Reference in New Issue
Block a user