Skip to content
This repository was archived by the owner on Feb 8, 2021. It is now read-only.

Commit 2d9aa91

Browse files
committed
[add-tensorflow-image] add Dockerfile for tensorflow
1 parent 1e9f60c commit 2d9aa91

File tree

9 files changed

+145
-0
lines changed

9 files changed

+145
-0
lines changed

tensorflow/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Dockerfile for tensorflow
2+
--------------------------------------------------------
3+
4+
- [tea0water/tensorflow](tensorflow)
5+
- [tea0water/kata-benchmark](kata-benchmark)

tensorflow/kata-benchmark/Dockerfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
FROM ubuntu:16.04
2+
3+
RUN apt-get update && \
4+
apt-get install -y --no-install-recommends fio apache2-utils iperf redis-tools sysbench && \
5+
apt-get clean && \
6+
rm -rf /var/lib/apt/lists/*
7+
8+
COPY files/ /root/kata-benchmark/

tensorflow/kata-benchmark/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Usage
2+
----------
3+
4+
```
5+
// build image tea0water/kata-benchmark
6+
$ ./util.sh build
7+
8+
// run test container
9+
$ ./util.sh run
10+
```

tensorflow/kata-benchmark/files/test/test.txt

Whitespace-only changes.

tensorflow/kata-benchmark/util.sh

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/bin/bash
2+
3+
IMAGE_NAME="tea0water/kata-benchmark"
4+
5+
function quit() {
6+
echo $@
7+
exit 1
8+
}
9+
10+
function show_usage() {
11+
cat <<EOF
12+
Usage: ./util.sh <action>
13+
14+
action:
15+
build # build image ${IMAGE_NAME}
16+
run # run test container
17+
EOF
18+
}
19+
20+
function build_image() {
21+
echo "> start build $IMAGE_NAME"
22+
docker build -t $IMAGE_NAME .
23+
if [ $? -eq 0 ]; then
24+
echo "> build ok"
25+
else
26+
quit "> build failed"
27+
fi
28+
}
29+
30+
function run_container() {
31+
docker run -it --rm $IMAGE_NAME bash
32+
}
33+
34+
## main ##
35+
36+
case $1 in
37+
build)
38+
build_image
39+
;;
40+
run)
41+
run_container
42+
;;
43+
*)
44+
show_usage
45+
;;
46+
esac

tensorflow/tensorflow/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
benchmarks

tensorflow/tensorflow/Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FROM tensorflow/tensorflow:latest
2+
# Start a CPU-only container with Python 2
3+
4+
RUN apt-get update && \
5+
apt-get install -y --no-install-recommends fio apache2-utils iperf redis-tools sysbench && \
6+
apt-get clean && \
7+
rm -rf /var/lib/apt/lists/*
8+
9+
COPY benchmarks/scripts/ /benchmarks/scripts/

tensorflow/tensorflow/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Usage
2+
----------
3+
4+
```
5+
// build image tea0water/tensorflow
6+
$ ./util.sh build
7+
8+
// run test container
9+
$ ./util.sh run
10+
```

tensorflow/tensorflow/util.sh

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#!/bin/bash
2+
3+
IMAGE_NAME="tea0water/tensorflow"
4+
5+
function quit() {
6+
echo $@
7+
exit 1
8+
}
9+
10+
function show_usage() {
11+
cat <<EOF
12+
Usage: ./util.sh <action>
13+
14+
action:
15+
build # build image ${IMAGE_NAME}
16+
run # run test container
17+
EOF
18+
}
19+
20+
function build_image() {
21+
if [ ! -d benchmarks ]; then
22+
echo "> benchmarks not exist, start clone now"
23+
git clone -v https://github.com/tensorflow/benchmarks.git
24+
if [ $? -ne 0 ]; then
25+
quit "error: failed to clone benchmarks"
26+
fi
27+
else
28+
echo "> benchmarks is ready"
29+
fi
30+
31+
echo "> start build $IMAGE_NAME"
32+
docker build -t $IMAGE_NAME .
33+
if [ $? -eq 0 ]; then
34+
echo "> build ok"
35+
else
36+
quit "> build failed"
37+
fi
38+
}
39+
40+
function run_container() {
41+
docker run -it --rm $IMAGE_NAME bash
42+
}
43+
44+
## main ##
45+
46+
case $1 in
47+
build)
48+
build_image
49+
;;
50+
run)
51+
run_container
52+
;;
53+
*)
54+
show_usage
55+
;;
56+
esac

0 commit comments

Comments
 (0)