@@ -9,7 +9,8 @@ FROM arm64v8/ubuntu:${UBUNTU_VERSION} AS containerized_aarch64
9
9
FROM arm32v7/ubuntu:${UBUNTU_VERSION} AS containerized_armv7hf
10
10
11
11
FROM ${REPO}/acap-native-sdk:${VERSION}-${ARCH}-ubuntu${UBUNTU_VERSION} AS acap-native-sdk
12
- FROM acap-native-sdk AS build
12
+
13
+ FROM acap-native-sdk AS build_base
13
14
14
15
ARG ARCH
15
16
ARG TARGETSYSROOT=/opt/axis/acapsdk/sysroots/${ARCH}
@@ -19,6 +20,7 @@ WORKDIR ${TARGETSYSROOT}/usr/lib
19
20
RUN [ -z "$(ls libabsl*.so*)" ] || rm -f libabsl*.so*
20
21
21
22
# Install openssl (to use instead of boringssl)
23
+ # hadolint ignore=DL3009
22
24
RUN <<EOF
23
25
apt-get update
24
26
apt-get install -y --no-install-recommends \
@@ -30,6 +32,18 @@ apt-get install -y --no-install-recommends \
30
32
openssl
31
33
EOF
32
34
35
+ FROM build_base AS tensorflow
36
+
37
+ WORKDIR /opt
38
+
39
+ # Get TensorFlow and TensorFlow Serving - doing this in parallel saves a little bit of time
40
+ RUN <<EOF
41
+ git clone -b r2.9 https://github.com/tensorflow/tensorflow.git /opt/tensorflow/tensorflow
42
+ git clone -b r2.9 https://github.com/tensorflow/serving.git /opt/tensorflow/serving
43
+ EOF
44
+
45
+ FROM build_base AS testdata
46
+
33
47
# Install Edge TPU compiler
34
48
SHELL ["/bin/bash" , "-o" , "pipefail" , "-c" ]
35
49
RUN <<EOF
@@ -77,6 +91,11 @@ RUN <<EOF
77
91
rm -rf tmp
78
92
EOF
79
93
94
+ FROM build_base AS build_grpc
95
+
96
+ ARG ARCH
97
+ ARG TARGETSYSROOT=/opt/axis/acapsdk/sysroots/${ARCH}
98
+
80
99
# Switch to build directory
81
100
WORKDIR /opt
82
101
@@ -108,6 +127,11 @@ RUN <<EOF
108
127
make -j4 install
109
128
EOF
110
129
130
+ FROM build_grpc AS build_grpc_arm
131
+
132
+ ARG ARCH
133
+ ARG TARGETSYSROOT=/opt/axis/acapsdk/sysroots/${ARCH}
134
+
111
135
# return to build dir
112
136
WORKDIR /opt
113
137
# Build for ARM
@@ -151,11 +175,14 @@ RUN <<EOF
151
175
"$SDKTARGETSYSROOT" /usr/include
152
176
EOF
153
177
154
- # Get TensorFlow and TensorFlow Serving
155
- RUN <<EOF
156
- git clone -b r2.9 https://github.com/tensorflow/tensorflow.git /opt/tensorflow/tensorflow
157
- git clone -b r2.9 https://github.com/tensorflow/serving.git /opt/tensorflow/serving
158
- EOF
178
+ FROM build_grpc_arm AS build
179
+
180
+ ARG TEST
181
+ ARG DEBUG
182
+
183
+ # Get TensorFlow, TensorFlow Serving and testdata that we pulled in paralell
184
+ COPY --from=tensorflow /opt/tensorflow /opt/tensorflow
185
+ COPY --from=testdata /opt/app/testdata /opt/app/testdata
159
186
160
187
# # Setup build structure
161
188
WORKDIR /opt/app
@@ -172,10 +199,7 @@ RUN patch /opt/app/apis/tensorflow_serving/apis/predict.proto /opt/app/apis/pred
172
199
173
200
# Building the ACAP application
174
201
175
- ARG TEST
176
- ARG DEBUG
177
-
178
- # hadolint ignore=SC2155
202
+ # hadolint ignore=SC2046,SC2155
179
203
RUN <<EOF
180
204
export MANIFEST="manifest-$ARCH.json" ;
181
205
export EXTRA_FLAGS=$([ "$ARCH" = "aarch64" ] && echo "-D__arm64__" || echo "" );
0 commit comments