49 lines
1.8 KiB
Docker
49 lines
1.8 KiB
Docker
# Dockerfile - Audiobook Maker Pro v4.2 (CPU-only)
|
|
|
|
FROM python:3.11-slim
|
|
|
|
# Python যেন logs সাথে সাথে দেখায়
|
|
ENV PYTHONUNBUFFERED=1 \
|
|
PYTHONDONTWRITEBYTECODE=1 \
|
|
PIP_NO_CACHE_DIR=1 \
|
|
PIP_DISABLE_PIP_VERSION_CHECK=1
|
|
|
|
# System packages:
|
|
# ffmpeg + libsndfile1 → pydub-এর জন্য দরকার (audio convert)
|
|
# curl → healthcheck-এর জন্য
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
ffmpeg \
|
|
libsndfile1 \
|
|
curl \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
WORKDIR /app
|
|
|
|
# Python প্যাকেজ আগে install করি (Docker cache ভালো কাজ করবে)
|
|
COPY requirements.txt .
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
# অ্যাপ্লিকেশন কোড copy করি
|
|
COPY . .
|
|
|
|
# ডাটাবেস ফোল্ডার তৈরি করি (Coolify এখানে volume mount করবে)
|
|
RUN mkdir -p /opt/apps/Audiobook-Maker-Pro-v4.2
|
|
|
|
# Gunicorn যেই port-এ চলবে
|
|
EXPOSE 5010
|
|
|
|
# Healthcheck — Coolify জানবে container ready কিনা
|
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=20s --retries=3 \
|
|
CMD curl -fsS http://localhost:5010/login || exit 1
|
|
|
|
# Production server: gunicorn
|
|
# - 2 workers → 8 GB VPS-এর জন্য ঠিক আছে। বেশি ট্রাফিক হলে 3-4 করতে পারেন।
|
|
# - 120s timeout → Beam API call অনেক সময় ধীর হয়, তাই বেশি সময় দিচ্ছি।
|
|
CMD ["gunicorn", \
|
|
"--bind", "0.0.0.0:5010", \
|
|
"--workers", "2", \
|
|
"--timeout", "120", \
|
|
"--access-logfile", "-", \
|
|
"--error-logfile", "-", \
|
|
"app:app"]
|