Spaces:
Build error
Build error
Update Dockerfile
Browse files- Dockerfile +19 -9
Dockerfile
CHANGED
@@ -1,31 +1,41 @@
|
|
1 |
FROM python:3.9-slim
|
2 |
|
|
|
3 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
4 |
build-essential gcc libffi-dev libpq-dev curl gnupg ca-certificates && \
|
5 |
apt-get clean && rm -rf /var/lib/apt/lists/*
|
6 |
|
|
|
7 |
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \
|
8 |
apt-get install -y nodejs && \
|
|
|
9 |
node -v && npm -v
|
10 |
|
|
|
11 |
WORKDIR /app
|
12 |
|
|
|
13 |
COPY requirements.txt .
|
14 |
-
RUN pip install --no-cache-dir --upgrade pip &&
|
|
|
15 |
|
16 |
-
|
|
|
17 |
COPY test.js ./
|
18 |
-
RUN npm install youtube-po-token-generator
|
19 |
|
20 |
-
|
21 |
-
RUN
|
22 |
|
23 |
-
|
24 |
-
|
|
|
|
|
25 |
|
26 |
-
|
27 |
-
|
28 |
|
|
|
29 |
EXPOSE 7860
|
30 |
|
|
|
31 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "2"]
|
|
|
1 |
FROM python:3.9-slim
|
2 |
|
3 |
+
# -------------------- System Dependencies --------------------
|
4 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
5 |
build-essential gcc libffi-dev libpq-dev curl gnupg ca-certificates && \
|
6 |
apt-get clean && rm -rf /var/lib/apt/lists/*
|
7 |
|
8 |
+
# -------------------- Install Node.js --------------------
|
9 |
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \
|
10 |
apt-get install -y nodejs && \
|
11 |
+
npm install -g npm && \
|
12 |
node -v && npm -v
|
13 |
|
14 |
+
# -------------------- Set Work Directory --------------------
|
15 |
WORKDIR /app
|
16 |
|
17 |
+
# -------------------- Python Dependencies --------------------
|
18 |
COPY requirements.txt .
|
19 |
+
RUN pip install --no-cache-dir --upgrade pip && \
|
20 |
+
pip install --no-cache-dir -r requirements.txt
|
21 |
|
22 |
+
# -------------------- Copy Source Code --------------------
|
23 |
+
COPY app.py ./ # Make sure app.py exists in your build directory
|
24 |
COPY test.js ./
|
|
|
25 |
|
26 |
+
# -------------------- Node Dependencies --------------------
|
27 |
+
RUN npm install youtube-po-token-generator
|
28 |
|
29 |
+
# -------------------- Cache Permissions for pytubefix --------------------
|
30 |
+
# Let pytubefix write to its cache without permission issues
|
31 |
+
RUN mkdir -p /usr/local/lib/python3.9/site-packages/pytubefix/__cache__ && \
|
32 |
+
chmod -R 777 /usr/local/lib/python3.9/site-packages/pytubefix/__cache__
|
33 |
|
34 |
+
# -------------------- Logs File --------------------
|
35 |
+
RUN touch logs.json && chmod 666 logs.json
|
36 |
|
37 |
+
# -------------------- Expose Port --------------------
|
38 |
EXPOSE 7860
|
39 |
|
40 |
+
# -------------------- Start FastAPI App --------------------
|
41 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "2"]
|