forked from AxisCommunications/acap-runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.proto
62 lines (47 loc) · 2.13 KB
/
Dockerfile.proto
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
ARG UBUNTU_VERSION=22.04
ARG TFSERVING_VERSION=2.9.0
# Build image, genearates proto files
FROM arm64v8/ubuntu:${UBUNTU_VERSION} AS build-image
ARG TFSERVING_VERSION
RUN <<EOF
apt-get update && apt-get install -y --no-install-recommends \
python3 \
python3-pip \
git \
&& rm -rf /var/lib/apt/lists/*
EOF
# grpcio-tools contains protoc, which allows to build the pb2.py files in the install-tf.sh script.
# Installing directly grpcio-tools result in an older version of protobuf.
# So we install first the dependencies with the desired version and then grpcio-tool without dependencies.
RUN pip install protobuf==4.21.1 six==1.16.0 grpcio==1.46.3 --no-cache-dir
RUN pip install --no-dependencies grpcio-tools==1.47.0
#Build tensorflow serving
WORKDIR /build/tf
RUN <<EOF
git clone --depth 1 --branch v${TFSERVING_VERSION} https://github.com/tensorflow/tensorflow.git
git clone --depth 1 --branch ${TFSERVING_VERSION} https://github.com/tensorflow/serving.git
TF_DIR="./tensorflow"
TFS_DIR="./serving"
OUT_DIR="./proto_utils"
mkdir $OUT_DIR
PROTO_FILES="$TF_DIR/tensorflow/core/example/*.proto
$TF_DIR/tensorflow/core/framework/*.proto \
$TF_DIR/tensorflow/core/protobuf/*.proto \
$TFS_DIR/tensorflow_serving/apis/*.proto \
"
PROTO_FILES_GRPC="$TFS_DIR/tensorflow_serving/apis/predict.proto \
$TFS_DIR/tensorflow_serving/apis/prediction_service.proto \
"
python3 -m grpc_tools.protoc -I "$TF_DIR" -I "$TFS_DIR" --python_out="$OUT_DIR" $PROTO_FILES
python3 -m grpc_tools.protoc -I "$TF_DIR" -I "$TFS_DIR" --grpc_python_out="$OUT_DIR" $PROTO_FILES_GRPC
EOF
COPY apis/wrappers/tf_proto_utils.py ./proto_utils
#Build vdo proto
WORKDIR /build/vdo
COPY apis/videocapture.proto ./
RUN mkdir ./proto_utils && python3 -m grpc_tools.protoc -I . --python_out=./proto_utils --grpc_python_out=./proto_utils videocapture.proto
COPY apis/wrappers/vdo_proto_utils.py ./proto_utils
#Build keyvalue proto
WORKDIR /build/param
COPY apis/keyvaluestore.proto ./
RUN mkdir ./proto_utils && python3 -m grpc_tools.protoc -I . --python_out=./proto_utils --grpc_python_out=./proto_utils keyvaluestore.proto