on master help sign in
Merge branch 'master' of https://github.com/asciimoo/searx
commit3bbdb23fd86a65d9c982aa34ee42326fa3dd9bc1 authora01200356 <a01200356@itesm.mx> dateFri 8 Jan 2016, 11:15 (11 years ago) parent8ca574444c7eac
2 files changed+45−16
Dockerfile+43−15 searx/__init__.py+2−1
Dockerfile+43−15
@@ -1,22 +1,50 @@
1−FROM python:2.7-slim
1+FROM alpine:3.3
22
3−WORKDIR /app
3+ENV BASE_URL=False IMAGE_PROXY=False
4+EXPOSE 8888
5+WORKDIR /usr/local/searx
6+CMD ["./run.sh"]
47
5−RUN useradd searx
8+RUN adduser -D -h /usr/local/searx -s /bin/sh searx searx \
9+ && echo '#!/bin/sh' >> run.sh \
10+ && echo 'sed -i "s|base_url : False|base_url : $BASE_URL|g" searx/settings.yml' >> run.sh \
11+ && echo 'sed -i "s/image_proxy : False/image_proxy : $IMAGE_PROXY/g" searx.setting.yml' >> run.sh \
12+ && echo 'sed -i "s/ultrasecretkey/`openssl rand -hex 16`/g" searx/settings.yml' >> run.sh \
13+ && echo 'python searx/webapp.py' >> run.sh \
14+ && chmod +x run.sh
615
7−EXPOSE 5000
8−CMD ["/usr/local/bin/uwsgi", "--uid", "searx", "--gid", "searx", "--http", ":5000", "-w", "searx.webapp"]
16+COPY requirements.txt .
917
10−RUN apt-get update && \
11− apt-get install -y --no-install-recommends \
12− zlib1g-dev libxml2-dev libxslt1-dev libffi-dev build-essential \
13− libssl-dev openssl && \
14− rm -rf /var/lib/apt/lists/*
18+RUN apk -U add \
19+ build-base \
20+ python \
21+ python-dev \
22+ py-pip \
23+ libxml2 \
24+ libxml2-dev \
25+ libxslt \
26+ libxslt-dev \
27+ libffi-dev \
28+ openssl \
29+ openssl-dev \
30+ ca-certificates \
31+ && pip install --no-cache -r requirements.txt \
32+ && apk del \
33+ build-base \
34+ python-dev \
35+ py-pip\
36+ libffi-dev \
37+ openssl-dev \
38+ libxslt-dev \
39+ libxml2-dev \
40+ openssl-dev \
41+ ca-certificates \
42+ && rm -f /var/cache/apk/*
1543
16−RUN pip install --no-cache uwsgi
44+COPY . .
1745
18−COPY requirements.txt /app/requirements.txt
19−RUN pip install --no-cache -r requirements.txt
46+RUN chown -R searx:searx *
2047
21−COPY . /app
22−RUN sed -i -e "s/ultrasecretkey/`openssl rand -hex 16`/g" searx/settings.yml
48+USER searx
49+
50+RUN sed -i "s/127.0.0.1/0.0.0.0/g" searx/settings.yml
searx/__init__.py+2−1
@@ -52,7 +52,8 @@ logger = logging.getLogger('searx')
5252# Workaround for openssl versions <1.0.2
5353# https://github.com/certifi/python-certifi/issues/26
5454if OPENSSL_VERSION_INFO[0:3] < (1, 0, 2):
55− environ['REQUESTS_CA_BUNDLE'] = certifi.old_where()
55+ if hasattr(certifi, 'old_where'):
56+ environ['REQUESTS_CA_BUNDLE'] = certifi.old_where()
5657 logger.warning('You are using an old openssl version({0}), please upgrade above 1.0.2!'.format(OPENSSL_VERSION))
5758
5859logger.info('Initialisation done')