File size: 1,761 Bytes
7d19c12
 
 
e61ed8a
 
7d19c12
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e61ed8a
 
 
 
 
7d19c12
 
e61ed8a
7d19c12
 
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
# ---------------------------------------------------------------
# Use FULL Python image (not slim) — required by Azure Speech SDK
# ---------------------------------------------------------------
FROM python:3.10

# 1. Install System Dependencies
# - ffmpeg: audio sanitize
# - libssl-dev + libssl1.1: Azure Speech SDK compatibility
# - libgl1/libasound2: common media deps (safe to keep)
# - curl: pull libssl1.1 .deb
RUN apt-get update && apt-get install -y \
    build-essential \
    libgl1 \
    libasound2 \
    libssl-dev \
    ca-certificates \
    ffmpeg \
    curl \
    && rm -rf /var/lib/apt/lists/*

# 1b. Install libssl1.1 (Azure Speech SDK still wants this)
RUN export arch=$(dpkg --print-architecture) \
 && curl -sSLo /tmp/libssl1.1.deb \
      "https://deb.debian.org/debian/pool/main/o/openssl/libssl1.1_1.1.1w-0+deb11u1_${arch}.deb" \
 && dpkg -i /tmp/libssl1.1.deb \
 && rm /tmp/libssl1.1.deb

# 2. Update security certificates
RUN update-ca-certificates

# 3. Setup Work Directory
WORKDIR /app

# 4. Install Python Dependencies
COPY requirements.txt .

# Ensure Speech SDK is recent + compatible
RUN pip install --no-cache-dir -r requirements.txt \
    && pip install --no-cache-dir --upgrade \
       "azure-cognitiveservices-speech>=1.46.0" "azure-core>=1.36.0"

# 5. Copy Server Code
# New app uses main.py + language packs like korean.py, english.py, etc.
COPY main.py .
COPY *.py ./

# 6. Security: Create non-root user (Mandatory for HF Spaces)
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
    PATH=/home/user/.local/bin:$PATH

# 7. Expose HF port
EXPOSE 7860

# 8. Start Command (Flask-SocketIO needs eventlet worker)
CMD ["gunicorn", "--worker-class", "eventlet", "-w", "1", "--bind", "0.0.0.0:7860", "main:app"]