Anora-api / Dockerfile
rairo's picture
Update Dockerfile
7d19c12 verified
# ---------------------------------------------------------------
# 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"]