Commit ba033872 authored by Nicolas Gelot's avatar Nicolas Gelot
Browse files

Rework python and docker packages

parent 0203737b
FROM python:3.7-alpine as builder
RUN apk add \
git \
build-base \
libxml2-dev \
libxslt-dev \
libffi-dev \
openssl-dev
# Only to use the docker cache and optimize the build time
WORKDIR /src
COPY requirements.txt /src/requirements.txt
RUN pip3 install --prefix /install -r requirements.txt
COPY . /src/
RUN PYTHONPATH=/install/lib/python3.7/site-packages/ python3 setup.py install --prefix /install
FROM python:3.7-alpine FROM python:3.7-alpine
LABEL maintainer="searx <https://github.com/asciimoo/searx>" LABEL maintainer="searx <https://github.com/asciimoo/searx>"
LABEL description="A privacy-respecting, hackable metasearch engine." LABEL description="A privacy-respecting, hackable metasearch engine."
EXPOSE 8888 RUN apk add \
WORKDIR /usr/local/searx ca-certificates \
CMD ["python", "searx/webapp.py"] libxslt \
openssl \
COPY requirements.txt ./requirements.txt && pip install coverage
RUN apk -U add \
build-base \
libxml2 \
libxml2-dev \
libxslt \
libxslt-dev \
libffi-dev \
openssl \
openssl-dev \
ca-certificates \
&& pip install -r requirements.txt \
&& pip install coverage \
&& apk del \
build-base \
libffi-dev \
openssl-dev \
libxslt-dev \
libxml2-dev \
openssl-dev \
ca-certificates \
&& rm -f /var/cache/apk/*
COPY searx /usr/local/searx/searx
RUN sed -i "s/127.0.0.1/0.0.0.0/g" searx/settings.yml
COPY --from=builder /install/ /usr/local/
EXPOSE 8888
STOPSIGNAL SIGINT STOPSIGNAL SIGINT
CMD ["searx-run"]
...@@ -7,7 +7,7 @@ services: ...@@ -7,7 +7,7 @@ services:
- run - run
- --source=searx - --source=searx
command: command:
- searx/webapp.py - /usr/local/bin/searx-run
volumes: volumes:
- coverage:/coverage - coverage:/coverage
environment: environment:
......
...@@ -59,7 +59,7 @@ functional_tests() { ...@@ -59,7 +59,7 @@ functional_tests() {
} }
coverage() { coverage() {
sed -i 's!/usr/local/searx!'$BASE_DIR'!g' "$COV_DIR"/func sed -i 's!/usr/local/lib/python3.7/site-packages/searx[^/]*/searx!'$SEARX_DIR'!g' "$COV_DIR"/func
coverage3 combine coverage/func coverage/unit coverage3 combine coverage/func coverage/unit
coverage3 report coverage3 report
} }
......
...@@ -11,7 +11,7 @@ search: ...@@ -11,7 +11,7 @@ search:
server: server:
port : 8888 port : 8888
bind_address : "127.0.0.1" # address to listen on bind_address : "0.0.0.0" # address to listen on
secret_key : "ultrasecretkey" # change this! secret_key : "ultrasecretkey" # change this!
base_url : False # Set custom base_url. Possible values: False or "https://your.custom.host/location/" base_url : False # Set custom base_url. Possible values: False or "https://your.custom.host/location/"
image_proxy : False # Proxying image results through searx image_proxy : False # Proxying image results through searx
......
...@@ -16,11 +16,9 @@ along with searx. If not, see < http://www.gnu.org/licenses/ >. ...@@ -16,11 +16,9 @@ along with searx. If not, see < http://www.gnu.org/licenses/ >.
(C) 2013- by Adam Tauber, <asciimoo@gmail.com> (C) 2013- by Adam Tauber, <asciimoo@gmail.com>
''' '''
# version of searx from pkg_resources import get_distribution, DistributionNotFound
VERSION_MAJOR = 0
VERSION_MINOR = 15
VERSION_BUILD = 0
VERSION_STRING = "{0}.{1}.{2}".format(VERSION_MAJOR, try:
VERSION_MINOR, VERSION_STRING = get_distribution("searx").version
VERSION_BUILD) except DistributionNotFound:
VERSION_STRING = "0.0.0"
...@@ -4,27 +4,15 @@ ...@@ -4,27 +4,15 @@
from setuptools import setup from setuptools import setup
from setuptools import find_packages from setuptools import find_packages
import os
import sys
# required to load VERSION_STRING constant requirements = open('requirements.txt').read().splitlines()
sys.path.insert(0, './searx') dev_requirements = open('requirements-dev.txt').read().splitlines()
from version import VERSION_STRING
def read(*rnames):
return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
long_description = read('README.rst')
requirements = map(str.strip, open('requirements.txt').readlines())
dev_requirements = map(str.strip, open('requirements-dev.txt').readlines())
setup( setup(
name='searx', name='searx',
version=VERSION_STRING, use_scm_version=True,
description="A privacy-respecting, hackable metasearch engine", description="A privacy-respecting, hackable metasearch engine",
long_description=long_description, long_description=open('README.rst').read(),
classifiers=[ classifiers=[
"Development Status :: 4 - Beta", "Development Status :: 4 - Beta",
"Programming Language :: Python", "Programming Language :: Python",
...@@ -41,6 +29,7 @@ setup( ...@@ -41,6 +29,7 @@ setup(
packages=find_packages(exclude=["tests*"]), packages=find_packages(exclude=["tests*"]),
zip_safe=False, zip_safe=False,
install_requires=requirements, install_requires=requirements,
setup_requires=["setuptools_scm"],
extras_require={ extras_require={
'test': dev_requirements 'test': dev_requirements
}, },
...@@ -52,9 +41,6 @@ setup( ...@@ -52,9 +41,6 @@ setup(
package_data={ package_data={
'searx': [ 'searx': [
'settings.yml', 'settings.yml',
'../README.rst',
'../requirements.txt',
'../requirements-dev.txt',
'data/*', 'data/*',
'plugins/*/*', 'plugins/*/*',
'static/*.*', 'static/*.*',
...@@ -64,11 +50,7 @@ setup( ...@@ -64,11 +50,7 @@ setup(
'static/*/*/*/*/*.*', 'static/*/*/*/*/*.*',
'templates/*/*.*', 'templates/*/*.*',
'templates/*/*/*.*', 'templates/*/*/*.*',
'tests/*',
'tests/*/*',
'tests/*/*/*',
'translations/*/*/*' 'translations/*/*/*'
], ],
}, },
) )
Markdown is supported
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