diff --git a/Dockerfile b/Dockerfile index 941387e..4f54953 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,19 +1,16 @@ -FROM debian:bullseye as build +FROM quay.io/pypa/manylinux_2_28_x86_64 as build-amd64 + +FROM quay.io/pypa/manylinux_2_28_aarch64 as build-arm64 + +ARG TARGETARCH +ARG TARGETVARIANT +FROM build-${TARGETARCH}${TARGETVARIANT} as build ARG TARGETARCH ARG TARGETVARIANT ENV LANG C.UTF-8 ENV DEBIAN_FRONTEND=noninteractive -RUN echo "Dir::Cache var/cache/apt/${TARGETARCH}${TARGETVARIANT};" > /etc/apt/apt.conf.d/01cache - -RUN --mount=type=cache,id=apt-build,target=/var/cache/apt \ - mkdir -p /var/cache/apt/${TARGETARCH}${TARGETVARIANT}/archives/partial && \ - apt-get update && \ - apt-get install --yes --no-install-recommends \ - build-essential \ - autoconf automake libtool pkg-config cmake - WORKDIR /build # Build minimal version of espeak-ng @@ -43,10 +40,13 @@ COPY Makefile ./ COPY src/cpp/ ./src/cpp/ RUN make no-pcaudio +# Do a test run +RUN /build/build/larynx --help + # Build .tar.gz to keep symlinks WORKDIR /dist RUN mkdir -p larynx && \ - cp -d /usr/lib/libespeak-ng.so* ./larynx/ && \ + cp -d /usr/lib64/libespeak-ng.so* ./larynx/ && \ cp -dR /usr/share/espeak-ng-data ./larynx/ && \ cp -d /usr/local/include/onnxruntime/lib/libonnxruntime.so.* ./larynx/ && \ cp /build/build/larynx ./larynx/ && \ diff --git a/Dockerfile.test b/Dockerfile.test new file mode 100644 index 0000000..14e351d --- /dev/null +++ b/Dockerfile.test @@ -0,0 +1,13 @@ +FROM debian:buster +ARG TARGETARCH +ARG TARGETVARIANT + +COPY local/en-us/ljspeech/low/en-us-ljspeech-low.onnx \ + local/en-us/ljspeech/low/en-us-ljspeech-low.onnx.json ./ + +ADD dist/linux_${TARGETARCH}${TARGETVARIANT}/larynx_${TARGETARCH}${TARGETVARIANT}.tar.gz ./ + +RUN cd larynx/ && echo 'This is a test.' | ./larynx -m ../en-us-ljspeech-low.onnx -f test.wav +RUN if [ ! -f larynx/test.wav ]; then exit 1; fi +RUN size="$(wc -c < larynx/test.wav)"; \ + if [ "${size}" -lt "1000" ]; then echo "File size is ${size} bytes"; exit 1; fi diff --git a/Dockerfile.test.dockerignore b/Dockerfile.test.dockerignore new file mode 100644 index 0000000..5b4b7e0 --- /dev/null +++ b/Dockerfile.test.dockerignore @@ -0,0 +1,3 @@ +* +!dist/ +!local/en-us/ljspeech/low/ diff --git a/Makefile b/Makefile index 7a68fc0..20d5d7a 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: release debug clean docker +.PHONY: release debug clean test release: mkdir -p build @@ -17,3 +17,6 @@ clean: docker: docker buildx build . --platform 'linux/amd64,linux/arm64' --output 'type=local,dest=dist' + +test: + docker buildx build -f Dockerfile.test . --platform 'linux/amd64,linux/arm64'