From 7d9a64013b6c4e03b7e403e87d55c95d9ac4c248 Mon Sep 17 00:00:00 2001 From: H Lohaus Date: Sun, 24 Nov 2024 18:42:00 +0100 Subject: Arm2 (#2415) * Fix arm v7 build / improve api * Update stubs.py * Fix unit tests * Fix arm build --- README.md | 12 ++++++------ docker/Dockerfile-slim | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 4f61d791..f882b13c 100644 --- a/README.md +++ b/README.md @@ -105,23 +105,23 @@ docker run \ hlohaus789/g4f:latest ``` -Start the GUI without a browser requirement and in debug mode. -There's no need to update the Docker image every time. -Simply remove the g4f package from the image and install the Python package: +To run the slim docker image. Use this command: + ```bash docker run \ - -p 8080:8080 \ + -p 1337:1337 \ -v ${PWD}/har_and_cookies:/app/har_and_cookies \ -v ${PWD}/generated_images:/app/generated_images \ hlohaus789/g4f:latest-slim \ rm -r -f /app/g4f/ \ && pip install -U g4f[slim] \ - && python -m g4f.cli gui -d + && python -m g4f.cli api --gui --debug ``` +It also updates the `g4f` package at startup and installs any new required dependencies. 3. **Access the Client:** - - To use the included client, navigate to: [http://localhost:8080/chat/](http://localhost:8080/chat/) + - To use the included client, navigate to: [http://localhost:8080/chat/](http://localhost:8080/chat/) or [http://localhost:1337/chat/](http://localhost:1337/chat/) - Or set the API base for your client to: [http://localhost:1337/v1](http://localhost:1337/v1) 4. **(Optional) Provider Login:** diff --git a/docker/Dockerfile-slim b/docker/Dockerfile-slim index 6cbf2254..d1199a2c 100644 --- a/docker/Dockerfile-slim +++ b/docker/Dockerfile-slim @@ -19,7 +19,8 @@ RUN apt-get update && apt-get upgrade -y \ && useradd -rm -G sudo -u $G4F_USER_ID -g $G4F_USER_ID $G4F_USER \ && mkdir -p /var/log/supervisor \ && chown "${G4F_USER_ID}:${G4F_USER_ID}" /var/log/supervisor \ - && echo "${G4F_USER}:${G4F_USER}" | chpasswd + && echo "${G4F_USER}:${G4F_USER}" | chpasswd \ + && python -m pip install --upgrade pip USER $G4F_USER_ID WORKDIR $G4F_DIR @@ -35,15 +36,14 @@ COPY requirements-slim.txt $G4F_DIR RUN curl https://sh.rustup.rs -sSf | bash -s -- -y # Upgrade pip for the latest features and install the project's Python dependencies. -RUN python -m pip install --upgrade pip \ - && pip install --no-cache-dir \ +RUN pip install --no-cache-dir \ Cython==0.29.22 \ setuptools \ # Install PyDantic && pip install \ -vvv \ --no-cache-dir \ - --no-binary pydantic \ + --no-binary :all: \ --global-option=build_ext \ --global-option=-j8 \ pydantic==${PYDANTIC_VERSION} \ -- cgit v1.2.3