File size: 1,620 Bytes
a379324
0fd766e
2180488
a379324
5fa9081
a379324
0fd766e
2180488
5fa9081
 
2180488
5fa9081
0fd766e
2180488
5fa9081
313d9bb
2180488
d82ba02
2180488
 
0fd766e
2180488
 
5fa9081
d82ba02
2180488
 
313d9bb
2180488
 
 
 
736319f
2180488
 
a379324
2180488
a379324
 
2180488
84df52a
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
FROM python:3.9-slim

# -------------------- System Dependencies --------------------
RUN apt-get update && apt-get install -y --no-install-recommends \
    build-essential gcc libffi-dev libpq-dev curl gnupg ca-certificates && \
    apt-get clean && rm -rf /var/lib/apt/lists/*

# -------------------- Install Node.js --------------------
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \
    apt-get install -y nodejs && \
    npm install -g npm && \
    node -v && npm -v

# -------------------- Set Work Directory --------------------
WORKDIR /app

# -------------------- Python Dependencies --------------------
COPY requirements.txt .
RUN pip install --no-cache-dir --upgrade pip && \
    pip install --no-cache-dir -r requirements.txt

# -------------------- Copy Source Code --------------------
COPY app.py ./         # Make sure app.py exists in your build directory
COPY test.js ./

# -------------------- Node Dependencies --------------------
RUN npm install youtube-po-token-generator

# -------------------- Cache Permissions for pytubefix --------------------
# Let pytubefix write to its cache without permission issues
RUN mkdir -p /usr/local/lib/python3.9/site-packages/pytubefix/__cache__ && \
    chmod -R 777 /usr/local/lib/python3.9/site-packages/pytubefix/__cache__

# -------------------- Logs File --------------------
RUN touch logs.json && chmod 666 logs.json

# -------------------- Expose Port --------------------
EXPOSE 7860

# -------------------- Start FastAPI App --------------------
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "2"]