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
11 changes: 9 additions & 2 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@ jobs:
# First we build the docker container, then we run CI tests
build:
runs-on: ubuntu-latest
strategy:
matrix:
debian_base: [bullseye, bookworm]
env:
DOCKER_IMAGE: fstalign
DEBIAN_BASE: ${{ matrix.debian_base }}

steps:
- name: Checkout repository and submodules
Expand All @@ -18,7 +22,10 @@ jobs:
submodules: recursive

- name: Build the docker container
run: docker build . -f Dockerfile -t ${DOCKER_IMAGE}
run: |
docker build . -f Dockerfile \
--build-arg DEBIAN_BASE=${DEBIAN_BASE} \
-t ${DOCKER_IMAGE}:${DEBIAN_BASE}

- name: Run CI tests
run: docker run --rm -t ${DOCKER_IMAGE} bash -c '(cd build && make test)'
run: docker run --rm -t ${DOCKER_IMAGE}:${DEBIAN_BASE} bash -c '(cd build && make test)'
16 changes: 12 additions & 4 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ jobs:
push_to_registry:
name: Push Docker image to GitHub Packages
runs-on: ubuntu-latest
strategy:
matrix:
debian_base: [bullseye, bookworm]
env:
DEBIAN_BASE: ${{ matrix.debian_base }}
steps:
-
name: Check out the repo
Expand All @@ -22,7 +27,10 @@ jobs:
if [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/}
fi
TAGS="${DOCKER_IMAGE}:${VERSION}"
TAGS="${DOCKER_IMAGE}:${VERSION}-${DEBIAN_BASE}"
if [ "${DEBIAN_BASE}" = "bullseye" ]; then
TAGS="${TAGS} ${DOCKER_IMAGE}:${VERSION} ${DOCKER_IMAGE}:latest"
fi
echo ::set-output name=version::${VERSION}
echo ::set-output name=tags::${TAGS}
echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
Expand All @@ -45,6 +53,6 @@ jobs:
context: .
platforms: linux/amd64
push: true
tags: |
revdotcom/fstalign:latest
${{ steps.prep.outputs.tags }}
build-args: |
DEBIAN_BASE=${{ env.DEBIAN_BASE }}
tags: ${{ steps.prep.outputs.tags }}
53 changes: 45 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,54 @@
# Using kaldi image for pre-built OpenFST, version is 1.7.2
FROM kaldiasr/kaldi:cpu-debian10-2024-07-29 as kaldi-base
ARG DEBIAN_BASE=bullseye
FROM debian:${DEBIAN_BASE}-slim AS debian-base
RUN echo "APT::Get::Assume-Yes \"true\";\nAPT::Get::allow \"true\";" | tee -a /etc/apt/apt.conf.d/90_no_prompt && \
echo "APT::Keep-Downloaded-Packages \"false\";" | tee -a /etc/apt/apt.conf.d/91_no_cache && \
apt-get update
# Stage 1: Build OpenFST 1.7.2 from source
FROM debian-base as openfst-builder

FROM debian:11
ARG OPENFST_VERSION=1.7.2
ARG JOBS=4

# Install build dependencies for OpenFST
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y --no-install-recommends \
g++ \
make \
ccache \
&& rm -rf /var/lib/apt/lists/*

# Copy and build OpenFST from local tarball
WORKDIR /tmp
COPY ext/openfst-${OPENFST_VERSION}.tar.gz /tmp/
RUN --mount=type=cache,target=/root/.ccache,sharing=locked \
PATH=/usr/lib/ccache:${PATH} \
tar -xzf openfst-${OPENFST_VERSION}.tar.gz && \
cd openfst-${OPENFST_VERSION} && \
./configure --prefix=/opt/openfst --enable-shared --enable-static && \
make -j${JOBS} && \
make install && \
cd .. && \
rm -rf openfst-${OPENFST_VERSION} openfst-${OPENFST_VERSION}.tar.gz

# Stage 2: Build fstalign
FROM debian-base

COPY --from=kaldi-base /opt/kaldi/tools/openfst /opt/openfst
COPY --from=openfst-builder /opt/openfst /opt/openfst
ENV OPENFST_ROOT /opt/openfst

ARG JOBS=4

# Install runtime and build dependencies
RUN apt-get update && \
apt-get upgrade -y && \
apt-get -y install \
apt-get install -y --no-install-recommends \
cmake \
g++ \
libicu-dev
make \
ccache \
libicu-dev \
&& rm -rf /var/lib/apt/lists/*

RUN mkdir /fstalign
COPY CMakeLists.txt /fstalign/CMakeLists.txt
Expand All @@ -24,10 +59,12 @@ COPY sample_data /fstalign/sample_data

WORKDIR /fstalign

RUN mkdir -p /fstalign/build && \
RUN --mount=type=cache,target=/root/.ccache,sharing=locked \
PATH=/usr/lib/ccache:${PATH} \
mkdir -p /fstalign/build && \
cd /fstalign/build && \
rm -rf * && \
cmake .. -DOPENFST_ROOT="${OPENFST_ROOT}" -DDYNAMIC_OPENFST=ON && \
cmake .. -DOPENFST_ROOT="${OPENFST_ROOT}" -DDYNAMIC_OPENFST=OFF && \
make -j${JOBS} VERBOSE=1 && \
mkdir -p /fstalign/bin && \
cp /fstalign/build/fstalign /fstalign/bin && \
Expand Down
Binary file added ext/openfst-1.7.2.tar.gz
Binary file not shown.
3 changes: 2 additions & 1 deletion src/FstFileLoader.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
*
* FstLoader for loading a serialized FST from disk.
*
* Quinn McNamara (quinn@rev.com)
* Jp Robichaud (jp@rev.com)
* Quinn McNamara ()
* 2020
*/

Expand Down
3 changes: 2 additions & 1 deletion src/wer.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
*
* Collection of functions specific to the WER subcommand.
*
* Quinn McNamara (quinn@rev.com)
* Jp Robichaud (jp@rev.com)
* Quinn McNamara ()
* 2021
*/
#include "fstalign.h"
Expand Down
2 changes: 1 addition & 1 deletion third-party/catch2
Submodule catch2 updated 276 files
Loading