From 738874fb6f7c7889699aee7ed3c7041a5422d31d Mon Sep 17 00:00:00 2001 From: Reuben Morais Date: Wed, 8 Sep 2021 12:00:11 +0200 Subject: [PATCH] Fix Dockerfile.build build after TFLite changes --- .dockerignore | 5 +++ .github/workflows/build-and-test.yml | 48 ++++++++++++++++++++++++---- Dockerfile.build | 16 +++++----- 3 files changed, 54 insertions(+), 15 deletions(-) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..91db6201 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,5 @@ +.git/lfs +native_client/ds-swig +native_client/python/dist/*.whl +native_client/ctcdecode/*.a +native_client/javascript/build/ diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 8b7e0ff1..71576a1c 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -851,10 +851,35 @@ jobs: EOF - run: | twine upload --repository pypi *.whl + docker-build: + name: "Build Dockerfile.build image" + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + submodules: 'recursive' + - name: Check VERSION matches Git tag and compute Docker tag + id: compute-tag + run: | + if [[ "${{ startsWith(github.ref, 'refs/tags/') }}" != "true" ]]; then + # PR build + echo "::set-output name=tag::dev" + else + VERSION="v$(cat VERSION)" + if [[ "${{ github.ref }}" != "refs/tags/${VERSION}" ]]; then + echo "Pushed tag does not match VERSION file. Aborting push." + exit 1 + fi + echo "::set-output name=tag::${VERSION}" + fi + - name: Build + run: | + DOCKER_TAG="${{ steps.compute-tag.outputs.tag }}" + docker build -f Dockerfile.build . -t ghcr.io/coqui-ai/stt-build:latest -t "ghcr.io/coqui-ai/stt-build:${DOCKER_TAG}" docker-publish: name: "Build and publish Docker training image to GHCR" runs-on: ubuntu-20.04 - if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') steps: - uses: actions/checkout@v2 with: @@ -869,18 +894,27 @@ jobs: - name: Check VERSION matches Git tag and compute Docker tag id: compute-tag run: | - VERSION="v$(cat VERSION)" - if [[ "${{ github.ref }}" != "refs/tags/${VERSION}" ]]; then - echo "Pushed tag does not match VERSION file. Aborting push." - exit 1 + if [[ "${{ startsWith(github.ref, 'refs/tags/') }}" != "true" ]]; then + # PR build + echo "::set-output name=tag::dev" + else + VERSION="v$(cat VERSION)" + if [[ "${{ github.ref }}" != "refs/tags/${VERSION}" ]]; then + echo "Pushed tag does not match VERSION file. Aborting push." + exit 1 + fi + echo "::set-output name=tag::${VERSION}" fi - echo "::set-output name=tag::${VERSION}" - - name: Build and push + - name: Build run: | DOCKER_TAG="${{ steps.compute-tag.outputs.tag }}" docker build -f Dockerfile.train . -t ghcr.io/coqui-ai/stt-train:latest -t "ghcr.io/coqui-ai/stt-train:${DOCKER_TAG}" + - name: Push + run: | + DOCKER_TAG="${{ steps.compute-tag.outputs.tag }}" docker push "ghcr.io/coqui-ai/stt-train:${DOCKER_TAG}" docker push ghcr.io/coqui-ai/stt-train:latest + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') twine-upload-decoder: name: "Upload coqui_stt_ctcdecoder packages to PyPI" runs-on: ubuntu-20.04 diff --git a/Dockerfile.build b/Dockerfile.build index 426d3e11..0a0c612e 100644 --- a/Dockerfile.build +++ b/Dockerfile.build @@ -125,13 +125,11 @@ RUN ./configure # passing LD_LIBRARY_PATH is required cause Bazel doesn't pickup it from environment # Build STT + RUN bazel build \ + --verbose_failures \ --workspace_status_command="bash native_client/bazel_workspace_status_cmd.sh" \ - --config=monolithic \ - --config=cuda \ -c opt \ - --copt=-O3 \ - --copt="-D_GLIBCXX_USE_CXX11_ABI=0" \ --copt=-mtune=generic \ --copt=-march=x86-64 \ --copt=-msse \ @@ -140,10 +138,11 @@ RUN bazel build \ --copt=-msse4.1 \ --copt=-msse4.2 \ --copt=-mavx \ - --copt=-fvisibility=hidden \ - //native_client:libstt.so \ - --verbose_failures \ - --action_env=LD_LIBRARY_PATH=${LD_LIBRARY_PATH} + --config=noaws \ + --config=nogcp \ + --config=nohdfs \ + --config=nonccl \ + //native_client:libstt.so # Copy built libs to /STT/native_client RUN cp bazel-bin/native_client/libstt.so /STT/native_client/ @@ -158,6 +157,7 @@ RUN make NUM_PROCESSES=$(nproc) stt WORKDIR /STT RUN cd native_client/python && make NUM_PROCESSES=$(nproc) bindings +RUN pip3 install -U pip setuptools wheel RUN pip3 install --upgrade native_client/python/dist/*.whl RUN cd native_client/ctcdecode && make NUM_PROCESSES=$(nproc) bindings