1
0
mirror of https://github.com/searxng/searxng.git synced 2024-11-22 12:10:11 +01:00

Better Dockerfile

This commit is contained in:
Wonderfall 2016-01-03 15:17:59 +01:00
parent 2dc067f026
commit 414c4f4ca4

View File

@ -1,9 +1,14 @@
FROM alpine:3.3 FROM alpine:3.3
MAINTAINER Wonderfall <wonderfall@opmbx.org>
ENV BASE_URL=False IMAGE_PROXY=False ENV BASE_URL=False IMAGE_PROXY=False
COPY . /usr/local/searx EXPOSE 8888
WORKDIR /usr/local/searx
CMD ["./run.sh"]
COPY requirements.txt /usr/local/searx/requirements.txt
RUN apk -U add \ RUN apk -U add \
build-base \ build-base \
@ -18,13 +23,7 @@ RUN apk -U add \
openssl \ openssl \
openssl-dev \ openssl-dev \
ca-certificates \ ca-certificates \
&& adduser -D -h /usr/local/searx -s /bin/sh searx searx \ && pip install --no-cache -r /usr/local/searx/requirements.txt \
&& cd /usr/local/searx \
&& pip install --no-cache -r requirements.txt \
&& sed -i "s/127.0.0.1/0.0.0.0/g" searx/settings.yml \
&& sed -i "s/ultrasecretkey/`openssl rand -hex 16`/g" searx/settings.yml \
&& sed -i "s|base_url : False|base_url : $BASE_URL|g" searx/settings.yml \
&& sed -i "s/image_proxy : False/image_proxy : $IMAGE_PROXY/g" searx/settings.yml \
&& apk del \ && apk del \
build-base \ build-base \
python-dev \ python-dev \
@ -35,10 +34,21 @@ RUN apk -U add \
libxml2-dev \ libxml2-dev \
openssl-dev \ openssl-dev \
ca-certificates \ ca-certificates \
&& chown -R searx:searx /usr/local/searx \
&& rm -f /var/cache/apk/* && rm -f /var/cache/apk/*
EXPOSE 8888 COPY . /usr/local/searx
RUN adduser -D -h /usr/local/searx -s /bin/sh searx searx \
&& chown -R searx:searx /usr/local/searx
USER searx USER searx
WORKDIR /usr/local/searx
CMD ["python", "searx/webapp.py"] RUN cd /usr/local/searx \
&& sed -i "s/127.0.0.1/0.0.0.0/g" searx/settings.yml \
&& sed -i "s/ultrasecretkey/`openssl rand -hex 16`/g" searx/settings.yml
RUN 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.setting.yml' >> run.sh \
&& echo 'python searx/webapp.py' >> run.sh \
&& chmod +x run.sh