-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.server
More file actions
23 lines (21 loc) · 1.04 KB
/
Dockerfile.server
File metadata and controls
23 lines (21 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
FROM golang:1.23-bullseye AS build
WORKDIR /app
COPY . .
# Build whisper static lib
RUN apt-get update && apt-get install -y --no-install-recommends build-essential clang cmake && rm -rf /var/lib/apt/lists/*
RUN make -C whisper.cpp/bindings/go whisper
# Download Go dependencies
RUN go mod tidy
RUN go mod download
RUN go get github.com/ggerganov/whisper.cpp/bindings/go || true
# Build server with whisper tag
ENV C_INCLUDE_PATH=/app/whisper.cpp:/app/whisper.cpp/include:/app/whisper.cpp/ggml/include:/app/whisper.cpp/bindings/go/build
ENV LIBRARY_PATH=/app/whisper.cpp/bindings/go/build:/app/whisper.cpp/build_go/src:/app/whisper.cpp/build_go/ggml/src
RUN CGO_ENABLED=1 CGO_LDFLAGS="-ldl" GOOS=linux GOARCH=amd64 go build -tags whisper -o /out/server ./cmd/server
FROM debian:bookworm-slim as runtime
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates libstdc++6 libgomp1 ffmpeg && rm -rf /var/lib/apt/lists/*
WORKDIR /srv
COPY --from=build /out/server /usr/local/bin/server
ENV PORT=8080
EXPOSE 8080
CMD ["/usr/local/bin/server"]