-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
136 lines (115 loc) · 4.06 KB
/
Copy pathDockerfile
File metadata and controls
136 lines (115 loc) · 4.06 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# =============================================================================
# FastFlowLM-Docker: Multi-stage Dockerfile
# Builds FastFlowLM from source and packages it with a Wyoming Protocol server
# Target: Ubuntu 24.04 with AMD XDNA2 NPU support
# =============================================================================
# ---------------------------------------------------------------------------
# Stage 1: Build FastFlowLM from source
# ---------------------------------------------------------------------------
FROM ubuntu:24.04 AS builder
ENV DEBIAN_FRONTEND=noninteractive
# Install all build dependencies (mirroring FastFlowLM's official Dockerfile)
RUN apt-get update && apt-get install -y --no-install-recommends \
software-properties-common \
&& apt-get update && apt-get install -y --no-install-recommends \
build-essential \
cargo \
cmake \
git \
libavcodec-dev \
libavformat-dev \
libavutil-dev \
libboost-dev \
libboost-program-options-dev \
libcurl4-openssl-dev \
libdrm-dev \
libfftw3-dev \
libreadline-dev \
libswresample-dev \
libswscale-dev \
libxrt-dev \
ninja-build \
patchelf \
pkg-config \
rustc \
uuid-dev \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /build
# Clone FastFlowLM with submodules
RUN git clone --recursive https://github.com/FastFlowLM/FastFlowLM.git /build/FastFlowLM
# Build using CMake presets (Linux)
WORKDIR /build/FastFlowLM/src
RUN cmake --preset linux-default \
&& cmake --build build -j$(nproc)
# Install to /opt/fastflowlm
RUN cmake --install build
# ---------------------------------------------------------------------------
# Stage 2: Runtime image with Wyoming Protocol server
# ---------------------------------------------------------------------------
FROM ubuntu:24.04 AS runtime
ENV DEBIAN_FRONTEND=noninteractive
# Install runtime dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
# FastFlowLM runtime libs
libavcodec60 \
libavformat60 \
libavutil58 \
libboost-program-options1.83.0 \
libcurl4t64 \
libdrm2 \
libfftw3-single3 \
libreadline8t64 \
libswresample4 \
libswscale7 \
uuid-runtime \
# XRT runtime for NPU access
xrt \
# Python for Wyoming server
python3 \
python3-pip \
python3-venv \
# Audio processing utilities
ffmpeg \
# Misc
curl \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Copy FastFlowLM installation from builder stage
COPY --from=builder /opt/fastflowlm /opt/fastflowlm
# Add FLM to PATH
ENV PATH="/opt/fastflowlm/bin:${PATH}"
ENV LD_LIBRARY_PATH="/opt/fastflowlm/lib:${LD_LIBRARY_PATH}"
# Set up Python virtual environment for Wyoming server
WORKDIR /app
RUN python3 -m venv /app/.venv
# Install Python dependencies
COPY requirements.txt /app/
RUN /app/.venv/bin/pip install --no-cache-dir -U pip setuptools wheel \
&& /app/.venv/bin/pip install --no-cache-dir -r requirements.txt
# Copy Wyoming server code
COPY wyoming_flm/ /app/wyoming_flm/
COPY scripts/ /app/scripts/
RUN chmod +x /app/scripts/*.sh
# Create model storage directory
RUN mkdir -p /data/models
ENV FLM_MODEL_PATH=/data/models
# Default configuration
ENV FLM_ASR_ENABLED=true \
FLM_LLM_ENABLED=true \
FLM_LLM_MODEL=llama3.2:1b \
FLM_ASR_MODEL=whisper-v3:turbo \
FLM_SERVER_PORT=52625 \
WYOMING_ASR_PORT=10300 \
WYOMING_LLM_PORT=10400 \
FLM_ASR_LANGUAGE=en \
FLM_LLM_SYSTEM_PROMPT="You are a helpful voice assistant for a smart home. Keep responses concise and conversational." \
FLM_LOG_LEVEL=INFO
# Expose ports: Wyoming ASR, Wyoming LLM, FastFlowLM API
EXPOSE 10300 10400 52625
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=120s --retries=3 \
CMD /app/scripts/healthcheck.sh || exit 1
# Volume for model persistence
VOLUME ["/data/models"]
ENTRYPOINT ["/app/scripts/entrypoint.sh"]
CMD ["both"]