mirror of
https://github.com/searxng/searxng.git
synced 2024-11-21 19:51:44 +01:00
[docker] multiarch support: linux/amd64,linux/arm64,linux/arm/v7
make docker.buildx : build and push multiarch build. (it can't be only build) use buildx with the --cache-from and --cache-to options to cache the layers (only the last built is cached)
This commit is contained in:
parent
fe3831db1a
commit
20580bcbd4
2
.github/workflows/integration.yml
vendored
2
.github/workflows/integration.yml
vendored
@ -121,4 +121,4 @@ jobs:
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
- name: Build and push
|
||||
if: env.DOCKERHUB_USERNAME != null
|
||||
run: make -e GIT_URL=$(git remote get-url origin) docker.push
|
||||
run: make -e GIT_URL=$(git remote get-url origin) docker.buildx
|
||||
|
@ -73,18 +73,18 @@ ARG GIT_URL=unknown
|
||||
ARG SEARX_GIT_VERSION=unknown
|
||||
ARG LABEL_VCS_REF=
|
||||
ARG LABEL_VCS_URL=
|
||||
LABEL maintainer="searx <${GIT_URL}>" \
|
||||
LABEL maintainer="searxng <${GIT_URL}>" \
|
||||
description="A privacy-respecting, hackable metasearch engine." \
|
||||
version="${SEARX_GIT_VERSION}" \
|
||||
org.label-schema.schema-version="1.0" \
|
||||
org.label-schema.name="searx" \
|
||||
org.label-schema.name="searxng" \
|
||||
org.label-schema.version="${SEARX_GIT_VERSION}" \
|
||||
org.label-schema.url="${LABEL_VCS_URL}" \
|
||||
org.label-schema.vcs-ref=${LABEL_VCS_REF} \
|
||||
org.label-schema.vcs-url=${LABEL_VCS_URL} \
|
||||
org.label-schema.build-date="${LABEL_DATE}" \
|
||||
org.label-schema.usage="https://github.com/searx/searx-docker" \
|
||||
org.opencontainers.image.title="searx" \
|
||||
org.opencontainers.image.title="searxng" \
|
||||
org.opencontainers.image.version="${SEARX_GIT_VERSION}" \
|
||||
org.opencontainers.image.url="${LABEL_VCS_URL}" \
|
||||
org.opencontainers.image.revision=${LABEL_VCS_REF} \
|
||||
|
2
Makefile
2
Makefile
@ -73,7 +73,7 @@ MANAGE += buildenv
|
||||
MANAGE += babel.compile
|
||||
MANAGE += data.all data.languages data.useragents
|
||||
MANAGE += docs.html docs.live docs.gh-pages docs.prebuild docs.clean
|
||||
MANAGE += docker.build docker.push
|
||||
MANAGE += docker.build docker.push docker.buildx
|
||||
MANAGE += gecko.driver
|
||||
MANAGE += node.env node.clean
|
||||
MANAGE += py.build py.clean
|
||||
|
@ -11,19 +11,19 @@ Docker installation
|
||||
|
||||
----
|
||||
|
||||
Docker image searx/searx
|
||||
========================
|
||||
Docker image searxng/searxng
|
||||
============================
|
||||
|
||||
|
||||
The docker image is `searx/searx <https://hub.docker.com/r/searx/searx>`_ (based on `github.com/searx/searx <https://github.com/searx/searx>`_).
|
||||
The docker image is `searxng/searxng <https://hub.docker.com/r/searxng/searxng>`_ (based on `github.com/searxng/searxng <https://github.com/searxng/searxng>`_).
|
||||
|
||||
Make sure you have `installed Docker <https://docs.docker.com/get-docker/>`_. For instance, you can deploy a local instance:
|
||||
|
||||
.. code:: sh
|
||||
|
||||
export PORT=80
|
||||
docker pull searx/searx
|
||||
docker run --rm -d -v ${PWD}/searx:/etc/searx -p $PORT:8080 -e BASE_URL=http://localhost:$PORT/ searx/searx
|
||||
docker pull searxng/searxng
|
||||
docker run --rm -d -v ${PWD}/searx:/etc/searx -p $PORT:8080 -e BASE_URL=http://localhost:$PORT/ searxng/searxng
|
||||
|
||||
Go to ``http://localhost:$PORT``.
|
||||
|
||||
@ -37,7 +37,7 @@ Command line
|
||||
|
||||
.. code:: sh
|
||||
|
||||
docker run --rm -it searx/searx -h
|
||||
docker run --rm -it searxng/searxng -h
|
||||
|
||||
.. program-output:: ../dockerfiles/docker-entrypoint.sh help
|
||||
|
||||
@ -45,11 +45,11 @@ Command line
|
||||
Build the image
|
||||
---------------
|
||||
|
||||
It's also possible to build searx from the embedded Dockerfile.
|
||||
It's also possible to build SearXNG from the embedded Dockerfile.
|
||||
|
||||
.. code:: sh
|
||||
|
||||
git clone https://github.com/searx/searx.git
|
||||
git clone https://github.com/searxng/searxng.git
|
||||
cd searx
|
||||
make docker.build
|
||||
|
||||
|
27
manage
27
manage
@ -152,6 +152,10 @@ docker.push() {
|
||||
docker.build push
|
||||
}
|
||||
|
||||
docker.buildx() {
|
||||
docker.build buildx
|
||||
}
|
||||
|
||||
# shellcheck disable=SC2119
|
||||
docker.build() {
|
||||
pyenv.install
|
||||
@ -210,23 +214,34 @@ docker.build() {
|
||||
GITHUB_USER=$(echo "${GIT_URL}" | sed 's/.*github\.com\/\([^\/]*\).*/\1/')
|
||||
SEARX_IMAGE_NAME="${SEARX_IMAGE_NAME:-${GITHUB_USER:-searxng}/searxng}"
|
||||
|
||||
BUILD="build"
|
||||
if [ "$1" = "buildx" ]; then
|
||||
# buildx includes the push option
|
||||
CACHE_TAG="${SEARX_IMAGE_NAME}:latest-build-cache"
|
||||
BUILD="buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 --push --cache-from=type=registry,ref=$CACHE_TAG --cache-to=type=registry,ref=$CACHE_TAG,mode=max"
|
||||
shift
|
||||
fi
|
||||
build_msg DOCKER "Build command: ${BUILD}"
|
||||
|
||||
# build Docker image
|
||||
build_msg DOCKER "Building image ${SEARX_IMAGE_NAME}:${SEARX_GIT_VERSION}"
|
||||
sudo docker build \
|
||||
# shellcheck disable=SC2086
|
||||
docker $BUILD \
|
||||
--build-arg BASE_IMAGE="${DEPENDENCIES_IMAGE_NAME}" \
|
||||
--build-arg GIT_URL="${GIT_URL}" \
|
||||
--build-arg SEARX_GIT_VERSION="${SEARX_GIT_VERSION}" \
|
||||
--build-arg VERSION_GITCOMMIT="${VERSION_GITCOMMIT}" \
|
||||
--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}" \
|
||||
--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_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)" \
|
||||
-t "${SEARX_IMAGE_NAME}:latest" -t "${SEARX_IMAGE_NAME}:${SEARX_GIT_VERSION}" .
|
||||
|
||||
if [ "$1" = "push" ]; then
|
||||
sudo docker push "${SEARX_IMAGE_NAME}:latest"
|
||||
sudo docker push "${SEARX_IMAGE_NAME}:${SEARX_GIT_VERSION}"
|
||||
fi
|
||||
docker push "${SEARX_IMAGE_NAME}:latest"
|
||||
docker push "${SEARX_IMAGE_NAME}:${SEARX_GIT_VERSION}"
|
||||
fi
|
||||
)
|
||||
dump_return $?
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user