From a670f4d0c68831e28ff750e14a3e66684fdbda64 Mon Sep 17 00:00:00 2001 From: Shyam Jesalpura Date: Fri, 8 Jan 2021 16:26:21 +0530 Subject: [PATCH] fixed the docker image build Signed-off-by: Shyam Jesalpura --- function-images/chameleon/Dockerfile | 6 +++--- function-images/cnn_serving/Dockerfile | 6 ++++-- function-images/helloworld/Dockerfile | 6 +++--- function-images/image_rotate_s3/Dockerfile | 6 +++--- function-images/image_rotate_s3/server.py | 12 ++++++++---- function-images/json_serdes_s3/Dockerfile | 6 +++--- function-images/json_serdes_s3/server.py | 12 ++++++++---- function-images/lr_serving/Dockerfile | 4 ++-- function-images/lr_training_s3/Dockerfile | 2 +- function-images/lr_training_s3/server.py | 11 +++++++---- function-images/pyaes/Dockerfile | 6 +++--- function-images/video_processing_s3/server.py | 12 ++++++++---- 12 files changed, 53 insertions(+), 36 deletions(-) diff --git a/function-images/chameleon/Dockerfile b/function-images/chameleon/Dockerfile index a1aae86e1..6daf4816b 100644 --- a/function-images/chameleon/Dockerfile +++ b/function-images/chameleon/Dockerfile @@ -1,9 +1,9 @@ -FROM ustiugov/py_grpc:builder_grpc as builder_workload -COPY --from=ustiugov/py_grpc:builder_grpc /root/.local /root/.local +FROM vhiveease/py_grpc:builder_grpc as builder_workload +COPY --from=vhiveease/py_grpc:builder_grpc /root/.local /root/.local COPY requirements.txt . RUN pip3 install --user -r requirements.txt -FROM ustiugov/py_grpc:base as var_workload +FROM vhiveease/py_grpc:base as var_workload COPY *.py / COPY --from=builder_workload /root/.local /root/.local RUN apk add libstdc++ --update --no-cache diff --git a/function-images/cnn_serving/Dockerfile b/function-images/cnn_serving/Dockerfile index 27e50d2e7..13c962b7a 100644 --- a/function-images/cnn_serving/Dockerfile +++ b/function-images/cnn_serving/Dockerfile @@ -8,8 +8,9 @@ RUN apk update && \ ln -sf /usr/bin/pip3 /usr/local/bin/pip && \ ln -sf /usr/bin/python3 /usr/local/bin/python && \ ln -sf /usr/bin/python3 /usr/local/bin/python3 && \ - echo "http://dl-8.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories && \ - echo "http://dl-3.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories && \ + ln -s /usr/include/locale.h /usr/include/xlocale.h && \ + echo "http://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories && \ + echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories && \ apk update && \ apk add --upgrade && \ apk add --update --no-cache build-base gcc g++ protobuf && \ @@ -17,6 +18,7 @@ RUN apk update && \ apk add py3-numpy && \ apk add py-numpy-dev && \ pip3 install --upgrade pip && \ + pip3 uninstall -y enum34 && \ pip3 install --no-cache-dir Cython && \ pip3 install --no-cache-dir -r requirements.txt && \ pip3 install --no-cache-dir protobuf==3.11.3 grpcio==${GRPC_PYTHON_VERSION} diff --git a/function-images/helloworld/Dockerfile b/function-images/helloworld/Dockerfile index a1aae86e1..6daf4816b 100644 --- a/function-images/helloworld/Dockerfile +++ b/function-images/helloworld/Dockerfile @@ -1,9 +1,9 @@ -FROM ustiugov/py_grpc:builder_grpc as builder_workload -COPY --from=ustiugov/py_grpc:builder_grpc /root/.local /root/.local +FROM vhiveease/py_grpc:builder_grpc as builder_workload +COPY --from=vhiveease/py_grpc:builder_grpc /root/.local /root/.local COPY requirements.txt . RUN pip3 install --user -r requirements.txt -FROM ustiugov/py_grpc:base as var_workload +FROM vhiveease/py_grpc:base as var_workload COPY *.py / COPY --from=builder_workload /root/.local /root/.local RUN apk add libstdc++ --update --no-cache diff --git a/function-images/image_rotate_s3/Dockerfile b/function-images/image_rotate_s3/Dockerfile index f5aeabbd7..297601d7c 100644 --- a/function-images/image_rotate_s3/Dockerfile +++ b/function-images/image_rotate_s3/Dockerfile @@ -1,12 +1,12 @@ -FROM ustiugov/py_grpc:builder_grpc as builder_workload -COPY --from=ustiugov/py_grpc:builder_grpc /root/.local /root/.local +FROM vhiveease/py_grpc:builder_grpc as builder_workload +COPY --from=vhiveease/py_grpc:builder_grpc /root/.local /root/.local COPY requirements.txt . RUN apk add --no-cache --virtual .build-deps \ build-base linux-headers zlib-dev jpeg-dev \ && pip3 install --user -r requirements.txt \ && apk del .build-deps -FROM ustiugov/py_grpc:base as var_workload +FROM vhiveease/py_grpc:base as var_workload COPY *.py / COPY --from=builder_workload /root/.local /root/.local RUN apk add libstdc++ libjpeg-turbo --update --no-cache diff --git a/function-images/image_rotate_s3/server.py b/function-images/image_rotate_s3/server.py index 691b81dfe..8ac0121c4 100644 --- a/function-images/image_rotate_s3/server.py +++ b/function-images/image_rotate_s3/server.py @@ -1,6 +1,6 @@ from concurrent import futures import logging - +import os import grpc from PIL import Image, ImageOps @@ -9,9 +9,8 @@ import helloworld_pb2_grpc from minio import Minio -from minio.error import (ResponseError, BucketAlreadyOwnedByYou, - BucketAlreadyExists) +minioEnvKey = "MINIO_ADDRESS" image_name = 'img2.jpeg' image2_name = 'img3.jpeg' image_path = '/pulled_' + image_name @@ -19,10 +18,15 @@ responses = ["record_response", "replay_response"] +minioAddress = os.getenv(minioEnvKey) + class Greeter(helloworld_pb2_grpc.GreeterServicer): def SayHello(self, request, context): - minioClient = Minio('128.110.154.105:9000', + if minioAddress == None: + return None + + minioClient = Minio(minioAddress, access_key='minioadmin', secret_key='minioadmin', secure=False) diff --git a/function-images/json_serdes_s3/Dockerfile b/function-images/json_serdes_s3/Dockerfile index a1aae86e1..6daf4816b 100644 --- a/function-images/json_serdes_s3/Dockerfile +++ b/function-images/json_serdes_s3/Dockerfile @@ -1,9 +1,9 @@ -FROM ustiugov/py_grpc:builder_grpc as builder_workload -COPY --from=ustiugov/py_grpc:builder_grpc /root/.local /root/.local +FROM vhiveease/py_grpc:builder_grpc as builder_workload +COPY --from=vhiveease/py_grpc:builder_grpc /root/.local /root/.local COPY requirements.txt . RUN pip3 install --user -r requirements.txt -FROM ustiugov/py_grpc:base as var_workload +FROM vhiveease/py_grpc:base as var_workload COPY *.py / COPY --from=builder_workload /root/.local /root/.local RUN apk add libstdc++ --update --no-cache diff --git a/function-images/json_serdes_s3/server.py b/function-images/json_serdes_s3/server.py index 8ad890fe8..fec779c9c 100644 --- a/function-images/json_serdes_s3/server.py +++ b/function-images/json_serdes_s3/server.py @@ -15,17 +15,16 @@ from concurrent import futures import logging - +import os import grpc import helloworld_pb2 import helloworld_pb2_grpc from minio import Minio -from minio.error import (ResponseError, BucketAlreadyOwnedByYou, - BucketAlreadyExists) import json +minioEnvKey = "MINIO_ADDRESS" data_name = '2.json' data2_name = '1.json' data_path = '/pulled_' + data_name @@ -33,10 +32,15 @@ responses = ["record_response", "replay_response"] +minioAddress = os.getenv(minioEnvKey) + class Greeter(helloworld_pb2_grpc.GreeterServicer): def SayHello(self, request, context): - minioClient = Minio('128.110.154.105:9000', + if minioAddress == None: + return None + + minioClient = Minio(minioAddress, access_key='minioadmin', secret_key='minioadmin', secure=False) diff --git a/function-images/lr_serving/Dockerfile b/function-images/lr_serving/Dockerfile index a1117a51e..4ddec2b94 100644 --- a/function-images/lr_serving/Dockerfile +++ b/function-images/lr_serving/Dockerfile @@ -9,8 +9,8 @@ RUN apk add --no-cache \ \ ln -s locale.h /usr/include/xlocale.h && \ \ - pip install --disable-pip-version-check --no-build-isolation numpy && \ - pip install --disable-pip-version-check --no-build-isolation pandas && \ + pip install --disable-pip-version-check --no-build-isolation numpy==1.19.0 && \ + pip install --disable-pip-version-check --no-build-isolation pandas==1.0.5 && \ pip install --disable-pip-version-check --no-build-isolation protobuf==3.11.3 && \ pip install --disable-pip-version-check --no-build-isolation grpcio==1.26.0 && \ \ diff --git a/function-images/lr_training_s3/Dockerfile b/function-images/lr_training_s3/Dockerfile index 286389da9..bcce1481a 100644 --- a/function-images/lr_training_s3/Dockerfile +++ b/function-images/lr_training_s3/Dockerfile @@ -1,4 +1,4 @@ -FROM ustiugov/lr_serving:var_workload as var_workload +FROM vhiveease/lr_serving:var_workload as var_workload COPY requirements.txt . RUN pip3 install --no-cache-dir -r requirements.txt diff --git a/function-images/lr_training_s3/server.py b/function-images/lr_training_s3/server.py index 1697394be..bcbc7a240 100644 --- a/function-images/lr_training_s3/server.py +++ b/function-images/lr_training_s3/server.py @@ -1,10 +1,8 @@ from concurrent import futures import logging - +import os import grpc from minio import Minio -from minio.error import (ResponseError, BucketAlreadyOwnedByYou, - BucketAlreadyExists) from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.linear_model import LogisticRegression import joblib @@ -24,16 +22,21 @@ def cleanup(sentence): sentence = cleanup_re.sub(' ', sentence).strip() return sentence +minioEnvKey = "MINIO_ADDRESS" df_name = 'dataset.csv' df2_name = 'dataset2.csv' df_path = '/pulled_' + df_name df2_path = 'pulled_' + df2_name +minioAddress = os.getenv(minioEnvKey) class Greeter(helloworld_pb2_grpc.GreeterServicer): def SayHello(self, request, context): - minioClient = Minio('128.110.154.105:9000', + if minioAddress == None: + return None + + minioClient = Minio(minioAddress, access_key='minioadmin', secret_key='minioadmin', secure=False) diff --git a/function-images/pyaes/Dockerfile b/function-images/pyaes/Dockerfile index a1aae86e1..6daf4816b 100644 --- a/function-images/pyaes/Dockerfile +++ b/function-images/pyaes/Dockerfile @@ -1,9 +1,9 @@ -FROM ustiugov/py_grpc:builder_grpc as builder_workload -COPY --from=ustiugov/py_grpc:builder_grpc /root/.local /root/.local +FROM vhiveease/py_grpc:builder_grpc as builder_workload +COPY --from=vhiveease/py_grpc:builder_grpc /root/.local /root/.local COPY requirements.txt . RUN pip3 install --user -r requirements.txt -FROM ustiugov/py_grpc:base as var_workload +FROM vhiveease/py_grpc:base as var_workload COPY *.py / COPY --from=builder_workload /root/.local /root/.local RUN apk add libstdc++ --update --no-cache diff --git a/function-images/video_processing_s3/server.py b/function-images/video_processing_s3/server.py index ec92b6147..240127b22 100644 --- a/function-images/video_processing_s3/server.py +++ b/function-images/video_processing_s3/server.py @@ -2,19 +2,20 @@ import logging import cv2 from minio import Minio -from minio.error import (ResponseError, BucketAlreadyOwnedByYou, - BucketAlreadyExists) import grpc - +import os import helloworld_pb2 import helloworld_pb2_grpc tmp = "/tmp/" +minioEnvKey = "MINIO_ADDRESS" vid1_name = 'vid1.mp4' vid2_name = 'vid2.mp4' vid1_path = '/pulled_' + vid1_name vid2_path = '/pulled_' + vid2_name +minioAddress = os.getenv(minioEnvKey) + def video_processing(video_path): result_file_path = tmp + video_path @@ -47,7 +48,10 @@ def video_processing(video_path): class Greeter(helloworld_pb2_grpc.GreeterServicer): def SayHello(self, request, context): - minioClient = Minio('128.110.154.105:9000', + if minioAddress == None: + return None + + minioClient = Minio(minioAddress, access_key='minioadmin', secret_key='minioadmin', secure=False)