on master help sign in
[fix] brands: add GIT_URL variable to the docker build

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>

commit3dbade0aed048e6001f2ed0f261c7d26f04768ba authorMarkus Heiser <markus.heiser@darmarit.de> dateWed 25 Mar 2020, 14:50 (7 years ago) parent757ebb5
3 files changed+13−4
Dockerfile+2−1 Makefile+9 manage.sh+2−3
Dockerfile+2−1
@@ -4,6 +4,7 @@ EXPOSE 8080
44VOLUME /etc/searx
55VOLUME /var/log/uwsgi
66
7+ARG GIT_URL=unknown
78ARG VERSION_GITCOMMIT=unknown
89ARG SEARX_GIT_VERSION=unknown
910
@@ -66,7 +67,7 @@ RUN su searx -c "/usr/bin/python3 -m compileall -q searx"; \
6667
6768# Keep this argument at the end since it change each time
6869ARG LABEL_DATE=
69−LABEL maintainer="searx <https://github.com/asciimoo/searx>" \
70+LABEL maintainer="searx <${GIT_URL}>" \
7071 description="A privacy-respecting, hackable metasearch engine." \
7172 version="${SEARX_GIT_VERSION}" \
7273 org.label-schema.schema-version="1.0" \
Makefile+9
@@ -29,6 +29,7 @@ help:
2929 @echo ' clean - drop builds and environments'
3030 @echo ' project - re-build generic files of the searx project'
3131 @echo ' themes - re-build build the source of the themes'
32+ @echo ' docker - build Docker image'
3233 @echo ''
3334 @$(MAKE) -s -f utils/makefile.include make-help
3435 @echo ''
@@ -102,6 +103,14 @@ themes.simple:
102103 $(Q)echo '[!] Grunt build : simple theme'
103104 $(Q)grunt --gruntfile "searx/static/themes/simple/gruntfile.js"
104105
106+# docker
107+# ------
108+
109+PHONY += docker
110+docker:
111+ $(Q)./manage.sh docker_build
112+
113+
105114# test
106115# ----
107116
manage.sh+2−3
@@ -202,13 +202,13 @@ docker_build() {
202202 fi
203203
204204 # define the docker image name
205− # /!\ HACK to get the user name /!\
206− GITHUB_USER=$(git remote get-url origin | sed 's/.*github\.com\/\([^\/]*\).*/\1/')
205+ GITHUB_USER=$(echo "${GIT_URL}" | sed 's/.*github\.com\/\([^\/]*\).*/\1/')
207206 SEARX_IMAGE_NAME="${GITHUB_USER:-searx}/searx"
208207
209208 # build Docker image
210209 echo "Building image ${SEARX_IMAGE_NAME}:${SEARX_GIT_VERSION}"
211210 sudo docker build \
211+ --build-arg GIT_URL="${GIT_URL}" \
212212 --build-arg SEARX_GIT_VERSION="${SEARX_GIT_VERSION}" \
213213 --build-arg VERSION_GITCOMMIT="${VERSION_GITCOMMIT}" \
214214 --build-arg LABEL_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ") \
@@ -248,7 +248,6 @@ Commands
248248 -----
249249 locales - Compile locales
250250 styles - Build less files
251− docker_build - Build Docker image
252251
253252 Tests
254253 -----