From d7b42d3957fa0395ea1ac34da188bf93d348990c Mon Sep 17 00:00:00 2001 From: hanhxiao Date: Tue, 13 Aug 2019 19:52:53 +0800 Subject: [PATCH] fix(setup): remove unused dependencies --- Dockerfile | 21 --------------------- Dockerfiles/alpine.Dockerfile | 2 +- Dockerfiles/buster.Dockerfile | 2 +- Dockerfiles/ubuntu.Dockerfile | 2 +- gnes/cli/parser.py | 2 +- gnes/composer/flask.py | 2 -- setup.py | 2 +- 7 files changed, 5 insertions(+), 28 deletions(-) delete mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 35b355ba..00000000 --- a/Dockerfile +++ /dev/null @@ -1,21 +0,0 @@ -FROM gnes/build-base:latest AS dependency - -WORKDIR /gnes/ - -COPY setup.py ./setup.py - -RUN python -c "import distutils.core;s=distutils.core.run_setup('setup.py').install_requires;f=open('requirements_tmp.txt', 'w');[f.write(v+'\n') for v in s];f.close()" && cat requirements_tmp.txt - -RUN pip --no-cache-dir install -r requirements_tmp.txt - -FROM dependency as base - -ADD . ./ - - -RUN pip --no-cache-dir install .[all] \ - && rm -rf /tmp/* - -WORKDIR / - -ENTRYPOINT ["gnes"] \ No newline at end of file diff --git a/Dockerfiles/alpine.Dockerfile b/Dockerfiles/alpine.Dockerfile index 7ec93487..83e0ff5b 100644 --- a/Dockerfiles/alpine.Dockerfile +++ b/Dockerfiles/alpine.Dockerfile @@ -10,7 +10,7 @@ RUN apk add --no-cache \ musl-dev python3-dev py-pgen cython openblas-dev && \ apk add --no-cache libstdc++ openblas libzmq && \ ln -s locale.h /usr/include/xlocale.h && \ - pip install . --no-cache-dir --compile && \ + pip install .[http] --no-cache-dir --compile && \ find /usr/lib/python3.7/ -name 'tests' -exec rm -r '{}' + && \ find /usr/lib/python3.7/site-packages/ -name '*.so' -print -exec sh -c 'file "{}" | grep -q "not stripped" && strip -s "{}"' \; && \ rm /usr/include/xlocale.h && \ diff --git a/Dockerfiles/buster.Dockerfile b/Dockerfiles/buster.Dockerfile index b68a67c2..34954209 100644 --- a/Dockerfiles/buster.Dockerfile +++ b/Dockerfiles/buster.Dockerfile @@ -8,7 +8,7 @@ RUN apt-get update && apt-get install --no-install-recommends -y \ build-essential \ python3-dev libopenblas-dev && \ ln -s locale.h /usr/include/xlocale.h && \ - pip install . --no-cache-dir --compile && \ + pip install .[http] --no-cache-dir --compile && \ rm -rf /tmp/* && rm -rf /gnes && \ apt-get autoremove && apt-get clean && rm -rf /var/lib/apt/lists/* && \ rm /usr/include/xlocale.h diff --git a/Dockerfiles/ubuntu.Dockerfile b/Dockerfiles/ubuntu.Dockerfile index 0d6e51cd..78ba2c8c 100644 --- a/Dockerfiles/ubuntu.Dockerfile +++ b/Dockerfiles/ubuntu.Dockerfile @@ -15,7 +15,7 @@ RUN apt-get update && apt-get install --no-install-recommends -y \ build-essential python3-dev python3-pip python3-setuptools libopenblas-dev && \ export LC_ALL=en_US.UTF-8 && export LANG=en_US.UTF-8 && export LC_CTYPE=en_US.UTF-8 && \ ln -s /usr/bin/python3 python && \ - pip3 install . --no-cache-dir --compile && \ + pip3 install .[http] --no-cache-dir --compile && \ rm -rf /tmp/* && rm -rf /gnes && \ apt-get autoremove && apt-get clean && rm -rf /var/lib/apt/lists/* diff --git a/gnes/cli/parser.py b/gnes/cli/parser.py index 63ea53c9..b1528793 100644 --- a/gnes/cli/parser.py +++ b/gnes/cli/parser.py @@ -87,7 +87,7 @@ def set_composer_parser(parser=None): parser.add_argument('--mermaid_leftright', action='store_true', default=False, help='showing the flow in left-to-right manner rather than top down') parser.add_argument('--docker_img', type=str, - default='gnes/gnes:latest', + default='gnes/gnes:alpine-latest', help='the docker image used in Docker Swarm & Kubernetes') return parser diff --git a/gnes/composer/flask.py b/gnes/composer/flask.py index 13f47aa4..2a2e34ef 100644 --- a/gnes/composer/flask.py +++ b/gnes/composer/flask.py @@ -27,7 +27,6 @@ def __init__(self, args): def _create_flask_app(self): try: from flask import Flask, request - from flask_compress import Compress except ImportError: raise ImportError('Flask or its dependencies are not fully installed, ' 'they are required for serving HTTP requests.' @@ -69,7 +68,6 @@ def _regenerate(): self.logger.error(e) return '

Bad YAML input

please kindly check the format, indent and content of your YAML file!', 400 - Compress().init_app(app) return app def run(self): diff --git a/setup.py b/setup.py index 810f4a18..327e3f79 100644 --- a/setup.py +++ b/setup.py @@ -51,7 +51,7 @@ 'vision': ['opencv-python>=4.0.0', 'imagehash>=4.0'], 'leveldb': ['plyvel>=1.0.5'], 'test': ['pylint', 'memory_profiler>=0.55.0', 'psutil>=5.6.1', 'gputil>=1.4.0'], - 'http': ['flask', 'flask-compress', 'flask-cors', 'flask-json', 'aiohttp==3.5.4'], + 'http': ['flask', 'flask-compress', 'aiohttp==3.5.4'], 'onnx': ['onnxruntime'], 'librosa': ['librosa>=0.7.0'], 'scipy': ['scipy']