diff options
author | Alexandre Flament <alex@al-f.net> | 2021-04-30 16:20:33 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-30 16:20:33 +0200 |
commit | 0ff14fd3ecc6f7669d2148c0e90b8b15bf763038 (patch) | |
tree | d6303520a5c95cc735bd6db611f0ff6e5a1b80e2 | |
parent | e5bcc3cbbecb067b0acd8a7c061d9a16453381ed (diff) | |
parent | 20580bcbd458fa18c13bb9c1a32466ee5af48f97 (diff) | |
download | searxng-0ff14fd3ecc6f7669d2148c0e90b8b15bf763038.tar.gz searxng-0ff14fd3ecc6f7669d2148c0e90b8b15bf763038.zip |
Merge pull request #22 from searxng/docker-buildx
[docker] multiarch build
-rw-r--r-- | .github/workflows/integration.yml | 2 | ||||
-rw-r--r-- | Dockerfile | 6 | ||||
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | docs/admin/installation-docker.rst | 16 | ||||
-rwxr-xr-x | manage | 27 |
5 files changed, 34 insertions, 19 deletions
diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 0068c3964..914ce163f 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -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 diff --git a/Dockerfile b/Dockerfile index 3fbf62f35..477cdb1ec 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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} \ @@ -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 diff --git a/docs/admin/installation-docker.rst b/docs/admin/installation-docker.rst index 13d21bc46..120c9cb08 100644 --- a/docs/admin/installation-docker.rst +++ b/docs/admin/installation-docker.rst @@ -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 @@ -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 $? } |