summaryrefslogtreecommitdiff
path: root/container
diff options
context:
space:
mode:
authorIvan Gabaldon <igabaldon@inetol.net>2025-09-14 10:36:21 +0200
committerGitHub <noreply@github.com>2025-09-14 10:36:21 +0200
commita0d2ecf43466083925291e749ab9c2a451f6963d (patch)
tree7a16f51ebf4a892a26e94ec6bd2dc5c2bff8153f /container
parent687121d58497ff170467d6b14988bde11d91516c (diff)
[enh] container: build with uv (#5199)
This commit replaces `pip` in container builds with `uv` pip compat with a 1:1 parity. The only thing that changes is the installation speed of the wheels, which seems to be considerably faster, although I haven't been able to properly quantify this yet. uv also gives us more tools to manage the cache. We can revert the prior cache changes in `container.yml` as we won't have duplicated wheels anymore.
Diffstat (limited to 'container')
-rw-r--r--container/base-builder.yml2
-rw-r--r--container/builder.dockerfile23
2 files changed, 14 insertions, 11 deletions
diff --git a/container/base-builder.yml b/container/base-builder.yml
index e065a346e..0b16e4be7 100644
--- a/container/base-builder.yml
+++ b/container/base-builder.yml
@@ -6,7 +6,7 @@ contents:
- alpine-base
- build-base
- python3-dev
- - py3-pip
+ - uv
- brotli
entrypoint:
diff --git a/container/builder.dockerfile b/container/builder.dockerfile
index dc2279dd9..99b22fcc2 100644
--- a/container/builder.dockerfile
+++ b/container/builder.dockerfile
@@ -2,10 +2,13 @@ FROM ghcr.io/searxng/base:searxng-builder AS builder
COPY ./requirements*.txt ./
-RUN --mount=type=cache,id=pip,target=/root/.cache/pip set -eux; \
- python -m venv ./.venv/; \
- . ./.venv/bin/activate; \
- pip install -r ./requirements.txt -r ./requirements-server.txt
+ARG TIMESTAMP="0"
+
+RUN --mount=type=cache,id=uv,target=/root/.cache/uv set -eux; \
+ uv venv; \
+ uv pip install --no-managed-python --compile-bytecode --requirements ./requirements.txt --requirements ./requirements-server.txt; \
+ uv cache prune --ci; \
+ find ./.venv/ -exec touch -h -t $TIMESTAMP {} +
COPY ./searx/ ./searx/
@@ -13,12 +16,12 @@ ARG TIMESTAMP_SETTINGS="0"
RUN set -eux; \
python -m compileall -q ./searx/; \
- touch -c --date=@$TIMESTAMP_SETTINGS ./searx/settings.yml; \
+ touch -c -t $TIMESTAMP_SETTINGS ./searx/settings.yml; \
find ./searx/static/ -type f \
- \( -name "*.html" -o -name "*.css" -o -name "*.js" -o -name "*.svg" \) \
- -exec gzip -9 -k {} + \
- -exec brotli -9 -k {} + \
- -exec gzip --test {}.gz + \
- -exec brotli --test {}.br +; \
+ \( -name "*.html" -o -name "*.css" -o -name "*.js" -o -name "*.svg" \) \
+ -exec gzip -9 -k {} + \
+ -exec brotli -9 -k {} + \
+ -exec gzip --test {}.gz + \
+ -exec brotli --test {}.br +; \
# Move always changing files to /usr/local/searxng/
mv ./searx/version_frozen.py ./