Browse Source

[fix] brands: add GIT_URL variable to the docker build

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Markus Heiser 5 years ago
parent
commit
3dbade0aed
3 changed files with 13 additions and 4 deletions
  1. 2 1
      Dockerfile
  2. 9 0
      Makefile
  3. 2 3
      manage.sh

+ 2 - 1
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 <https://github.com/asciimoo/searx>" \
+LABEL maintainer="searx <${GIT_URL}>" \
       description="A privacy-respecting, hackable metasearch engine." \
       version="${SEARX_GIT_VERSION}" \
       org.label-schema.schema-version="1.0" \

+ 9 - 0
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
 # ----
 

+ 2 - 3
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
     -----