Spaces:
Sleeping
Sleeping
File size: 1,237 Bytes
154320e 3452e5e 79c490f 4b98a96 154320e 3452e5e 79c490f 3452e5e 79c490f 3452e5e 154320e 4b98a96 154320e 79c490f 154320e 3452e5e 154320e 79c490f 154320e 4b98a96 79c490f 3452e5e 4b98a96 3452e5e 79c490f | 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 | FROM python:3.11-slim-bookworm
ENV PYTHONUNBUFFERED=1
# Tentukan folder cache agar model disimpan di dalam folder app
ENV HF_HOME=/app/.cache
ENV LIVEKIT_CACHE_DIR=/app/.cache
# Instal dependensi sistem untuk audio dan build tools
RUN apt-get update && apt-get install -y \
gcc \
g++ \
ffmpeg \
libsndfile1 \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy requirements dulu untuk caching layer
COPY requirements.txt .
# Instal Torch CPU saja untuk menghemat ruang di Hugging Face
RUN pip install --no-cache-dir torch --index-url https://download.pytorch.org/whl/cpu
RUN pip install --no-cache-dir -r requirements.txt
# Copy semua file
COPY . .
# Atur izin eksekusi sebagai root sebelum pindah user
RUN chmod +x start.sh
# Buat user non-root untuk keamanan (opsional di HF, tapi disarankan)
RUN useradd -m appuser
RUN mkdir -p /app/.cache && chown -R appuser:appuser /app
USER appuser
# Rapikan struktur folder untuk Flask
RUN mkdir -p templates && mv index.html templates/ 2>/dev/null || true
# Download model ML (Silero, Turn Detector, dll) menggunakan perintah resmi
RUN python -m livekit.agents download-files
EXPOSE 7860
# Jalankan script untuk memulai Agent dan Flask sekaligus
CMD ["./start.sh"]
|