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

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
Markus Heiser 2020-03-25 14:50:39 +01:00
parent 757ebb5d9f
commit 3dbade0aed
3 changed files with 13 additions and 4 deletions

View File

@ -4,6 +4,7 @@ EXPOSE 8080
VOLUME /etc/searx VOLUME /etc/searx
VOLUME /var/log/uwsgi VOLUME /var/log/uwsgi
ARG GIT_URL=unknown
ARG VERSION_GITCOMMIT=unknown ARG VERSION_GITCOMMIT=unknown
ARG SEARX_GIT_VERSION=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 # Keep this argument at the end since it change each time
ARG LABEL_DATE= ARG LABEL_DATE=
LABEL maintainer="searx <https://github.com/asciimoo/searx>" \ LABEL maintainer="searx <${GIT_URL}>" \
description="A privacy-respecting, hackable metasearch engine." \ description="A privacy-respecting, hackable metasearch engine." \
version="${SEARX_GIT_VERSION}" \ version="${SEARX_GIT_VERSION}" \
org.label-schema.schema-version="1.0" \ org.label-schema.schema-version="1.0" \

View File

@ -29,6 +29,7 @@ help:
@echo ' clean - drop builds and environments' @echo ' clean - drop builds and environments'
@echo ' project - re-build generic files of the searx project' @echo ' project - re-build generic files of the searx project'
@echo ' themes - re-build build the source of the themes' @echo ' themes - re-build build the source of the themes'
@echo ' docker - build Docker image'
@echo '' @echo ''
@$(MAKE) -s -f utils/makefile.include make-help @$(MAKE) -s -f utils/makefile.include make-help
@echo '' @echo ''
@ -102,6 +103,14 @@ themes.simple:
$(Q)echo '[!] Grunt build : simple theme' $(Q)echo '[!] Grunt build : simple theme'
$(Q)grunt --gruntfile "searx/static/themes/simple/gruntfile.js" $(Q)grunt --gruntfile "searx/static/themes/simple/gruntfile.js"
# docker
# ------
PHONY += docker
docker:
$(Q)./manage.sh docker_build
# test # test
# ---- # ----

View File

@ -202,13 +202,13 @@ docker_build() {
fi fi
# define the docker image name # define the docker image name
# /!\ HACK to get the user name /!\ GITHUB_USER=$(echo "${GIT_URL}" | sed 's/.*github\.com\/\([^\/]*\).*/\1/')
GITHUB_USER=$(git remote get-url origin | sed 's/.*github\.com\/\([^\/]*\).*/\1/')
SEARX_IMAGE_NAME="${GITHUB_USER:-searx}/searx" SEARX_IMAGE_NAME="${GITHUB_USER:-searx}/searx"
# build Docker image # build Docker image
echo "Building image ${SEARX_IMAGE_NAME}:${SEARX_GIT_VERSION}" echo "Building image ${SEARX_IMAGE_NAME}:${SEARX_GIT_VERSION}"
sudo docker build \ sudo docker build \
--build-arg GIT_URL="${GIT_URL}" \
--build-arg SEARX_GIT_VERSION="${SEARX_GIT_VERSION}" \ --build-arg SEARX_GIT_VERSION="${SEARX_GIT_VERSION}" \
--build-arg VERSION_GITCOMMIT="${VERSION_GITCOMMIT}" \ --build-arg VERSION_GITCOMMIT="${VERSION_GITCOMMIT}" \
--build-arg LABEL_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ") \ --build-arg LABEL_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ") \
@ -248,7 +248,6 @@ Commands
----- -----
locales - Compile locales locales - Compile locales
styles - Build less files styles - Build less files
docker_build - Build Docker image
Tests Tests
----- -----