| 1 |
FROM alpine:latest AS runtime |
| 2 |
RUN apk add --no-cache python3 py3-pip sox portaudio alsa-utils alsaconf |
| 3 |
|
| 4 |
FROM runtime AS build |
| 5 |
RUN apk add --no-cache cmake ninja gcc musl-dev python3-dev pkgconfig |
| 6 |
|
| 7 |
COPY . /pocketsphinx |
| 8 |
WORKDIR /pocketsphinx |
| 9 |
RUN cmake -S . -B build -DBUILD_SHARED_LIBS=ON -G Ninja && cmake --build build --target install |
| 10 |
# Cannot use --build-option because pip sucks |
| 11 |
RUN CMAKE_ARGS="-DUSE_INSTALLED_POCKETSPHINX=ON" pip wheel -v . |
| 12 |
|
| 13 |
FROM runtime |
| 14 |
COPY --from=build /usr/local/ /usr/local/ |
| 15 |
COPY --from=build /pocketsphinx/*.whl / |
| 16 |
RUN pip install --break-system-packages /*.whl && rm /*.whl |
| 17 |
|
| 18 |
COPY examples/ /work/examples/ |
| 19 |
WORKDIR /work |