Skip to content

Commit ef0e4c2

Browse files
YedPoolclaude
andcommitted
Add LiveKit server Docker container and CI testing
- Created Dockerfile for LiveKit server with binary download - Added .dockerignore for build optimization - Extended GitHub Actions to test both Ollama and LiveKit containers - Tests container startup, health checks, and service availability - Enables full containerized testing of voice assistant stack 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 131f6d9 commit ef0e4c2

3 files changed

Lines changed: 120 additions & 2 deletions

File tree

.github/workflows/test-docker.yml

Lines changed: 72 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ on:
1313
workflow_dispatch:
1414

1515
jobs:
16-
test-docker-build:
16+
test-ollama-container:
1717
runs-on: ubuntu-latest
1818
timeout-minutes: 30
1919

@@ -115,4 +115,74 @@ jobs:
115115
116116
echo "🧹 Cleaning up..."
117117
docker stop test-container || true
118-
docker rm test-container || true
118+
docker rm test-container || true
119+
120+
test-livekit-container:
121+
runs-on: ubuntu-latest
122+
timeout-minutes: 20
123+
124+
steps:
125+
- name: Checkout code
126+
uses: actions/checkout@v4
127+
128+
- name: Set up Docker Buildx
129+
uses: docker/setup-buildx-action@v3
130+
131+
- name: Build LiveKit Docker image
132+
run: |
133+
cd livekit-server
134+
docker build -t livekit-server:test .
135+
136+
- name: Test LiveKit container startup
137+
run: |
138+
# Start container in background with required environment variables
139+
docker run -d --name livekit-test \
140+
-p 7880:7880 \
141+
-p 7881:7881 \
142+
-e LIVEKIT_API_KEY=testkey \
143+
-e LIVEKIT_API_SECRET=testsecret \
144+
livekit-server:test
145+
146+
# Wait for container to start
147+
sleep 15
148+
149+
# Check if container is still running
150+
if docker ps | grep -q livekit-test; then
151+
echo "✅ LiveKit container started successfully"
152+
else
153+
echo "❌ LiveKit container failed to start"
154+
docker logs livekit-test
155+
exit 1
156+
fi
157+
158+
- name: Test LiveKit server health
159+
run: |
160+
# Wait up to 1 minute for LiveKit to be ready
161+
timeout=60
162+
elapsed=0
163+
164+
while [ $elapsed -lt $timeout ]; do
165+
if curl -s http://localhost:7880/ > /dev/null 2>&1; then
166+
echo "✅ LiveKit server is responding"
167+
break
168+
fi
169+
echo "⏳ Waiting for LiveKit server... ($elapsed/$timeout seconds)"
170+
sleep 5
171+
elapsed=$((elapsed + 5))
172+
done
173+
174+
if [ $elapsed -ge $timeout ]; then
175+
echo "❌ LiveKit server failed to start within timeout"
176+
docker logs livekit-test
177+
exit 1
178+
fi
179+
180+
- name: LiveKit logs and cleanup
181+
if: always()
182+
run: |
183+
echo "📋 LiveKit container logs:"
184+
docker logs livekit-test || true
185+
186+
echo "🧹 Cleaning up..."
187+
docker stop livekit-test || true
188+
docker rm livekit-test || true

livekit-server/.dockerignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
__pycache__
2+
*.pyc
3+
*.pyo
4+
*.pyd
5+
.git
6+
.gitignore
7+
README.md
8+
.env
9+
.venv
10+
venv/
11+
cerebrium.toml

livekit-server/Dockerfile

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# LiveKit Server Docker Image
2+
FROM python:3.11-slim
3+
4+
# Install system dependencies
5+
RUN apt-get update && apt-get install -y \
6+
curl \
7+
wget \
8+
ca-certificates \
9+
&& rm -rf /var/lib/apt/lists/*
10+
11+
# Set working directory
12+
WORKDIR /app
13+
14+
# Copy Python requirements and install dependencies
15+
COPY requirements.txt .
16+
RUN pip install --no-cache-dir -r requirements.txt
17+
18+
# Copy application code
19+
COPY main.py .
20+
21+
# Download LiveKit server binary during build
22+
RUN curl -L https://github.com/livekit/livekit/releases/latest/download/livekit-server_linux_amd64 \
23+
-o /usr/local/bin/livekit-server && \
24+
chmod +x /usr/local/bin/livekit-server
25+
26+
# Create directory for config files
27+
RUN mkdir -p /tmp
28+
29+
# Expose LiveKit ports
30+
EXPOSE 7880 7881 50000-60000/udp
31+
32+
# Health check
33+
HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \
34+
CMD curl -f http://localhost:7880/ || exit 1
35+
36+
# Start LiveKit server
37+
CMD ["python", "main.py"]

0 commit comments

Comments
 (0)