forked from harperreed/google-home-notifier-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
52 lines (40 loc) · 1.27 KB
/
Dockerfile
File metadata and controls
52 lines (40 loc) · 1.27 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
FROM python:3.11-slim
# Set working directory
WORKDIR /app
# Install system dependencies for network discovery and audio processing
RUN apt-get update && apt-get install -y \
gcc \
curl \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean
# Copy requirements first for better layer caching
COPY requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir --upgrade pip \
&& pip install --no-cache-dir -r requirements.txt
# Create non-root user for security
RUN groupadd -r appuser && useradd -r -g appuser appuser
# Copy application code
COPY . .
# Create static directory for TTS cache and set proper permissions
RUN mkdir -p static/cache \
&& chown -R appuser:appuser /app
# Environment variables with sensible defaults
ENV CHROMECAST_IP="" \
EXTERNAL_HOST="" \
PLAYBACK_VOLUME="0.6" \
GRP_NAME="Google Home" \
DISCOVERY_RETRY_SEC="10" \
DISCOVERY_WAIT_TIMEOUT="30" \
PLAYBACK_TIMEOUT="300" \
PYTHONUNBUFFERED="1" \
PYTHONDONTWRITEBYTECODE="1"
# Expose port
EXPOSE 5000
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=15s --retries=3 \
CMD curl -f http://localhost:5000/discover/status || exit 1
# Switch to non-root user
USER appuser
# Run the application
CMD ["python", "main.py"]