on master help sign in
[fix] brands: add GIT_URL variable to the docker build
3dbade0Markus Heiser
Dockerfile+2−1
@@ -4,6 +4,7 @@ EXPOSE 8080
4VOLUME /etc/searx
4VOLUME /etc/searx
5VOLUME /var/log/uwsgi
5VOLUME /var/log/uwsgi
6
6
7+ARG GIT_URL=unknown
7ARG VERSION_GITCOMMIT=unknown
8ARG VERSION_GITCOMMIT=unknown
8ARG SEARX_GIT_VERSION=unknown
9ARG SEARX_GIT_VERSION=unknown
9
10
@@ -66,7 +67,7 @@ RUN su searx -c "/usr/bin/python3 -m compileall -q searx"; \
66
67
67# Keep this argument at the end since it change each time
68# Keep this argument at the end since it change each time
68ARG LABEL_DATE=
69ARG LABEL_DATE=
69−LABEL maintainer="searx <https://github.com/asciimoo/searx>" \
70+LABEL maintainer="searx <${GIT_URL}>" \
70 description="A privacy-respecting, hackable metasearch engine." \
71 description="A privacy-respecting, hackable metasearch engine." \
71 version="${SEARX_GIT_VERSION}" \
72 version="${SEARX_GIT_VERSION}" \
72 org.label-schema.schema-version="1.0" \
73 org.label-schema.schema-version="1.0" \
Makefile+9
@@ -29,6 +29,7 @@ help:
29 @echo ' clean - drop builds and environments'
29 @echo ' clean - drop builds and environments'
30 @echo ' project - re-build generic files of the searx project'
30 @echo ' project - re-build generic files of the searx project'
31 @echo ' themes - re-build build the source of the themes'
31 @echo ' themes - re-build build the source of the themes'
32+ @echo ' docker - build Docker image'
32 @echo ''
33 @echo ''
33 @$(MAKE) -s -f utils/makefile.include make-help
34 @$(MAKE) -s -f utils/makefile.include make-help
34 @echo ''
35 @echo ''
@@ -102,6 +103,14 @@ themes.simple:
102 $(Q)echo '[!] Grunt build : simple theme'
103 $(Q)echo '[!] Grunt build : simple theme'
103 $(Q)grunt --gruntfile "searx/static/themes/simple/gruntfile.js"
104 $(Q)grunt --gruntfile "searx/static/themes/simple/gruntfile.js"
104
105
106+# docker
107+# ------
108+
109+PHONY += docker
110+docker:
111+ $(Q)./manage.sh docker_build
112+
113+
105# test
114# test
106# ----
115# ----
107
116
manage.sh+2−3
@@ -202,13 +202,13 @@ docker_build() {
202 fi
202 fi
203
203
204 # define the docker image name
204 # 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/')
207 SEARX_IMAGE_NAME="${GITHUB_USER:-searx}/searx"
206 SEARX_IMAGE_NAME="${GITHUB_USER:-searx}/searx"
208
207
209 # build Docker image
208 # build Docker image
210 echo "Building image ${SEARX_IMAGE_NAME}:${SEARX_GIT_VERSION}"
209 echo "Building image ${SEARX_IMAGE_NAME}:${SEARX_GIT_VERSION}"
211 sudo docker build \
210 sudo docker build \
211+ --build-arg GIT_URL="${GIT_URL}" \
212 --build-arg SEARX_GIT_VERSION="${SEARX_GIT_VERSION}" \
212 --build-arg SEARX_GIT_VERSION="${SEARX_GIT_VERSION}" \
213 --build-arg VERSION_GITCOMMIT="${VERSION_GITCOMMIT}" \
213 --build-arg VERSION_GITCOMMIT="${VERSION_GITCOMMIT}" \
214 --build-arg LABEL_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ") \
214 --build-arg LABEL_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ") \
@@ -248,7 +248,6 @@ Commands
248 -----
248 -----
249 locales - Compile locales
249 locales - Compile locales
250 styles - Build less files
250 styles - Build less files
251− docker_build - Build Docker image
252
251
253 Tests
252 Tests
254 -----
253 -----