Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/workflows/github_build_dev_container.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash

set -x -e

df -h
docker info
# to get more disk space
rm -rf /usr/share/dotnet &

tools/build_dev_container.sh
13 changes: 12 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ jobs:
py-version: ['3.5', '3.6', '3.7', '3.8']
tf-version: ['2.3.0']
fail-fast: false
if: (github.event_name == 'push' && github.ref == 'refs/heads/master') || github.event_name == 'release'
steps:
- uses: actions/download-artifact@v1
with:
Expand All @@ -92,7 +93,17 @@ jobs:
ls -la dist/
sha256sum dist/*.whl
- uses: pypa/[email protected]
if: (github.event_name == 'push' && github.ref == 'refs/heads/master') || github.event_name == 'release'
with:
user: __token__
password: ${{ secrets.pypi_token }}
upload-dev-container:
name: Upload dev container to DockerHub
needs: [release-wheel, test-with-bazel]
runs-on: ubuntu-18.04
if: (github.event_name == 'push' && github.ref == 'refs/heads/master')
steps:
- run: |
set -e -x
docker login --username ${{ secrets.DOCKER_USER }} --password ${{ secrets.DOCKER_PW }}
bash bash .github/workflows/github_build_dev_container.sh
docker push tfaddons/dev_container:latest-cpu
Copy link
Contributor

@bhack bhack Jun 8, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could duplicate this command to push the latest without suffixes (that is the GPU image)

3 changes: 2 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ to install any additional tools.

CPU Docker:
```bash
docker run --rm -it -v ${PWD}:/addons -w /addons tensorflow/tensorflow:2.1.0-custom-op-ubuntu16
docker run --rm -it -v ${PWD}:/addons -w /addons tfaddons/dev_container:latest-cpu
```

GPU Docker:
Expand All @@ -289,6 +289,7 @@ python3 -m pip install -r tools/install_deps/pytest.txt

Compile the custom ops
```bash
export TF_NEED_CUDA=1 # If GPU is to be used
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that we need to set this only in the GPU image

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but also if it's built from source locally.

bash tools/install_so_files.sh
```

Expand Down
10 changes: 10 additions & 0 deletions tools/build_dev_container.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash

set -x -e

DOCKER_BUILDKIT=1 docker build \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could duplicate this command with the build_args to publish the GPU image. See the ARGS comment below.

-f tools/docker/dev_container.Dockerfile \
--build-arg TF_VERSION=2.2.0 \
--build-arg TF_PACKAGE=tensorflow-cpu \
--target dev_container_cpu \
-t tfaddons/dev_container:latest-cpu ./
27 changes: 27 additions & 0 deletions tools/docker/dev_container.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#syntax=docker/dockerfile:1.1.5-experimental
FROM tensorflow/tensorflow:2.1.0-custom-op-ubuntu16 as dev_container_cpu
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here you lost the build ARGS to prepare the switch between cpu and gpu that was in https://github.com/seanpmorgan/addons/pull/14/files#diff-76fe3c36c889ccfcf62f6e35439d030fR3-R5

ARG TF_PACKAGE
ARG TF_VERSION

# Temporary until custom-op container is updated
RUN ln -sf /usr/bin/python3 /usr/bin/python
RUN ln -sf /usr/local/bin/pip3 /usr/local/bin/pip
RUN pip install --default-timeout=1000 $TF_PACKAGE==$TF_VERSION

COPY tools/install_deps /install_deps
COPY requirements.txt /tmp/requirements.txt
RUN pip install -r /install_deps/black.txt \
-r /install_deps/flake8.txt \
-r /install_deps/pytest.txt \
-r /install_deps/typedapi.txt \
-r /tmp/requirements.txt

RUN bash /install_deps/buildifier.sh
RUN bash /install_deps/clang-format.sh

ENV ADDONS_DEV_CONTAINER="1"

# Clean up
RUN apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*
3 changes: 2 additions & 1 deletion tools/install_deps/clang-format.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@


wget -O /usr/local/bin/clang-format-9 https://github.com/DoozyX/clang-format-lint-action/raw/master/clang-format/clang-format9
chmod +x /usr/local/bin/clang-format-9
chmod +x /usr/local/bin/clang-format-9
ln -s /usr/local/bin/clang-format-9 /usr/local/bin/clang-format
15 changes: 8 additions & 7 deletions tools/pre-commit.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
#!/usr/bin/env bash
# usage: bash tools/pre-commit.sh
# by default uses docker buildkit.
# to disable it:
# DOCKER_BUILDKIT=0 bash tools/pre-commit.sh


set -e

export DOCKER_BUILDKIT=1
docker build -t tf_addons_formatting -f tools/docker/pre-commit.Dockerfile .
if [ -z "${ADDONS_DEV_CONTAINER}" ]; then
export DOCKER_BUILDKIT=1
docker build -t tf_addons_formatting -f tools/docker/pre-commit.Dockerfile .

export MSYS_NO_PATHCONV=1
docker run --rm -t -v "$(pwd -P):/addons" tf_addons_formatting
export MSYS_NO_PATHCONV=1
docker run --rm -t -v "$(pwd -P):/addons" tf_addons_formatting
else
python tools/format.py
fi
3 changes: 2 additions & 1 deletion tools/update_release_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ sed -ri "s/(TF_VERSION=|tensorflow(-cpu)*(~|=)=|tf-version: \[')[0-9]+[a-zA-Z0-9
tools/docker/cpu_tests.Dockerfile \
tools/install_deps/tensorflow-cpu.txt \
tools/install_deps/tensorflow.txt \
tools/run_gpu_tests.sh
tools/run_gpu_tests.sh \
tools/build_dev_container.sh