ditching ffmpeg, acceptable image size
This commit is contained in:
10
Dockerfile
10
Dockerfile
@ -1,3 +1,4 @@
|
|||||||
|
# building the go program
|
||||||
FROM golang:1.15.6-alpine AS builder
|
FROM golang:1.15.6-alpine AS builder
|
||||||
RUN apk add --no-cache git
|
RUN apk add --no-cache git
|
||||||
ENV GO111MODULE=on \
|
ENV GO111MODULE=on \
|
||||||
@ -12,12 +13,13 @@ COPY main.go ./
|
|||||||
COPY core ./core/
|
COPY core ./core/
|
||||||
RUN go build -o gogodiscordo
|
RUN go build -o gogodiscordo
|
||||||
|
|
||||||
|
# downloading mbrola voice
|
||||||
FROM alpine as alpine_voices
|
FROM alpine as alpine_voices
|
||||||
WORKDIR /tmp
|
WORKDIR /tmp
|
||||||
RUN wget --no-check-certificate https://github.com/numediart/MBROLA-voices/archive/master.zip \
|
RUN wget --no-check-certificate https://github.com/numediart/MBROLA-voices/archive/master.zip \
|
||||||
&& unzip master.zip && rm master.zip
|
&& unzip master.zip && rm master.zip
|
||||||
|
|
||||||
|
# final image
|
||||||
FROM ubuntu:focal as ubuntu1
|
FROM ubuntu:focal as ubuntu1
|
||||||
|
|
||||||
SHELL ["/bin/bash", "-c"]
|
SHELL ["/bin/bash", "-c"]
|
||||||
@ -27,19 +29,17 @@ RUN set -ex;\
|
|||||||
apt install -y --no-install-recommends \
|
apt install -y --no-install-recommends \
|
||||||
mbrola \
|
mbrola \
|
||||||
espeak-ng \
|
espeak-ng \
|
||||||
ffmpeg \
|
|
||||||
ca-certificates \
|
ca-certificates \
|
||||||
&& apt-get clean \
|
&& apt-get clean \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
RUN mkdir -p /usr/share/mbrola/
|
||||||
|
|
||||||
COPY --from=builder /src/gogodiscordo /app/
|
COPY --from=builder /src/gogodiscordo /app/
|
||||||
COPY config.yaml /app/
|
COPY config.yaml /app/
|
||||||
RUN mkdir -p /usr/share/mbrola/
|
|
||||||
COPY --from=alpine_voices /tmp/MBROLA-voices-master/data/fr* /usr/share/mbrola/
|
COPY --from=alpine_voices /tmp/MBROLA-voices-master/data/fr* /usr/share/mbrola/
|
||||||
|
|
||||||
VOLUME ["/app"]
|
VOLUME ["/app"]
|
||||||
|
|
||||||
RUN useradd -d /app appuser
|
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
CMD ["./gogodiscordo"]
|
CMD ["./gogodiscordo"]
|
||||||
|
|||||||
@ -42,8 +42,8 @@ func playSound(s *discordgo.Session, guildID, channelID string, audioBuffer []by
|
|||||||
|
|
||||||
func getAudioMessage(msg string) (filename string, out []byte) {
|
func getAudioMessage(msg string) (filename string, out []byte) {
|
||||||
curr_time := time.Now().Unix()
|
curr_time := time.Now().Unix()
|
||||||
filename = fmt.Sprintf("%d.ogg", curr_time)
|
filename = fmt.Sprintf("%d.wav", curr_time)
|
||||||
var cmd_args string = fmt.Sprintf("espeak-ng -s 120 -v mb-fr2 -p 30 '%s' --stdout | ffmpeg -i - -c:a libopus -f ogg pipe:1 2>/dev/null",
|
var cmd_args string = fmt.Sprintf("espeak-ng -s 120 -v mb-fr2 -p 30 '%s' --stdout",
|
||||||
maxString(msg, 300))
|
maxString(msg, 300))
|
||||||
cmd := exec.Command("sh", "-c", cmd_args)
|
cmd := exec.Command("sh", "-c", cmd_args)
|
||||||
out, err := cmd.CombinedOutput()
|
out, err := cmd.CombinedOutput()
|
||||||
|
|||||||
Reference in New Issue
Block a user