Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
码匠许师傅
Tensorflow
提交
526c3c29
T
Tensorflow
项目概览
码匠许师傅
/
Tensorflow
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Tensorflow
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
526c3c29
编写于
12月 07, 2016
作者:
S
Shanqing Cai
提交者:
GitHub
12月 07, 2016
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #6169 from caisq/r0.12-py3-docker
Docker build: add support for python3 (#6030)
上级
f65c8ce0
ebb3b6f5
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
99 addition
and
86 deletion
+99
-86
tensorflow/tools/ci_build/update_version.sh
tensorflow/tools/ci_build/update_version.sh
+0
-10
tensorflow/tools/docker/Dockerfile
tensorflow/tools/docker/Dockerfile
+3
-3
tensorflow/tools/docker/Dockerfile.devel
tensorflow/tools/docker/Dockerfile.devel
+3
-1
tensorflow/tools/docker/Dockerfile.devel-gpu
tensorflow/tools/docker/Dockerfile.devel-gpu
+2
-2
tensorflow/tools/docker/Dockerfile.gpu
tensorflow/tools/docker/Dockerfile.gpu
+3
-3
tensorflow/tools/docker/parameterized_docker_build.sh
tensorflow/tools/docker/parameterized_docker_build.sh
+88
-67
未找到文件。
tensorflow/tools/ci_build/update_version.sh
浏览文件 @
526c3c29
...
...
@@ -90,16 +90,6 @@ check_existence file "${CMAKE_SETUP_PY}"
sed
-i
-e
"s/^
\_
VERSION = [
\'\"
].*-cmake-experimental[
\'\"
]/
\_
VERSION =
\'
${
MAJOR
}
.
${
MINOR
}
.
${
PATCH
}
-cmake-experimental
\'
/g"
"
${
CMAKE_SETUP_PY
}
"
# Update Dockerfiles in tensorflow/tools/docker/
TOOLS_DOCKER_DIR
=
"
${
TF_SRC_DIR
}
/tools/docker"
check_existence
dir
"
${
TOOLS_DOCKER_DIR
}
"
# Determine the files that need to be modified
DOCKERFILES
=
$(
grep
-lrE
"^ENV TENSORFLOW_VERSION .+"
${
TOOLS_DOCKER_DIR
}
)
for
DOCKERF
in
${
DOCKERFILES
}
;
do
sed
-i
-r
-e
"s/^ENV TENSORFLOW_VERSION .+/ENV TENSORFLOW_VERSION
${
MAJOR
}
.
${
MINOR
}
.
${
PATCH
}
/g"
"
${
DOCKERF
}
"
done
# Update os_setup.md
OS_SETUP
=
"
${
TF_SRC_DIR
}
/g3doc/get_started/os_setup.md"
...
...
tensorflow/tools/docker/Dockerfile
浏览文件 @
526c3c29
...
...
@@ -33,8 +33,6 @@ RUN pip --no-cache-dir install \
&&
\
python
-m
ipykernel.kernelspec
ENV
TENSORFLOW_VERSION 0.12.0-rc1
# --- DO NOT EDIT OR DELETE BETWEEN THE LINES --- #
# These lines will be edited automatically by parameterized_docker_build.sh. #
# COPY _PIP_FILE_ /
...
...
@@ -43,9 +41,11 @@ ENV TENSORFLOW_VERSION 0.12.0-rc1
# Install TensorFlow CPU version from central repo
RUN
pip
--no-cache-dir
install
\
http://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-
${
TENSORFLOW_VERSION
}
-cp27-none-linux_x86_64
.whl
http://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-
0.0.0
-cp27-none-linux_x86_64.whl
# --- ~ DO NOT EDIT OR DELETE BETWEEN THE LINES --- #
# RUN ln -s /usr/bin/python3 /usr/bin/python#
# Set up our notebook config.
COPY
jupyter_notebook_config.py /root/.jupyter/
...
...
tensorflow/tools/docker/Dockerfile.devel
浏览文件 @
526c3c29
...
...
@@ -89,10 +89,12 @@ WORKDIR /tensorflow
# more difficult to experiment with local changes. Instead, just add
# the built directory to the path.
ENV CI_BUILD_PYTHON python
RUN tensorflow/tools/ci_build/builds/configured CPU \
bazel build -c opt tensorflow/tools/pip_package:build_pip_package && \
bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/pip && \
pip install --upgrade /tmp/pip/tensorflow-*.whl && \
pip
--no-cache-dir
install --upgrade /tmp/pip/tensorflow-*.whl && \
rm -rf /tmp/pip && \
rm -rf /root/.cache
# Clean up pip wheel and Bazel cache when done.
...
...
tensorflow/tools/docker/Dockerfile.devel-gpu
浏览文件 @
526c3c29
...
...
@@ -11,7 +11,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
libpng12-dev \
libzmq3-dev \
pkg-config \
python \
python-dev \
rsync \
software-properties-common \
...
...
@@ -87,6 +86,7 @@ RUN git clone https://github.com/tensorflow/tensorflow.git && \
WORKDIR /tensorflow
# Configure the build for our CUDA configuration.
ENV CI_BUILD_PYTHON python
ENV LD_LIBRARY_PATH /usr/local/cuda/extras/CUPTI/lib64:$LD_LIBRARY_PATH
ENV TF_NEED_CUDA 1
ENV TF_CUDA_COMPUTE_CAPABILITIES=3.0,3.5,5.2
...
...
@@ -94,7 +94,7 @@ ENV TF_CUDA_COMPUTE_CAPABILITIES=3.0,3.5,5.2
RUN tensorflow/tools/ci_build/builds/configured GPU \
bazel build -c opt --config=cuda tensorflow/tools/pip_package:build_pip_package && \
bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/pip && \
pip install --upgrade /tmp/pip/tensorflow-*.whl && \
pip
--no-cache-dir
install --upgrade /tmp/pip/tensorflow-*.whl && \
rm -rf /tmp/pip && \
rm -rf /root/.cache
# Clean up pip wheel and Bazel cache when done.
...
...
tensorflow/tools/docker/Dockerfile.gpu
浏览文件 @
526c3c29
...
...
@@ -33,8 +33,6 @@ RUN pip --no-cache-dir install \
&& \
python -m ipykernel.kernelspec
ENV TENSORFLOW_VERSION 0.12.0-rc1
# --- DO NOT EDIT OR DELETE BETWEEN THE LINES --- #
# These lines will be edited automatically by parameterized_docker_build.sh. #
# COPY _PIP_FILE_ /
...
...
@@ -43,9 +41,11 @@ ENV TENSORFLOW_VERSION 0.12.0-rc1
# Install TensorFlow GPU version.
RUN pip --no-cache-dir install \
http://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-
${TENSORFLOW_VERSION}
-cp27-none-linux_x86_64.whl
http://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-
0.0.0
-cp27-none-linux_x86_64.whl
# --- ~ DO NOT EDIT OR DELETE BETWEEN THE LINES --- #
# RUN ln -s /usr/bin/python3 /usr/bin/python#
# Set up our notebook config.
COPY jupyter_notebook_config.py /root/.jupyter/
...
...
tensorflow/tools/docker/parameterized_docker_build.sh
浏览文件 @
526c3c29
...
...
@@ -31,9 +31,8 @@
#
# TF_DOCKER_BUILD_CENTRAL_PIP
# (Optional)
# If set to any non-0 and non-empty value, will attempt to use the PIP file
# located on the central repo, instead of locally built pip files.
# This option takes effect only for non-devel builds.
# If set to a non-empty string, will use it as the URL from which the
# pip wheel file will be downloaded (instead of building the pip locally).
#
# TF_DOCKER_BUILD_IMAGE_NAME:
# (Optional)
...
...
@@ -81,7 +80,6 @@ mark_check_failed() {
TF_DOCKER_BUILD_TYPE
=
$(
to_lower
${
TF_DOCKER_BUILD_TYPE
}
)
TF_DOCKER_BUILD_IS_DEVEL
=
$(
to_lower
${
TF_DOCKER_BUILD_IS_DEVEL
}
)
TF_DOCKER_BUILD_CENTRAL_PIP
=
$(
to_lower
${
TF_DOCKER_BUILD_CENTRAL_PIP
}
)
TF_DOCKER_BUILD_PYTHON_VERSION
=
$(
to_lower
${
TF_DOCKER_BUILD_PYTHON_VERSION
:-
PYTHON2
}
)
TF_DOCKER_BUILD_OPTIONS
=
$(
to_lower
${
TF_DOCKER_BUILD_OPTIONS
:-
OPT
}
)
...
...
@@ -144,6 +142,15 @@ else
"
${
TF_DOCKER_BUILD_TYPE
}
"
fi
if
[[
"
${
TF_DOCKER_BUILD_PYTHON_VERSION
}
"
==
"python2"
]]
;
then
:
elif
[[
"
${
TF_DOCKER_BUILD_PYTHON_VERSION
}
"
==
"python3"
]]
;
then
FINAL_TAG
=
"
${
FINAL_TAG
}
-py3"
else
die
"Unrecognized value in TF_DOCKER_BUILD_PYTHON_VERSION: "
\
"
${
TF_DOCKER_BUILD_PYTHON_VERSION
}
"
fi
# Verify that the original Dockerfile exists
ORIG_DOCKERFILE
=
"
${
SCRIPT_DIR
}
/
${
ORIG_DOCKERFILE
}
"
if
[[
!
-f
"
${
ORIG_DOCKERFILE
}
"
]]
;
then
...
...
@@ -156,21 +163,6 @@ echo "FINAL_TAG: ${FINAL_TAG}"
echo
"Original Dockerfile:
${
ORIG_DOCKERFILE
}
"
echo
""
DO_PIP_BUILD
=
0
if
[[
${
TF_DOCKER_BUILD_IS_DEVEL
}
==
"yes"
]]
;
then
# Devel builds has pip build instructions in the Dockerfile
:
else
if
[[
!
-z
${
TF_DOCKER_BUILD_CENTRAL_PIP
}
]]
&&
[[
${
TF_DOCKER_BUILD_CENTRAL_PIP
}
!=
"0"
]]
;
then
:
else
DO_PIP_BUILD
=
1
fi
fi
# Create tmp directory for Docker build
TMP_DIR
=
$(
mktemp
-d
)
echo
""
...
...
@@ -179,10 +171,10 @@ echo "Docker build will occur in temporary directory: ${TMP_DIR}"
# Copy all files to tmp directory for Docker build
cp
-r
${
SCRIPT_DIR
}
/
*
"
${
TMP_DIR
}
/"
if
[[
"
${
DO_PIP_BUILD
}
"
==
"1"
]]
;
then
if
[[
"
${
TF_DOCKER_BUILD_IS_DEVEL
}
"
==
"no"
]]
;
then
DOCKERFILE
=
"
${
TMP_DIR
}
/Dockerfile"
if
[[
-z
"
${
TF_DOCKER_BUILD_CENTRAL_PIP
}
"
]]
;
then
# Perform local build of the required PIP whl file
export
TF_BUILD_CONTAINER_TYPE
=
${
TF_DOCKER_BUILD_TYPE
}
export
TF_BUILD_PYTHON_VERSION
=
${
TF_DOCKER_BUILD_PYTHON_VERSION
}
...
...
@@ -191,7 +183,7 @@ if [[ "${DO_PIP_BUILD}" == "1" ]]; then
if
[[
"
${
TF_DOCKER_BUILD_TYPE
}
"
==
"gpu"
]]
;
then
export
TF_BUILD_APPEND_CI_DOCKER_EXTRA_PARAMS
=
\
"
${
TF_BUILD_APPEND_CI_DOCKER_EXTRA_PARAMS
}
-e TF_CUDA_COMPUTE_CAPABILITIES=3.0,3.5,5.2"
"
${
TF_BUILD_APPEND_CI_DOCKER_EXTRA_PARAMS
}
-e TF_CUDA_COMPUTE_CAPABILITIES=3.0,3.5,5.2"
fi
pushd
"
${
SCRIPT_DIR
}
/../../../"
...
...
@@ -225,21 +217,50 @@ if [[ "${DO_PIP_BUILD}" == "1" ]]; then
"COPY
${
PIP_WHL
}
/
\n
"
\
"RUN pip --no-cache-dir install /
${
PIP_WHL
}
"
"
${
ORIG_DOCKERFILE
}
"
\
>
"
${
DOCKERFILE
}
"
else
echo
"Downloading pip wheel from:
${
TF_DOCKER_BUILD_CENTRAL_PIP
}
"
echo
# Modify the non-devel Dockerfile to point to the correct pip whl URL.
sed
-e
"/# --- DO NOT EDIT OR DELETE BETWEEN THE LINES --- #/,"
\
"/# --- ~ DO NOT EDIT OR DELETE BETWEEN THE LINES --- #/c"
\
"RUN pip --no-cache-dir install
${
TF_DOCKER_BUILD_CENTRAL_PIP
}
"
"
${
ORIG_DOCKERFILE
}
"
\
>
"
${
DOCKERFILE
}
"
fi
echo
"Modified Dockerfile at:
${
DOCKERFILE
}
"
echo
# Modify python/pip version if necessary.
if
[[
"
${
TF_DOCKER_BUILD_PYTHON_VERSION
}
"
==
"python3"
]]
;
then
sed
-i
-e
's/python /python3 /g'
"
${
DOCKERFILE
}
"
&&
\
sed
-i
-e
's/python-dev/python3-dev/g'
"
${
DOCKERFILE
}
"
&&
\
sed
-i
-e
's/pip /pip3 /g'
"
${
DOCKERFILE
}
"
&&
\
sed
-i
-e
's^# RUN ln -s /usr/bin/python3 /usr/bin/python#^RUN ln -s /usr/bin/python3 /usr/bin/python^'
"
${
DOCKERFILE
}
"
&&
\
echo
"Modified Dockerfile for python version "
\
"
${
TF_DOCKER_BUILD_PYTHON_VERSION
}
at:
${
DOCKERFILE
}
"
||
\
die
"FAILED to modify
${
DOCKERFILE
}
for python3"
fi
else
if
[[
"
${
TF_DOCKER_BUILD_IS_DEVEL
}
"
==
"yes"
]]
;
then
DOCKERFILE
=
"
${
TMP_DIR
}
/Dockerfile"
# Modify the devel Dockerfile to specify the git branch
sed
-r
"s/([
\s
]*git checkout )(.*)/
\1
${
TF_DOCKER_BUILD_DEVEL_BRANCH
}
/g"
\
"
${
ORIG_DOCKERFILE
}
"
>
"
${
DOCKERFILE
}
"
else
DOCKERFILE
=
"
${
TMP_DIR
}
/"
$(
basename
"
${
ORIG_DOCKERFILE
}
"
)
# Modify python/pip version if necessary.
if
[[
"
${
TF_DOCKER_BUILD_PYTHON_VERSION
}
"
==
"python3"
]]
;
then
sed
-i
-e
's/python-dev/python-dev python3-dev/g'
"
${
DOCKERFILE
}
"
&&
\
sed
-i
-e
's/python /python3 /g'
"
${
DOCKERFILE
}
"
&&
\
sed
-i
-e
's^/tmp/pip^/tmp/pip3^g'
"
${
DOCKERFILE
}
"
&&
\
sed
-i
-e
's/pip /pip3 /g'
"
${
DOCKERFILE
}
"
&&
\
sed
-i
-e
's/ENV CI_BUILD_PYTHON python/ENV CI_BUILD_PYTHON python3/g'
"
${
DOCKERFILE
}
"
&&
\
sed
-i
-e
's^# RUN ln -s /usr/bin/python3 /usr/bin/python#^RUN ln -s /usr/bin/python3 /usr/bin/python^'
"
${
DOCKERFILE
}
"
&&
\
echo
"Modified Dockerfile further for python version
${
TF_DOCKER_BUILD_PYTHON_VERSION
}
at:
${
DOCKERFILE
}
"
||
\
die
"FAILED to modify
${
DOCKERFILE
}
for python3"
fi
fi
# Perform docker build
# Intermediate image name with tag
IMG
=
"
${
USER
}
/tensorflow:
${
FINAL_TAG
}
"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录