diff --git a/.github/workflows/container.yml b/.github/workflows/container.yml index 1cf77827b..d232a0737 100644 --- a/.github/workflows/container.yml +++ b/.github/workflows/container.yml @@ -75,7 +75,8 @@ jobs: - name: Setup cache container mounts uses: actions/cache@v4 with: - key: "container-mounts-${{ matrix.arch }}-${{ hashFiles('./Dockerfile*') }}" + # yamllint disable-line rule:line-length + key: "container-mounts-${{ matrix.arch }}-${{ hashFiles('./container/Dockerfile ./container/legacy/Dockerfile') }}" restore-keys: "container-mounts-${{ matrix.arch }}-" path: | /var/tmp/buildah-cache/ diff --git a/Makefile b/Makefile index 8c20eed35..15e43be08 100644 --- a/Makefile +++ b/Makefile @@ -54,7 +54,7 @@ ci.test: test.yamllint test.black test.types.ci test.pylint test.unit test.robo test: test.yamllint test.black test.types.dev test.pylint test.unit test.robot test.rst test.shell test.shell: $(Q)shellcheck -x -s dash \ - dockerfiles/docker-entrypoint.sh + container/docker-entrypoint.sh $(Q)shellcheck -x -s bash \ utils/brand.sh \ $(MTOOLS) \ diff --git a/Dockerfile b/container/Dockerfile similarity index 94% rename from Dockerfile rename to container/Dockerfile index 92dfb4939..b0530dfec 100644 --- a/Dockerfile +++ b/container/Dockerfile @@ -24,7 +24,7 @@ ARG TIMESTAMP_UWSGI=0 RUN python -m compileall -q searx \ && touch -c --date=@$TIMESTAMP_SETTINGS ./searx/settings.yml \ - && touch -c --date=@$TIMESTAMP_UWSGI ./dockerfiles/uwsgi.ini \ + && touch -c --date=@$TIMESTAMP_UWSGI ./container/uwsgi.ini \ && find /usr/local/searxng/searx/static \ \( -name '*.html' -o -name '*.css' -o -name '*.js' -o -name '*.svg' -o -name '*.ttf' -o -name '*.eot' \) \ -type f -exec gzip -9 -k {} + -exec brotli --best {} + @@ -62,7 +62,7 @@ WORKDIR /usr/local/searxng/ COPY --chown=searxng:searxng --from=builder /usr/local/searxng/venv/ ./venv/ COPY --chown=searxng:searxng --from=builder /usr/local/searxng/searx/ ./searx/ -COPY --chown=searxng:searxng ./dockerfiles/ ./dockerfiles/ +COPY --chown=searxng:searxng ./container/ ./container/ LABEL org.opencontainers.image.authors="searxng <$GIT_URL>" \ org.opencontainers.image.created=$LABEL_DATE \ @@ -97,4 +97,4 @@ EXPOSE 8080 HEALTHCHECK CMD wget --quiet --tries=1 --spider http://localhost:8080/healthz || exit 1 -ENTRYPOINT ["/usr/local/searxng/dockerfiles/docker-entrypoint.sh"] +ENTRYPOINT ["/usr/local/searxng/container/docker-entrypoint.sh"] diff --git a/dockerfiles/docker-entrypoint.sh b/container/docker-entrypoint.sh similarity index 97% rename from dockerfiles/docker-entrypoint.sh rename to container/docker-entrypoint.sh index 3668fb589..72d020dcf 100755 --- a/dockerfiles/docker-entrypoint.sh +++ b/container/docker-entrypoint.sh @@ -140,14 +140,14 @@ if [ "$SEARX_CONF" -eq "1" ]; then cat << EOF > /etc/searx/deprecated_volume_read_me.txt This Docker image uses the volume /etc/searxng Update your configuration: -* remove uwsgi.ini (or very carefully update your existing uwsgi.ini using https://github.com/searxng/searxng/blob/master/dockerfiles/uwsgi.ini ) +* remove uwsgi.ini (or very carefully update your existing uwsgi.ini using https://github.com/searxng/searxng/blob/master/container/uwsgi.ini ) * mount /etc/searxng instead of /etc/searx EOF fi # end of searx compatibility # make sure there are uwsgi settings -update_conf "${FORCE_CONF_UPDATE}" "${UWSGI_SETTINGS_PATH}" "/usr/local/searxng/dockerfiles/uwsgi.ini" "patch_uwsgi_settings" +update_conf "${FORCE_CONF_UPDATE}" "${UWSGI_SETTINGS_PATH}" "/usr/local/searxng/container/uwsgi.ini" "patch_uwsgi_settings" # make sure there are searxng settings update_conf "${FORCE_CONF_UPDATE}" "${SEARXNG_SETTINGS_PATH}" "/usr/local/searxng/searx/settings.yml" "patch_searxng_settings" diff --git a/armv7.dockerfile b/container/legacy/Dockerfile similarity index 93% rename from armv7.dockerfile rename to container/legacy/Dockerfile index 02429dc76..5436ea5da 100644 --- a/armv7.dockerfile +++ b/container/legacy/Dockerfile @@ -1,3 +1,5 @@ +# For armv7 architecture + FROM docker.io/library/python:3.13-slim AS builder RUN apt-get update \ @@ -28,7 +30,7 @@ ARG TIMESTAMP_UWSGI=0 RUN python -m compileall -q searx \ && touch -c --date=@$TIMESTAMP_SETTINGS ./searx/settings.yml \ - && touch -c --date=@$TIMESTAMP_UWSGI ./dockerfiles/uwsgi.ini \ + && touch -c --date=@$TIMESTAMP_UWSGI ./container/uwsgi.ini \ && find /usr/local/searxng/searx/static \ \( -name '*.html' -o -name '*.css' -o -name '*.js' -o -name '*.svg' -o -name '*.ttf' -o -name '*.eot' \) \ -type f -exec gzip -9 -k {} + -exec brotli --best {} + @@ -68,7 +70,7 @@ WORKDIR /usr/local/searxng/ COPY --chown=searxng:searxng --from=builder /usr/local/searxng/venv/ ./venv/ COPY --chown=searxng:searxng --from=builder /usr/local/searxng/searx/ ./searx/ -COPY --chown=searxng:searxng ./dockerfiles/ ./dockerfiles/ +COPY --chown=searxng:searxng ./container/ ./container/ LABEL org.opencontainers.image.authors="searxng <$GIT_URL>" \ org.opencontainers.image.created=$LABEL_DATE \ @@ -101,4 +103,4 @@ EXPOSE 8080 HEALTHCHECK CMD wget --quiet --tries=1 --spider http://localhost:8080/healthz || exit 1 -ENTRYPOINT ["/usr/local/searxng/dockerfiles/docker-entrypoint.sh"] +ENTRYPOINT ["/usr/local/searxng/container/docker-entrypoint.sh"] diff --git a/dockerfiles/uwsgi.ini b/container/uwsgi.ini similarity index 100% rename from dockerfiles/uwsgi.ini rename to container/uwsgi.ini diff --git a/docs/admin/installation-docker.rst b/docs/admin/installation-docker.rst index 09471891b..06b3fe465 100644 --- a/docs/admin/installation-docker.rst +++ b/docs/admin/installation-docker.rst @@ -145,13 +145,6 @@ shell inside container - `How to make bash scripts work in dash `_ - `Checking for Bashisms `_ -Like in many other distributions, Alpine's `/bin/sh -`__ is :man:`dash`. Dash is meant to be -`POSIX-compliant `__. -Compared to debian, in the Alpine image :man:`bash` is not installed. The -:origin:`dockerfiles/docker-entrypoint.sh` script is checked *against dash* -(``make tests.shell``). - To open a shell inside the container: .. code:: sh @@ -188,10 +181,10 @@ Command line `__. In the :origin:`Dockerfile` the ENTRYPOINT_ is defined as -:origin:`dockerfiles/docker-entrypoint.sh` +:origin:`container/docker-entrypoint.sh` .. code:: sh docker run --rm -it searxng/searxng -h -.. program-output:: ../dockerfiles/docker-entrypoint.sh -h +.. program-output:: ../container/docker-entrypoint.sh -h diff --git a/utils/lib_sxng_container.sh b/utils/lib_sxng_container.sh index d6698e2c2..b1546f532 100644 --- a/utils/lib_sxng_container.sh +++ b/utils/lib_sxng_container.sh @@ -36,7 +36,7 @@ container.build() { platform="linux/$arch" ;; "ARMV7" | "armhf" | "armv7l" | "armv7") - dockerfile="armv7.dockerfile" + dockerfile="legacy/Dockerfile" arch="arm" variant="v7" platform="linux/$arch/$variant" @@ -125,9 +125,9 @@ container.build() { # shellcheck disable=SC2086 "$container_engine" $params_build_builder \ --build-arg="TIMESTAMP_SETTINGS=$(git log -1 --format="%cd" --date=unix -- ./searx/settings.yml)" \ - --build-arg="TIMESTAMP_UWSGI=$(git log -1 --format="%cd" --date=unix -- ./dockerfiles/uwsgi.ini)" \ + --build-arg="TIMESTAMP_UWSGI=$(git log -1 --format="%cd" --date=unix -- ./container/uwsgi.ini)" \ --tag="localhost/$CONTAINER_IMAGE_ORGANIZATION/$CONTAINER_IMAGE_NAME:builder" \ - --file="./$dockerfile" \ + --file="./container/$dockerfile" \ . build_msg CONTAINER "Image \"builder\" built" @@ -138,7 +138,7 @@ container.build() { --build-arg="LABEL_DATE=$(date -u +%Y-%m-%dT%H:%M:%SZ)" \ --build-arg="LABEL_VCS_REF=$(git rev-parse HEAD)" \ --build-arg="LABEL_VCS_URL=$GIT_URL" \ - --file="./$dockerfile" \ + --file="./container/$dockerfile" \ . build_msg CONTAINER "Image built"