Fix Dockerfile.build build after TFLite changes

This commit is contained in:
Reuben Morais 2021-09-08 12:00:11 +02:00
parent 28f107fb96
commit 738874fb6f
3 changed files with 54 additions and 15 deletions

5
.dockerignore Normal file
View File

@ -0,0 +1,5 @@
.git/lfs
native_client/ds-swig
native_client/python/dist/*.whl
native_client/ctcdecode/*.a
native_client/javascript/build/

View File

@ -851,10 +851,35 @@ jobs:
EOF EOF
- run: | - run: |
twine upload --repository pypi *.whl 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: docker-publish:
name: "Build and publish Docker training image to GHCR" name: "Build and publish Docker training image to GHCR"
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
with: with:
@ -869,18 +894,27 @@ jobs:
- name: Check VERSION matches Git tag and compute Docker tag - name: Check VERSION matches Git tag and compute Docker tag
id: compute-tag id: compute-tag
run: | run: |
VERSION="v$(cat VERSION)" if [[ "${{ startsWith(github.ref, 'refs/tags/') }}" != "true" ]]; then
if [[ "${{ github.ref }}" != "refs/tags/${VERSION}" ]]; then # PR build
echo "Pushed tag does not match VERSION file. Aborting push." echo "::set-output name=tag::dev"
exit 1 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 fi
echo "::set-output name=tag::${VERSION}" - name: Build
- name: Build and push
run: | run: |
DOCKER_TAG="${{ steps.compute-tag.outputs.tag }}" 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}" 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:${DOCKER_TAG}"
docker push ghcr.io/coqui-ai/stt-train:latest docker push ghcr.io/coqui-ai/stt-train:latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
twine-upload-decoder: twine-upload-decoder:
name: "Upload coqui_stt_ctcdecoder packages to PyPI" name: "Upload coqui_stt_ctcdecoder packages to PyPI"
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04

View File

@ -125,13 +125,11 @@ RUN ./configure
# passing LD_LIBRARY_PATH is required cause Bazel doesn't pickup it from environment # passing LD_LIBRARY_PATH is required cause Bazel doesn't pickup it from environment
# Build STT # Build STT
RUN bazel build \ RUN bazel build \
--verbose_failures \
--workspace_status_command="bash native_client/bazel_workspace_status_cmd.sh" \ --workspace_status_command="bash native_client/bazel_workspace_status_cmd.sh" \
--config=monolithic \
--config=cuda \
-c opt \ -c opt \
--copt=-O3 \
--copt="-D_GLIBCXX_USE_CXX11_ABI=0" \
--copt=-mtune=generic \ --copt=-mtune=generic \
--copt=-march=x86-64 \ --copt=-march=x86-64 \
--copt=-msse \ --copt=-msse \
@ -140,10 +138,11 @@ RUN bazel build \
--copt=-msse4.1 \ --copt=-msse4.1 \
--copt=-msse4.2 \ --copt=-msse4.2 \
--copt=-mavx \ --copt=-mavx \
--copt=-fvisibility=hidden \ --config=noaws \
//native_client:libstt.so \ --config=nogcp \
--verbose_failures \ --config=nohdfs \
--action_env=LD_LIBRARY_PATH=${LD_LIBRARY_PATH} --config=nonccl \
//native_client:libstt.so
# Copy built libs to /STT/native_client # Copy built libs to /STT/native_client
RUN cp bazel-bin/native_client/libstt.so /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 WORKDIR /STT
RUN cd native_client/python && make NUM_PROCESSES=$(nproc) bindings 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 pip3 install --upgrade native_client/python/dist/*.whl
RUN cd native_client/ctcdecode && make NUM_PROCESSES=$(nproc) bindings RUN cd native_client/ctcdecode && make NUM_PROCESSES=$(nproc) bindings