forked from dusty-nv/jetson-containers
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
60 lines (54 loc) · 2.03 KB
/
Dockerfile
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
#---
# name: protobuf:cpp
# alias: protobuf
# group: build
# config: config.py
# depends: [build-essential, python]
# test: [test.py, test.sh]
# notes: build protobuf using cpp implementation (https://jkjung-avt.github.io/tf-trt-revisited/)
#---
ARG BASE_IMAGE
FROM ${BASE_IMAGE}
ARG PROTOBUF_VERSION=3.19.4
ARG PROTOBUF_URL=https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOBUF_VERSION}
ARG PROTOBUF_DIR=protobuf-python-${PROTOBUF_VERSION}
ARG PROTOC_DIR=protoc-${PROTOBUF_VERSION}-linux-aarch_64
ENV PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=cpp
RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential \
autoconf \
automake \
libtool \
zip \
unzip \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean
RUN pip3 install --no-cache-dir tzdata
RUN cd /tmp && \
wget --quiet --show-progress --progress=bar:force:noscroll --no-check-certificate ${PROTOBUF_URL}/$PROTOBUF_DIR.zip && \
wget --quiet --show-progress --progress=bar:force:noscroll --no-check-certificate ${PROTOBUF_URL}/$PROTOC_DIR.zip && \
unzip ${PROTOBUF_DIR}.zip -d ${PROTOBUF_DIR} && \
unzip ${PROTOC_DIR}.zip -d ${PROTOC_DIR} && \
cp ${PROTOC_DIR}/bin/protoc /usr/local/bin/protoc && \
cd ${PROTOBUF_DIR}/protobuf-${PROTOBUF_VERSION} && \
./autogen.sh && \
./configure --prefix=/usr/local && \
make -j$(nproc) && \
make check -j$(nproc) && \
make install && \
ldconfig && \
cd python && \
python3 setup.py build --cpp_implementation && \
python3 setup.py test --cpp_implementation && \
python3 setup.py bdist_wheel --cpp_implementation && \
cp dist/*.whl /opt && \
pip3 install /opt/protobuf*.whl && \
cd ../../../ && \
rm ${PROTOBUF_DIR}.zip && \
rm ${PROTOC_DIR}.zip && \
rm -rf ${PROTOBUF_DIR} && \
rm -rf ${PROTOC_DIR}
#RUN python3 setup.py install --cpp_implementation && \
#RUN pip3 install protobuf==${PROTOBUF_VERSION} --install-option="--cpp_implementation" --no-cache-dir --verbose
RUN pip3 show protobuf && protoc --version