Commit 51d590ea authored by Nicolas Gelot's avatar Nicolas Gelot
Browse files

Dockerfile, rework the command and termination

To avoid to wait 10s when we stop the spot container, this
patch performs some changes to only run the python binary in the container.
Tini is included in docker itself since 1.13 or greater, so it is removed
and the environments variables are handled in the application, that change avoids
to use a bash script to patch the configuration.
parent 2303d070
......@@ -2,23 +2,15 @@ FROM alpine:3.8
LABEL maintainer="searx <https://github.com/asciimoo/searx>"
LABEL description="A privacy-respecting, hackable metasearch engine."
ENV BASE_URL=False IMAGE_PROXY=False
EXPOSE 8888
WORKDIR /usr/local/searx
CMD ["/sbin/tini","--","/usr/local/searx/run.sh"]
CMD ["python", "searx/webapp.py"]
RUN adduser -D -h /usr/local/searx -s /bin/sh searx searx \
&& echo '#!/bin/sh' >> run.sh \
&& echo 'sed -i "s|base_url : False|base_url : $BASE_URL|g" searx/settings.yml' >> run.sh \
&& echo 'sed -i "s/image_proxy : False/image_proxy : $IMAGE_PROXY/g" searx/settings.yml' >> run.sh \
&& echo 'sed -i "s/ultrasecretkey/`openssl rand -hex 16`/g" searx/settings.yml' >> run.sh \
&& echo 'python searx/webapp.py' >> run.sh \
&& chmod +x run.sh
RUN adduser -D -h /usr/local/searx -s /bin/sh searx searx
COPY requirements.txt ./requirements.txt
RUN echo "@commuedge http://nl.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories \
&& apk -U add \
RUN apk -U add \
build-base \
python \
python-dev \
......@@ -31,7 +23,6 @@ RUN echo "@commuedge http://nl.alpinelinux.org/alpine/edge/community" >> /etc/ap
openssl \
openssl-dev \
ca-certificates \
tini@commuedge \
&& pip install --upgrade pip \
&& pip install --no-cache -r requirements.txt \
&& apk del \
......@@ -52,3 +43,5 @@ RUN chown -R searx:searx *
USER searx
RUN sed -i "s/127.0.0.1/0.0.0.0/g" searx/settings.yml
STOPSIGNAL SIGINT
......@@ -91,3 +91,7 @@ logger.info('Initialisation done')
if 'SEARX_SECRET' in environ:
settings['server']['secret_key'] = environ['SEARX_SECRET']
if 'BASE_URL' in environ:
settings['server']['base_url'] = environ['BASE_URL']
if 'IMAGE_PROXY' in environ:
settings['server']['image_proxy'] = environ['IMAGE_PROXY']
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment