From cc72cf2b59d973343a526c0009b3b1cf8389a186 Mon Sep 17 00:00:00 2001 From: hanhxiao Date: Thu, 12 Sep 2019 12:13:13 +0800 Subject: [PATCH] revert(docker): revert alpine docker to reduce size --- Dockerfiles/alpine.Dockerfile | 17 ++++++++--------- gnes/service/frontend.py | 5 ++++- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/Dockerfiles/alpine.Dockerfile b/Dockerfiles/alpine.Dockerfile index b55f9c3f..54358ec3 100644 --- a/Dockerfiles/alpine.Dockerfile +++ b/Dockerfiles/alpine.Dockerfile @@ -9,25 +9,24 @@ LABEL maintainer="team@gnes.ai" \ org.label-schema.build-date=$BUILD_DATE \ org.label-schema.name="GNES is Generic Nerual Elastic Search" -RUN apk add --no-cache \ - --virtual=.build-dependencies \ - build-base g++ gfortran file binutils zeromq-dev \ - musl-dev python3-dev py-pgen cython openblas-dev && \ - apk add --no-cache libstdc++ openblas libzmq - - WORKDIR /gnes/ ADD . ./ -RUN ln -s locale.h /usr/include/xlocale.h && \ +RUN apk add --no-cache \ + --virtual=.build-dependencies \ + build-base g++ gfortran file binutils zeromq-dev \ + 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 && \ 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 && \ rm -rf /tmp/* && \ rm -rf /gnes && \ - apk del .build-dependencies + apk del .build-dependencies && \ + rm -rf /var/cache/apk/* WORKDIR / diff --git a/gnes/service/frontend.py b/gnes/service/frontend.py index 93a30058..efd6831e 100644 --- a/gnes/service/frontend.py +++ b/gnes/service/frontend.py @@ -17,8 +17,9 @@ import threading from concurrent.futures import ThreadPoolExecutor -import grpc +import grpc +from .. import __version__, __proto_version__ from ..client.base import ZmqClient from ..helper import set_logger from ..proto import gnes_pb2_grpc, gnes_pb2, router2str @@ -66,6 +67,8 @@ def add_envelope(self, body: 'gnes_pb2.Request', zmq_client: 'ZmqClient'): msg.envelope.part_id = 1 msg.envelope.num_part.append(1) msg.envelope.timeout = 5000 + msg.envelope.gnes_version = __version__ + msg.envelope.proto_version = __proto_version__ r = msg.envelope.routes.add() r.service = FrontendService.__name__ r.timestamp.GetCurrentTime()