move Dockerfiles to container folder

`./container/` folder is the new folder for container related files including new Dockerfiles and config.

`./container/legacy/` is dedicated to legacy architectures like armv7. Related Dockerfiles and configs go there.
This commit is contained in:
Ivan Gabaldon 2025-05-11 17:13:54 +02:00
parent 2bc305782c
commit 8d0803b48e
No known key found for this signature in database
GPG Key ID: 075587C93FA67582
8 changed files with 19 additions and 23 deletions

View File

@ -75,7 +75,8 @@ jobs:
- name: Setup cache container mounts - name: Setup cache container mounts
uses: actions/cache@v4 uses: actions/cache@v4
with: 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 }}-" restore-keys: "container-mounts-${{ matrix.arch }}-"
path: | path: |
/var/tmp/buildah-cache/ /var/tmp/buildah-cache/

View File

@ -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: test.yamllint test.black test.types.dev test.pylint test.unit test.robot test.rst test.shell
test.shell: test.shell:
$(Q)shellcheck -x -s dash \ $(Q)shellcheck -x -s dash \
dockerfiles/docker-entrypoint.sh container/docker-entrypoint.sh
$(Q)shellcheck -x -s bash \ $(Q)shellcheck -x -s bash \
utils/brand.sh \ utils/brand.sh \
$(MTOOLS) \ $(MTOOLS) \

View File

@ -24,7 +24,7 @@ ARG TIMESTAMP_UWSGI=0
RUN python -m compileall -q searx \ RUN python -m compileall -q searx \
&& touch -c --date=@$TIMESTAMP_SETTINGS ./searx/settings.yml \ && 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 \ && find /usr/local/searxng/searx/static \
\( -name '*.html' -o -name '*.css' -o -name '*.js' -o -name '*.svg' -o -name '*.ttf' -o -name '*.eot' \) \ \( -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 {} + -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/venv/ ./venv/
COPY --chown=searxng:searxng --from=builder /usr/local/searxng/searx/ ./searx/ 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>" \ LABEL org.opencontainers.image.authors="searxng <$GIT_URL>" \
org.opencontainers.image.created=$LABEL_DATE \ 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 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"]

View File

@ -140,14 +140,14 @@ if [ "$SEARX_CONF" -eq "1" ]; then
cat << EOF > /etc/searx/deprecated_volume_read_me.txt cat << EOF > /etc/searx/deprecated_volume_read_me.txt
This Docker image uses the volume /etc/searxng This Docker image uses the volume /etc/searxng
Update your configuration: 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 * mount /etc/searxng instead of /etc/searx
EOF EOF
fi fi
# end of searx compatibility # end of searx compatibility
# make sure there are uwsgi settings # 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 # make sure there are searxng settings
update_conf "${FORCE_CONF_UPDATE}" "${SEARXNG_SETTINGS_PATH}" "/usr/local/searxng/searx/settings.yml" "patch_searxng_settings" update_conf "${FORCE_CONF_UPDATE}" "${SEARXNG_SETTINGS_PATH}" "/usr/local/searxng/searx/settings.yml" "patch_searxng_settings"

View File

@ -1,3 +1,5 @@
# For armv7 architecture
FROM docker.io/library/python:3.13-slim AS builder FROM docker.io/library/python:3.13-slim AS builder
RUN apt-get update \ RUN apt-get update \
@ -28,7 +30,7 @@ ARG TIMESTAMP_UWSGI=0
RUN python -m compileall -q searx \ RUN python -m compileall -q searx \
&& touch -c --date=@$TIMESTAMP_SETTINGS ./searx/settings.yml \ && 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 \ && find /usr/local/searxng/searx/static \
\( -name '*.html' -o -name '*.css' -o -name '*.js' -o -name '*.svg' -o -name '*.ttf' -o -name '*.eot' \) \ \( -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 {} + -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/venv/ ./venv/
COPY --chown=searxng:searxng --from=builder /usr/local/searxng/searx/ ./searx/ 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>" \ LABEL org.opencontainers.image.authors="searxng <$GIT_URL>" \
org.opencontainers.image.created=$LABEL_DATE \ 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 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"]

View File

@ -145,13 +145,6 @@ shell inside container
- `How to make bash scripts work in dash <http://mywiki.wooledge.org/Bashism>`_ - `How to make bash scripts work in dash <http://mywiki.wooledge.org/Bashism>`_
- `Checking for Bashisms <https://dev.to/bowmanjd/writing-bash-scripts-that-are-not-only-bash-checking-for-bashisms-and-testing-with-dash-1bli>`_ - `Checking for Bashisms <https://dev.to/bowmanjd/writing-bash-scripts-that-are-not-only-bash-checking-for-bashisms-and-testing-with-dash-1bli>`_
Like in many other distributions, Alpine's `/bin/sh
<https://wiki.ubuntu.com/DashAsBinSh>`__ is :man:`dash`. Dash is meant to be
`POSIX-compliant <https://pubs.opengroup.org/onlinepubs/9699919799>`__.
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: To open a shell inside the container:
.. code:: sh .. code:: sh
@ -188,10 +181,10 @@ Command line
<https://docs.docker.com/engine/reference/run/#foreground>`__. <https://docs.docker.com/engine/reference/run/#foreground>`__.
In the :origin:`Dockerfile` the ENTRYPOINT_ is defined as In the :origin:`Dockerfile` the ENTRYPOINT_ is defined as
:origin:`dockerfiles/docker-entrypoint.sh` :origin:`container/docker-entrypoint.sh`
.. code:: sh .. code:: sh
docker run --rm -it searxng/searxng -h docker run --rm -it searxng/searxng -h
.. program-output:: ../dockerfiles/docker-entrypoint.sh -h .. program-output:: ../container/docker-entrypoint.sh -h

View File

@ -36,7 +36,7 @@ container.build() {
platform="linux/$arch" platform="linux/$arch"
;; ;;
"ARMV7" | "armhf" | "armv7l" | "armv7") "ARMV7" | "armhf" | "armv7l" | "armv7")
dockerfile="armv7.dockerfile" dockerfile="legacy/Dockerfile"
arch="arm" arch="arm"
variant="v7" variant="v7"
platform="linux/$arch/$variant" platform="linux/$arch/$variant"
@ -125,9 +125,9 @@ container.build() {
# shellcheck disable=SC2086 # shellcheck disable=SC2086
"$container_engine" $params_build_builder \ "$container_engine" $params_build_builder \
--build-arg="TIMESTAMP_SETTINGS=$(git log -1 --format="%cd" --date=unix -- ./searx/settings.yml)" \ --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" \ --tag="localhost/$CONTAINER_IMAGE_ORGANIZATION/$CONTAINER_IMAGE_NAME:builder" \
--file="./$dockerfile" \ --file="./container/$dockerfile" \
. .
build_msg CONTAINER "Image \"builder\" built" 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_DATE=$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
--build-arg="LABEL_VCS_REF=$(git rev-parse HEAD)" \ --build-arg="LABEL_VCS_REF=$(git rev-parse HEAD)" \
--build-arg="LABEL_VCS_URL=$GIT_URL" \ --build-arg="LABEL_VCS_URL=$GIT_URL" \
--file="./$dockerfile" \ --file="./container/$dockerfile" \
. .
build_msg CONTAINER "Image built" build_msg CONTAINER "Image built"