From bf7bc91a46a691fd3215c9a7e6eb20443bf8e4fb Mon Sep 17 00:00:00 2001 From: Yong Tang Date: Tue, 5 Dec 2023 13:56:39 +0000 Subject: [PATCH] Update to use docker build instead --- .github/workflows/build.yml | 7 +++++-- WORKSPACE | 7 +++---- tools/docker/build.Dockerfile | 21 +++++++++++++++++++++ 3 files changed, 29 insertions(+), 6 deletions(-) create mode 100644 tools/docker/build.Dockerfile diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a263d8254..e85f2045e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -307,10 +307,13 @@ jobs: if [[ "${{ env.EVENT_NAME }}" == "push" && "${{ env.REPO_NAME }}" == "tensorflow/io" ]]; then export BAZEL_OPTIMIZATION="$BAZEL_OPTIMIZATION --remote_upload_local_results=true --google_credentials=service_account_creds.json" fi - #docker run -e TF_PYTHON_VERSION=3.9 -v $PWD:/v -w /v --net=host quay.io/pypa/manylinux2014_x86_64 bash -x .github/workflows/build.bazel.sh python3.9 - docker run -e TF_PYTHON_VERSION=3.9 -v $PWD:/v -w /v --net=host --entrypoint=/bin/bash gcr.io/tensorflow-testing/nosla-cuda12.0.1-cudnn8.8-ubuntu20.04-manylinux2014-multipython -x -e .github/workflows/build.bazel.sh python3.9 + docker build -t io -f tools/docker/build.Dockerfile --build-arg PYTHON_VERSION=3.10 --build-arg TENSORFLOW_VERSION=2.14 --build-arg BAZEL_OPTIMIZATION=$BAZEL_OPTIMIZATION --progress=plain . + docker create -it io --name io bash + docker cp -L io:/opt/io/bazel-bin build sudo cp .bazelrc build/tensorflow_io/ sudo chown -R $(id -nu):$(id -ng) . + find build/tensorflow_io -name '*runfiles*' | xargs rm -rf + find build/tensorflow_io_gcs_filesystem -name '*runfiles*' | xargs rm -rf - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 with: name: ${{ runner.os }}-bazel-bin diff --git a/WORKSPACE b/WORKSPACE index ad8dbb7c1..c60b5d8f6 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -262,11 +262,10 @@ http_archive( http_archive( name = "bzip2", build_file = "//third_party:bzip2.BUILD", - sha256 = "ab5a03176ee106d3f0fa90e381da478ddae405918153cca248e682cd0c4a2269", - strip_prefix = "bzip2-1.0.8", + sha256 = "329e4eb98f6af8d39da05cb51bccec88ae015eac99a42b1ee04dec0af7f4b957", + strip_prefix = "bzip2-bzip2-1.0.8", urls = [ - "https://storage.googleapis.com/mirror.tensorflow.org/sourceware.org/pub/bzip2/bzip2-1.0.8.tar.gz", - "https://sourceware.org/pub/bzip2/bzip2-1.0.8.tar.gz", + "https://gitlab.com/bzip2/bzip2/-/archive/bzip2-1.0.8/bzip2-bzip2-1.0.8.tar.gz", ], ) diff --git a/tools/docker/build.Dockerfile b/tools/docker/build.Dockerfile new file mode 100644 index 000000000..46760cf85 --- /dev/null +++ b/tools/docker/build.Dockerfile @@ -0,0 +1,21 @@ +ARG PYTHON_VERSION +ARG TENSORFLOW_VERSION +FROM tensorflow/build:${TENSORFLOW_VERSION}-python$PYTHON_VERSION + +ARG PYTHON_VERSION +ARG TENSORFLOW_VERSION +ARG BAZEL_OPTIMIZATION + +ADD . /opt/io +WORKDIR /opt/io + +RUN python${PYTHON_VERSION} -m pip install tensorflow==${TENSORFLOW_VERSION} + +RUN python$PYTHON_VERSION -m pip uninstall -y tensorflow-io-gcs-filesystem + +RUN python$PYTHON_VERSION tools/build/configure.py + +RUN cat .bazelrc + +RUN TF_PYTHON_VERSION=${PYTHON_VERSION} bazel build ${BAZEL_OPTIMIZATION} -- //tensorflow_io/... //tensorflow_io_gcs_filesystem/... +