未验证 提交 f5f8809c 编写于 作者: chen.zhiyu's avatar chen.zhiyu 提交者: GitHub

1. add python version selection 2.add dynamic flags setting. (#29612)

上级 2926e743
......@@ -11,8 +11,9 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
ARG PYTHON_VERSION=3.7
FROM python:3.7-alpine3.11
FROM python:${PYTHON_VERSION}-alpine3.11
USER root
......
......@@ -90,7 +90,7 @@ make -j8
compiling docker building script. it use alpine linux 3.10 as musl linux build enironment. it will try to install all the compiling tools, development packages, and python requirements for paddle musl compiling.
environment variables:
- PYTHON_VERSION: the version of python used for image building, default=3.7.
- WITH_PRUNE_DAYS: prune old docker images, with days limitation.
- WITH_REBUILD: force to rebuild the image, default=0.
- WITH_REQUIREMENT: build with the python requirements, default=1.
......@@ -103,10 +103,11 @@ make -j8
2. **build_paddle.sh** automatically or manually paddle building script. it will mount the root directory of paddle source to /paddle, and run compile procedure in /root/build directory. the output wheel package will save to the ./output directory relative to working directory.
environment variables:
- BUILD_MAN: build the paddle manually, default=0.
- WITH_TEST: build with unitest, and run unitest check, default=0.
- WITH_PRUNE_CONTAINER: remove the container after building, default=0.
- WITH_PRUNE_CONTAINER: remove the container after building, default=1.
- CTEST_*: CTEST flages used for unit test.
- FLAGS_*: build flages used for paddle building.
- HTTP_PROXY: use http proxy.
- HTTPS_PROXY: use https proxy.
......
......@@ -24,6 +24,7 @@ source "$CUR_DIR/config.sh"
WITH_REQUIREMENT="${WITH_REQUIREMENT-0}"
WITH_UT_REQUIREMENT="${WITH_UT_REQUIREMENT-0}"
WITH_REBUILD="${WITH_REBUILD-0}"
PYTHON_VERSION="${PYTHON_VERSION-3.7}"
# exit when any command fails
set -e
......@@ -43,6 +44,8 @@ function prune_image(){
function build_image(){
declare -a BUILD_ARGS
BUILD_ARGS+=("--build-arg" "PYTHON_VERSION=$PYTHON_VERSION")
echo ">>> python version: $PYTHON_VERSION"
if [ "$HTTP_PROXY" ]; then
BUILD_ARGS+=("--build-arg" "http_proxy=$HTTP_PROXY")
......
......@@ -18,6 +18,8 @@ PADDLE_DIR=/paddle
BUILD_DIR=$PWD/build
echo ">>> paddle: $PADDLE_DIR"
export PADDLE_ROOT="$PADDLE_DIR"
echo ">>> python: $PYTHON_VERSION"
# exit when any command fails
......@@ -64,7 +66,7 @@ fi
echo ">>> compile source code"
set -x
export FLAGS_call_stack_level=2
export FLAGS_call_stack_level="${FLAGS_call_stack_level-2}"
cmake "$PADDLE_DIR" \
-DWITH_MUSL=ON \
......
......@@ -82,6 +82,16 @@ if [ "$BUILD_MAN" != "1" ]; then
echo ">>> install unit test requirement"
fi
for CTEST_FLAGS in $(env | grep ^CTEST_); do
RUN_ARGS+=("--env" "$CTEST_FLAGS")
echo ">>> ctest: $CTEST_FLAGS"
done
for CBUILD_FLAGS in $(env | grep ^FLAGS_); do
RUN_ARGS+=("--env" "$CBUILD_FLAGS")
echo ">>> flags: $CBUILD_FLAGS"
done
if [ "$WITH_PRUNE_CONTAINER" == "1" ]; then
echo ">>> with prune container"
RUN_ARGS+=("--rm")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册