这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@inetol
Copy link
Member

@inetol inetol commented May 1, 2025

What does this PR do?

This is one of various PR to refactor the entire SearXNG Docker workflow.

Switches to Python glibc based images, all dependencies are installed via pip and not from system repositories, and several minor changes.

By default, the container will now run under root, this is to prevent weird issues when using a rootless Docker/Podman setup (you can revert to how it was by specifying the searxng user on container instancing, just remember to update the ownership recursively in the already created volumes).

This PR will increase the image size from 194.9 MB to 345.47 MB (amd64), this is due to ARMv7 images (needs dependencies for wheels compilation and runtime (?)) and uWSGI webserver. Later PR will reduce the final image size.

Why is this change important?

It's being talked about in various issues and PRs as Docker images are getting in the way and hindering development.

#4676
#4596
#4463

How to test this PR locally?

docker build . or podman build .

Related issues

Supersedes / Close #4463

Closes #4460

@inetol inetol marked this pull request as ready for review May 1, 2025 18:17
@unixfox
Copy link
Contributor

unixfox commented May 1, 2025

By default, the container will now run under root

hum no, we should run a non-root container by default.

@inetol
Copy link
Member Author

inetol commented May 2, 2025

I have reverted the change, there is no need to specify uid/gid in uWSGI as it will already run under the user that is configured to run in the container (in this case now searxng)

@unixfox
Copy link
Contributor

unixfox commented May 4, 2025

This PR will increase the image size from 194.9 MB to 345.47 MB (amd64), this is due to ARMv7 images (needs dependencies for wheels compilation and runtime (?)) and uWSGI webserver. Later PR will reduce the final image size.

Maybe we could do a multi-stage Docker image? This way we don't have to include the whole build-essential.

Or separate Dockerfiles like I proposed in #4676 (comment)

And have you looked into adding more source for the wheels like https://www.piwheels.org/? I just found out that this wheels repo is configured in my raspberry pi (I don't use searxng on it but I saw that when installing cryptography on armv7)

@inetol
Copy link
Member Author

inetol commented May 4, 2025

Maybe we could do a multi-stage Docker image? This way we don't have to include the whole build-essential.

It's already being done, the issue is that uWSGI relies on some heavy dependencies, I hope to be able to remove that once we use Granian:

https://github.com/inetol/searxng/blob/4aaa97a1d80d6267685e0291ad270875393cdb35/Dockerfile#L44

Also in #4707 I will separate the "modern" archs and "armv7", so less dependencies for amd64 and arm64 images.

Or separate Dockerfiles like I proposed in #4676 (comment)

I want to do this here, as this requires modifying the whole CD process: #4707

And have you looked into adding more source for the wheels like https://www.piwheels.org/? I just found out that this wheels repo is configured in my raspberry pi (I don't use searxng on it but I saw that when installing cryptography on armv7)

I find it interesting, unfortunately it follows the mainline Python versions of RPiOS. The container images use Python 3.13 and piwheels are built for Python 3.11 backwards, I'm not going to stick to using Python 3.11 on the container image if it only affects one architecture (although once the whole Docker process is refactored, I don't rule out that the arch armv7 will be keyed to use the same mainline Python versions of RPiOS, we'll see...).

Copy link
Contributor

@unixfox unixfox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok good for me.

We can continue the work in reducing the image size in #4707. Thanks

@unixfox unixfox merged commit 2e74d86 into searxng:master May 4, 2025
9 checks passed
@inetol inetol deleted the container branch May 4, 2025 21:13
Bnyro added a commit that referenced this pull request May 5, 2025
Bnyro added a commit that referenced this pull request May 5, 2025
Bnyro pushed a commit to Bnyro/searxng that referenced this pull request Jun 25, 2025
This is one of various PR to refactor the entire SearXNG Docker workflow.

Switches to Python glibc based images, all dependencies are installed via pip and not from system repositories, and several minor changes.

This PR will increase the image size from 194.9 MB to 345.47 MB (amd64), this is due to ARMv7 images (needs dependencies for wheels compilation and runtime (?)) and uWSGI webserver. Later PR will reduce the final image size.
Bnyro added a commit to Bnyro/searxng that referenced this pull request Jun 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Simpler Dockerfile

2 participants