From 6b48af17572e14ccac382a7010edfaaf379c7e35 Mon Sep 17 00:00:00 2001 From: Heiner Lohaus Date: Mon, 25 Nov 2024 20:34:50 +0100 Subject: Add armv7 docker image, Remove Bing provider, add update banner --- docker/Dockerfile-armv7 | 67 +++++++++++++++++++++++++++++++++++++++++++++++++ docker/Dockerfile-slim | 4 +-- 2 files changed, 69 insertions(+), 2 deletions(-) create mode 100644 docker/Dockerfile-armv7 (limited to 'docker') diff --git a/docker/Dockerfile-armv7 b/docker/Dockerfile-armv7 new file mode 100644 index 00000000..866ac63b --- /dev/null +++ b/docker/Dockerfile-armv7 @@ -0,0 +1,67 @@ +FROM python:slim-bookworm + +ARG G4F_VERSION +ARG G4F_USER=g4f +ARG G4F_USER_ID=1000 +ARG PYDANTIC_VERSION=1.8.1 + +ENV G4F_VERSION $G4F_VERSION +ENV G4F_USER $G4F_USER +ENV G4F_USER_ID $G4F_USER_ID +ENV G4F_DIR /app + +RUN apt-get update && apt-get upgrade -y \ + && apt-get install -y git \ + && apt-get install --quiet --yes --no-install-recommends \ + build-essential \ +# Add user and user group + && groupadd -g $G4F_USER_ID $G4F_USER \ + && 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 \ + && python -m pip install --upgrade pip + +USER $G4F_USER_ID +WORKDIR $G4F_DIR + +ENV HOME /home/$G4F_USER +ENV PATH "${HOME}/.local/bin:${PATH}" + +# Create app dir and copy the project's requirements file into it +RUN mkdir -p $G4F_DIR +COPY requirements-min.txt $G4F_DIR +COPY requirements-slim.txt $G4F_DIR + +# Upgrade pip for the latest features and install the project's Python dependencies. +RUN pip install --no-cache-dir -r requirements-min.txt \ + && pip install --no-cache-dir --no-binary setuptools \ + Cython==0.29.22 \ + setuptools \ + # Install PyDantic + && pip install \ + -vvv \ + --no-cache-dir \ + --no-binary :all: \ + --global-option=build_ext \ + --global-option=-j8 \ + pydantic==${PYDANTIC_VERSION} +RUN cat requirements-slim.txt | xargs -n 1 pip install --no-cache-dir || true + +# Remove build packages +RUN pip uninstall --yes \ + Cython \ + setuptools + +USER root + +# Clean up build deps +RUN apt-get purge --auto-remove --yes \ + build-essential \ + && apt-get clean \ + && rm --recursive --force /var/lib/apt/lists/* /tmp/* /var/tmp/* + +USER $G4F_USER_ID + +# Copy the entire package into the container. +ADD --chown=$G4F_USER:$G4F_USER g4f $G4F_DIR/g4f \ No newline at end of file diff --git a/docker/Dockerfile-slim b/docker/Dockerfile-slim index 04238144..dfc3344d 100644 --- a/docker/Dockerfile-slim +++ b/docker/Dockerfile-slim @@ -29,11 +29,11 @@ ENV PATH "${HOME}/.local/bin:${PATH}" # Create app dir and copy the project's requirements file into it RUN mkdir -p $G4F_DIR -COPY requirements-min.txt $G4F_DIR COPY requirements-slim.txt $G4F_DIR # Upgrade pip for the latest features and install the project's Python dependencies. -RUN cat requirements-slim.txt | xargs -n 1 pip install --no-cache-dir || true +RUN pip install --no-cache-dir -r requirements-slim.txt \ + && pip install --no-cache-dir duckduckgo-search>=5.0 # Copy the entire package into the container. ADD --chown=$G4F_USER:$G4F_USER g4f $G4F_DIR/g4f \ No newline at end of file -- cgit v1.2.3