chipling-api / Dockerfile
Maouu's picture
Update Dockerfile
2180488 verified
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"]