-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathDockerfile
45 lines (34 loc) · 1.68 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
FROM lukemathwalker/cargo-chef:latest-rust-latest AS chef
WORKDIR /build
# Container to generate a recipe.json
FROM chef AS planner
COPY . .
RUN cargo chef prepare --recipe-path recipe.json
# Container to build the bot
FROM chef AS builder
# This is a dummy build to get the dependencies cached.
COPY --from=planner /build/recipe.json recipe.json
RUN cargo chef cook --release
# This is the actual build, copy in the rest of the sources
COPY . .
RUN cargo build --release
# Now make the runtime container
FROM debian:bookworm-slim AS runtime
COPY sparse-checkout.sh .
RUN apt-get update && apt-get upgrade -y && \
apt-get install -y openssl ca-certificates git make autoconf automake libtool pkg-config g++ && \
apt-get clean && \
# Build and install espeak-ng
git clone https://github.com/espeak-ng/espeak-ng --depth 1 && cd espeak-ng && \
./autogen.sh && ./configure && make && make install && \
cd .. && rm -rf espeak-ng && mv /usr/local/lib/libespeak* /usr/lib && \
# Build and install mbrola
git clone https://github.com/numediart/MBROLA --depth 1 && cd MBROLA && make && cp Bin/mbrola /usr/bin/mbrola && cd .. && rm -rf MBROLA && \
# Download the mbrola voices to /usr/share/mbrola.
./sparse-checkout.sh https://github.com/numediart/MBROLA-voices /usr/share/mbrola && mv /usr/share/mbrola/data/* /usr/share/mbrola && rm -r /usr/share/mbrola/data
# Download tini to avoid zombie processes
ADD https://github.com/krallin/tini/releases/latest/download/tini /usr/local/bin/tini
RUN chmod +x /usr/local/bin/tini
COPY --from=builder /build/target/release/tts-service /usr/local/bin/tts-service
COPY Cargo.lock .
CMD ["/usr/local/bin/tini", "/usr/local/bin/tts-service"]