mirror of
https://github.com/searxng/searxng.git
synced 2025-12-22 19:50:00 +00:00
[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.
This commit is contained in:
@@ -6,7 +6,7 @@ contents:
|
||||
- alpine-base
|
||||
- build-base
|
||||
- python3-dev
|
||||
- py3-pip
|
||||
- uv
|
||||
- brotli
|
||||
|
||||
entrypoint:
|
||||
|
||||
@@ -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 ./
|
||||
|
||||
Reference in New Issue
Block a user