Skip to content

Commit 3d4440e

Browse files
Use a dockerfile to produce the linux wheel. (#1287)
1 parent baa65a8 commit 3d4440e

File tree

4 files changed

+39
-12
lines changed

4 files changed

+39
-12
lines changed

.dockerignore

+1
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
.coverage*
55
# C extensions
66
*.so
7+
wheelhouse/

.github/workflows/make_wheel_Linux.sh

+6-12
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
11
set -e -x
2-
3-
docker run -e TF_NEED_CUDA=1 -v ${PWD}:/addons -w /addons \
4-
tensorflow/tensorflow:2.1.0-custom-op-gpu-ubuntu16 \
5-
bash tools/releases/release_linux.sh $PY_VERSION $NIGHTLY_FLAG
6-
7-
sudo apt-get install patchelf
8-
python3 -m pip install -U auditwheel==2.0.0
9-
bash tools/releases/tf_auditwheel_patch.sh
10-
11-
auditwheel repair --plat manylinux2010_x86_64 artifacts/*.whl
12-
13-
ls -al wheelhouse/
2+
DOCKER_BUILDKIT=1 docker build \
3+
-f tools/docker/build_wheel.Dockerfile \
4+
--output type=local,dest=wheelhouse \
5+
--build-arg PY_VERSION \
6+
--build-arg NIGHTLY_FLAG \
7+
./

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,5 @@ wheels/
4040

4141
.coverage*
4242
htmlcov
43+
44+
wheelhouse/

tools/docker/build_wheel.Dockerfile

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
FROM tensorflow/tensorflow:2.1.0-custom-op-gpu-ubuntu16 as make_wheel
2+
3+
RUN apt-get update && apt-get install patchelf
4+
5+
ARG PY_VERSION
6+
RUN python$PY_VERSION -m pip install --upgrade pip setuptools auditwheel==2.0.0
7+
8+
COPY tools/install_deps/ /install_deps
9+
RUN python$PY_VERSION -m pip install \
10+
-r /install_deps/tensorflow.txt \
11+
-r /install_deps/pytest.txt
12+
13+
COPY requirements.txt .
14+
RUN python$PY_VERSION -m pip install -r requirements.txt
15+
16+
COPY tools/docker/finish_bazel_install.sh .
17+
RUN bash finish_bazel_install.sh
18+
19+
COPY ./ /addons
20+
WORKDIR /addons
21+
ARG NIGHTLY_FLAG
22+
RUN bash tools/releases/release_linux.sh $PY_VERSION $NIGHTLY_FLAG
23+
24+
RUN bash tools/releases/tf_auditwheel_patch.sh
25+
RUN auditwheel repair --plat manylinux2010_x86_64 artifacts/*.whl
26+
RUN ls -al wheelhouse/
27+
28+
FROM scratch as output
29+
30+
COPY --from=make_wheel /addons/wheelhouse/ .

0 commit comments

Comments
 (0)