-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
73 lines (57 loc) · 3.09 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
########################################################################################################################
FROM python:3-slim as base
ENV DEBIAN_FRONTEND noninteractive
ENV TERM xterm
ENV PYTHONUNBUFFERED 1
ADD . /usr/local/src/monkeyplug
RUN apt-get update -q && \
apt-get -y install -qq --no-install-recommends libarchive-tools curl && \
python3 -m ensurepip && \
python3 -m pip install --no-cache /usr/local/src/monkeyplug && \
apt-get clean && \
rm -rf /var/cache/apt/* /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/local/src/monkeyplug
COPY --from=mwader/static-ffmpeg:latest /ffmpeg /usr/local/bin/
COPY --from=mwader/static-ffmpeg:latest /ffprobe /usr/local/bin/
WORKDIR /tmp
ENTRYPOINT ["monkeyplug"]
CMD []
########################################################################################################################
FROM base as vosk
LABEL maintainer="mero.mero.guero@gmail.com"
LABEL org.opencontainers.image.authors='mero.mero.guero@gmail.com'
LABEL org.opencontainers.image.url='https://github.com/mmguero/monkeyplug'
LABEL org.opencontainers.image.source='https://github.com/mmguero/monkeyplug'
LABEL org.opencontainers.image.title='mmguero/monkeyplug'
LABEL org.opencontainers.image.description='Dockerized monkeyplug (VOSK-based)'
ENV MONKEYPLUG_MODE vosk
ENV VOSK_MODEL_DIR /opt/vosk_model
# see https://alphacephei.com/vosk/models
# use "vosk-model-en-us-0.22" if you want more accurate recognition (and a large image)
ARG VOSK_MODEL_URL="https://alphacephei.com/kaldi/models/vosk-model-small-en-us-0.15.zip"
RUN python3 -m pip install --no-cache vosk && \
mkdir -p "$VOSK_MODEL_DIR" && \
cd "$VOSK_MODEL_DIR" && \
echo "Downloading Vosk model \"$VOSK_MODEL_URL\"..." && \
curl -fsSL -o ./model.zip "$VOSK_MODEL_URL" && \
bsdtar -xf ./model.zip -s'|[^/]*/||' && \
echo "Finished" && \
rm -f ./model.zip
########################################################################################################################
FROM base as whisper
LABEL maintainer="mero.mero.guero@gmail.com"
LABEL org.opencontainers.image.authors='mero.mero.guero@gmail.com'
LABEL org.opencontainers.image.url='https://github.com/mmguero/monkeyplug'
LABEL org.opencontainers.image.source='https://github.com/mmguero/monkeyplug'
LABEL org.opencontainers.image.title='mmguero/monkeyplug'
LABEL org.opencontainers.image.description='Dockerized monkeyplug (Whisper-based)'
ENV MONKEYPLUG_MODE whisper
ENV WHISPER_MODEL_DIR /opt/whisper_model
# see https://github.com/openai/whisper?tab=readme-ov-file#available-models-and-languages
ARG WHISPER_MODEL_NAME="small.en"
ENV WHISPER_MODEL_NAME $WHISPER_MODEL_NAME
RUN python3 -m pip install --no-cache openai-whisper && \
mkdir -p "$WHISPER_MODEL_DIR" && \
cd "$WHISPER_MODEL_DIR" && \
echo "Downloading Whisper model \"$WHISPER_MODEL_NAME\"..." && \
curl -fsSL -o ./"$WHISPER_MODEL_NAME".pt "$(curl -fsSL https://raw.githubusercontent.com/openai/whisper/main/whisper/__init__.py | grep -P "\"$WHISPER_MODEL_NAME\"\s*:\s*\"https://" | cut -d: -f2- | sed 's/^[[:space:]]*"//' | sed 's/",*$//')" && \
echo "Finished"