File size: 1,540 Bytes
5239f17
77aeb7c
5239f17
 
bc25d66
5239f17
 
6a1d1be
2100218
6a1d1be
72b3761
 
 
77aeb7c
bc25d66
 
 
 
5239f17
 
 
 
 
 
 
 
 
e53f572
5239f17
3eefd94
5239f17
e53f572
5239f17
 
 
 
 
 
 
bc25d66
5239f17
 
 
 
 
 
 
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
FROM ubuntu:22.04 AS build
WORKDIR /src

RUN apt-get update && \
  apt-get install -y build-essential cmake git curl ninja-build && \
  rm -rf /var/lib/apt/lists/* /var/cache/apt/archives/*

ARG CRISPASR_REPO=https://github.com/CrispStrobe/CrispASR
ARG CRISPASR_REF=main

RUN git clone --depth 1 "${CRISPASR_REPO}" /src/CrispASR && \
  git -C /src/CrispASR fetch --depth 1 origin "${CRISPASR_REF}" && \
  git -C /src/CrispASR checkout --detach FETCH_HEAD
WORKDIR /src/CrispASR
ARG CRISPASR_BUILD_JOBS
RUN jobs="${CRISPASR_BUILD_JOBS:-$(nproc)}" && \
  cmake -S . -B build -G Ninja -DWHISPER_BUILD_TESTS=OFF && \
  cmake --build build -j"${jobs}" --target whisper-cli

FROM ubuntu:22.04 AS runtime
WORKDIR /space

RUN apt-get update && \
  apt-get install -y bash curl ffmpeg python3 python3-pip && \
  rm -rf /var/lib/apt/lists/* /var/cache/apt/archives/*

COPY --from=build /src/CrispASR/build /opt/crispasr/build
COPY requirements.txt /space/requirements.txt
RUN pip3 install --no-cache-dir -r /space/requirements.txt
RUN find /opt/crispasr/build -type f -name 'lib*.so*' -exec cp -a {} /usr/local/lib/ \; && ldconfig

COPY app.py start.sh /space/
RUN chmod +x /space/start.sh && \
  useradd -m -u 1000 app && \
  mkdir -p /models /cache && \
  chown -R app:app /space /opt/crispasr /models /cache

ENV PATH=/opt/crispasr/build/bin:$PATH
ENV CRISPASR_SERVER_URL=http://127.0.0.1:8080
ENV CRISPASR_CACHE_DIR=/cache
ENV GRADIO_SERVER_NAME=0.0.0.0
ENV GRADIO_SERVER_PORT=7860

USER app
EXPOSE 7860
EXPOSE 8080
ENTRYPOINT ["/space/start.sh"]