File size: 1,225 Bytes
cd6b085
828d702
cd6b085
4ba9382
828d702
cd6b085
 
 
 
828d702
cd6b085
 
 
 
 
 
 
 
 
 
 
 
828d702
 
cd6b085
 
828d702
cd6b085
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
FROM node:24-alpine

# Set user ke root agar memiliki akses untuk mengubah /etc/resolv.conf
USER root

# Install system dependencies yang dibutuhkan Streamflow (terutama ffmpeg)
RUN apk add --no-cache \
    git python3 make g++ build-base \
    ffmpeg wget tzdata

# Set environment variables
# Hugging Face Space mendengarkan port 7860 secara default
ENV PORT=7860
ENV HOST=0.0.0.0

# Buat dan set direktori kerja
WORKDIR /app

# Clone repository Streamflow langsung dari GitHub
RUN git clone https://github.com/bangtutorial/streamflow.git .

# Install dependensi Node.js untuk Streamflow
RUN npm install

# Berikan izin akses penuh ke direktori kerja agar tidak ada isu permission di HF
RUN chmod -R 777 /app

# --- BAGIAN KRUSIAL: SCRIPT DNS ---
# Membuat script untuk mengganti DNS sebelum menjalankan Streamflow
RUN printf '#!/bin/sh\n\
echo "nameserver 8.8.8.8" > /etc/resolv.conf\n\
echo "nameserver 8.8.4.4" >> /etc/resolv.conf\n\
echo "DNS successfully set to Google DNS (8.8.8.8)"\n\
# Mengeksekusi Streamflow\n\
exec npm start\n' > /docker-entrypoint.sh && \
chmod +x /docker-entrypoint.sh

# Expose port yang digunakan
EXPOSE 7860

# Jalankan via script injeksi DNS
ENTRYPOINT ["/bin/sh", "/docker-entrypoint.sh"]