From 3dbade0aed048e6001f2ed0f261c7d26f04768ba Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Wed, 25 Mar 2020 14:50:39 +0100 Subject: [PATCH] [fix] brands: add GIT_URL variable to the docker build Signed-off-by: Markus Heiser --- Dockerfile | 3 ++- Makefile | 9 +++++++++ manage.sh | 5 ++--- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9885fb794..700a21ffc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,6 +4,7 @@ EXPOSE 8080 VOLUME /etc/searx VOLUME /var/log/uwsgi +ARG GIT_URL=unknown ARG VERSION_GITCOMMIT=unknown ARG SEARX_GIT_VERSION=unknown @@ -66,7 +67,7 @@ RUN su searx -c "/usr/bin/python3 -m compileall -q searx"; \ # Keep this argument at the end since it change each time ARG LABEL_DATE= -LABEL maintainer="searx " \ +LABEL maintainer="searx <${GIT_URL}>" \ description="A privacy-respecting, hackable metasearch engine." \ version="${SEARX_GIT_VERSION}" \ org.label-schema.schema-version="1.0" \ diff --git a/Makefile b/Makefile index 4914a309e..f81b4e1de 100644 --- a/Makefile +++ b/Makefile @@ -29,6 +29,7 @@ help: @echo ' clean - drop builds and environments' @echo ' project - re-build generic files of the searx project' @echo ' themes - re-build build the source of the themes' + @echo ' docker - build Docker image' @echo '' @$(MAKE) -s -f utils/makefile.include make-help @echo '' @@ -102,6 +103,14 @@ themes.simple: $(Q)echo '[!] Grunt build : simple theme' $(Q)grunt --gruntfile "searx/static/themes/simple/gruntfile.js" +# docker +# ------ + +PHONY += docker +docker: + $(Q)./manage.sh docker_build + + # test # ---- diff --git a/manage.sh b/manage.sh index 0551f02d3..bb3fe8831 100755 --- a/manage.sh +++ b/manage.sh @@ -202,13 +202,13 @@ docker_build() { fi # define the docker image name - # /!\ HACK to get the user name /!\ - GITHUB_USER=$(git remote get-url origin | sed 's/.*github\.com\/\([^\/]*\).*/\1/') + GITHUB_USER=$(echo "${GIT_URL}" | sed 's/.*github\.com\/\([^\/]*\).*/\1/') SEARX_IMAGE_NAME="${GITHUB_USER:-searx}/searx" # build Docker image echo "Building image ${SEARX_IMAGE_NAME}:${SEARX_GIT_VERSION}" sudo docker build \ + --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") \ @@ -248,7 +248,6 @@ Commands ----- locales - Compile locales styles - Build less files - docker_build - Build Docker image Tests -----