-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
50 lines (37 loc) · 1.37 KB
/
Dockerfile
File metadata and controls
50 lines (37 loc) · 1.37 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
# Soniox Microphone Transcription - Docker Image
# Built with uv for fast, reliable Python dependency management
FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim
# Set working directory
WORKDIR /app
# Install system dependencies for audio support
RUN apt-get update && apt-get install -y \
libportaudio2 \
libsndfile1 \
alsa-utils \
&& rm -rf /var/lib/apt/lists/*
# Copy dependency files
COPY pyproject.toml ./
COPY README.md ./
# Copy source code
COPY src/ ./src/
COPY web/ ./web/
# Install dependencies with uv
# Enable bytecode compilation for faster startup
ENV UV_COMPILE_BYTECODE=1
# Install production dependencies + microphone extras
RUN uv pip install --system -e ".[microphone]" && \
uv pip install --system fastapi uvicorn jinja2 python-multipart
# Create non-root user for security
RUN useradd -m -u 1000 soniox && \
chown -R soniox:soniox /app
USER soniox
# Expose web interface port (default 4346, configurable via PORT env var)
EXPOSE 4346
# Set environment variables
ENV PORT=4346
ENV PYTHONUNBUFFERED=1
# Health check (uses PORT env var)
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD python -c "import os; import requests; requests.get(f'http://localhost:{os.getenv(\"PORT\", \"4346\")}/api/health')"
# Start web application (uses PORT env var)
CMD ["sh", "-c", "uvicorn web.app:app --host 0.0.0.0 --port ${PORT}"]