Dockerfile 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. FROM python:3.13 AS builder
  2. ARG LITE=False
  3. WORKDIR /app
  4. COPY Pipfile* ./
  5. RUN pip install pipenv \
  6. && PIPENV_VENV_IN_PROJECT=1 pipenv install --deploy \
  7. && if [ "$LITE" = False ]; then pipenv install selenium; fi
  8. RUN apt-get update && apt-get install -y --no-install-recommends wget tar xz-utils
  9. RUN mkdir /usr/bin-new \
  10. && ARCH=$(dpkg --print-architecture) \
  11. && wget -O /tmp/ffmpeg.tar.gz https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-${ARCH}-static.tar.xz \
  12. && tar -xvf /tmp/ffmpeg.tar.gz -C /usr/bin-new/
  13. FROM python:3.13-slim
  14. ARG APP_WORKDIR=/iptv-api
  15. ARG LITE=False
  16. ENV APP_WORKDIR=$APP_WORKDIR
  17. ENV LITE=$LITE
  18. ENV APP_PORT=8000
  19. ENV PATH="/.venv/bin:$PATH"
  20. ENV UPDATE_CRON1="0 22 * * *"
  21. ENV UPDATE_CRON2="0 10 * * *"
  22. WORKDIR $APP_WORKDIR
  23. COPY . $APP_WORKDIR
  24. COPY --from=builder /app/.venv /.venv
  25. COPY --from=builder /usr/bin-new/* /usr/bin
  26. RUN apt-get update && apt-get install -y --no-install-recommends cron \
  27. && if [ "$LITE" = False ]; then apt-get install -y --no-install-recommends chromium chromium-driver; fi \
  28. && apt-get clean \
  29. && rm -rf /var/lib/apt/lists/*
  30. EXPOSE $APP_PORT
  31. COPY entrypoint.sh /iptv-api-entrypoint.sh
  32. COPY config /iptv-api-config
  33. RUN chmod +x /iptv-api-entrypoint.sh
  34. ENTRYPOINT /iptv-api-entrypoint.sh