forked from FloopCZ/tensorflow_cc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ubuntu
48 lines (41 loc) · 1.53 KB
/
ubuntu
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
FROM ubuntu
# denotes whether shared or static tensorflow is built
ARG shared=OFF
RUN apt-get -y update
RUN apt-get -y install software-properties-common
RUN add-apt-repository -y ppa:ubuntu-toolchain-r/test
RUN apt-get -y update
RUN apt-get -y install build-essential curl git cmake unzip autoconf autogen libtool mlocate zlib1g-dev \
g++-6 python python3-numpy python3-dev python3-pip python3-wheel wget
RUN apt-get -y clean
# when building TF with Intel MKL support, `locate` database needs to exist
RUN updatedb
# install bazel for the shared library version
RUN echo "deb [arch=amd64] http://storage.googleapis.com/bazel-apt stable jdk1.8" | tee /etc/apt/sources.list.d/bazel.list
RUN curl https://bazel.build/bazel-release.pub.gpg | apt-key add -
RUN apt-get -y update \
&& apt-get -y install openjdk-8-jdk bazel \
&& apt-get -y clean
# copy the contents of this repository to the container
COPY . tensorflow_cc
# alternatively, clone the repository
# RUN git clone https://github.com/FloopCZ/tensorflow_cc.git
# install tensorflow
RUN mkdir /tensorflow_cc/tensorflow_cc/build
WORKDIR /tensorflow_cc/tensorflow_cc/build
# configure only shared or only static library
RUN if [ "${shared}" = "OFF" ]; then \
cmake ..; \
else \
cmake -DTENSORFLOW_STATIC=OFF -DTENSORFLOW_SHARED=ON ..; \
fi
# build
RUN make
# cleanup after bazel
RUN rm -rf ~/.cache
# install
RUN make install
# build and run example
RUN mkdir /tensorflow_cc/example/build
WORKDIR /tensorflow_cc/example/build
RUN cmake .. && make && ./example