Skip to content

Commit 980cce9

Browse files
authored
Merge pull request #57 from mutablelogic/v1
Updated dockerfile
2 parents c3a9491 + f5c0abf commit 980cce9

File tree

7 files changed

+67
-83
lines changed

7 files changed

+67
-83
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ docker: docker-dep submodule
5151
--build-arg OS=${OS} \
5252
--build-arg SOURCE=${BUILD_MODULE} \
5353
--build-arg VERSION=${VERSION} \
54-
-f etc/Dockerfile.${OS}-${ARCH} .
54+
-f etc/Dockerfile .
5555

5656
# Test whisper bindings
5757
test: generate libwhisper libggml

cmd/whisper/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ type CLI struct {
2828
Globals
2929
Models ModelsCmd `cmd:"models" help:"List models"`
3030
Download DownloadCmd `cmd:"download" help:"Download a model"`
31-
Server ServerCmd `cmd:"models" help:"Run the whisper server"`
31+
Server ServerCmd `cmd:"server" help:"Run the whisper server"`
3232
}
3333

3434
func main() {

etc/Dockerfile

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
ARG BASE_TAG=0.0.10-4-g6421fd2
2+
ARG BASE_DEV_CONTAINER=ghcr.io/mutablelogic/cuda-dev:${BASE_TAG}
3+
ARG BASE_RUN_CONTAINER=ghcr.io/mutablelogic/cuda-rt:${BASE_TAG}
4+
ARG CUDA_DOCKER_ARCH=all
5+
ARG GO_VERSION=1.22.5
6+
ARG ARCH
7+
ARG OS
8+
9+
# Setup build container
10+
FROM ${BASE_DEV_CONTAINER} AS build
11+
ARG CUDA_DOCKER_ARCH
12+
ARG GO_VERSION
13+
ARG ARCH
14+
ARG OS
15+
16+
RUN apt-get -y update \
17+
&& apt-get -y install software-properties-common curl \
18+
&& add-apt-repository -y ppa:ubuntuhandbook1/ffmpeg6 \
19+
&& apt-get -y update \
20+
&& apt-get -y install libavcodec-dev libavdevice-dev libavfilter-dev libavutil-dev libswscale-dev libswresample-dev
21+
22+
# Install go
23+
RUN curl -sL https://golang.org/dl/go${GO_VERSION}.${OS}-${ARCH}.tar.gz | tar -C /usr/local -xz
24+
ENV PATH=$PATH:/usr/local/go/bin
25+
26+
# Copy source
27+
WORKDIR /app
28+
COPY . .
29+
30+
# Make whisper-server
31+
ENV CUDA_DOCKER_ARCH=${CUDA_DOCKER_ARCH}
32+
ENV GGML_CUDA=1
33+
RUN make -j$(nproc)
34+
35+
# Setup runtime container
36+
FROM ${BASE_RUN_CONTAINER} AS runtime
37+
COPY --from=build --chmod=755 /app/build/whisper /usr/local/bin/whisper
38+
COPY --from=build /app/build/whisper /usr/local/bin/whisper
39+
COPY --chmod=755 etc/entrypoint.sh .
40+
41+
# Entrypoint when running the server
42+
ENTRYPOINT [ "/entrypoint.sh" ]
43+
STOPSIGNAL SIGQUIT
44+
EXPOSE 80
45+
CMD [ "/usr/local/bin/whisper", "-dir", "/data", "-listen", ":80", "server" ]

etc/Dockerfile.linux-amd64

Lines changed: 0 additions & 40 deletions
This file was deleted.

etc/Dockerfile.linux-arm64

Lines changed: 0 additions & 40 deletions
This file was deleted.

etc/entrypoint.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
3+
if [ -z "$1" ]; then
4+
echo "No command specified"
5+
exit 1
6+
fi
7+
8+
# Create the /alloc/logs folder if it doesn't exist
9+
install -d -m 0755 /alloc/logs || exit 1
10+
11+
# Create the persistent data folder if it doesn't exist
12+
install -d -m 0755 /data || exit 1
13+
14+
# Run the command
15+
set -e
16+
umask 022
17+
exec "$@"

sys/whisper/generate_cuda.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
//go:build cuda
2+
23
package whisper
34

45
///////////////////////////////////////////////////////////////////////////////
56
// CGO
67

78
/*
8-
#cgo arm64 pkg-config: cuda-12.2 cublas-12.2 cudart-12.2
9+
#cgo pkg-config: cuda-12.6 cublas-12.6 cudart-12.6
10+
#cgo LDFLAGS: -L/usr/local/cuda/lib64/stubs -lcuda
911
*/
1012
import "C"

0 commit comments

Comments
 (0)