tvbs/Dockerfile

58 lines
2 KiB
Python
Raw Permalink Normal View History

2024-11-22 12:30:08 +02:00
FROM python:3.13 AS builder
2024-10-24 13:04:12 +03:00
2024-11-26 07:39:59 +02:00
ARG LITE=False
2024-10-24 13:04:12 +03:00
2024-11-25 12:10:22 +02:00
WORKDIR /app
2024-07-17 10:00:51 +03:00
2024-11-25 12:10:22 +02:00
COPY Pipfile* ./
2024-11-22 12:30:08 +02:00
2024-11-25 12:10:22 +02:00
RUN pip install -i https://mirrors.aliyun.com/pypi/simple pipenv
RUN PIPENV_VENV_IN_PROJECT=1 pipenv install --deploy\
2024-11-26 07:39:59 +02:00
&& if [ "$LITE" = False ]; then pipenv install selenium; fi
2024-06-28 12:54:55 +03:00
2024-11-22 12:30:08 +02:00
FROM python:3.13-slim
2024-11-28 10:03:01 +02:00
ARG APP_WORKDIR=/iptv-api
2024-11-26 07:39:59 +02:00
ARG LITE=False
2024-11-22 12:30:08 +02:00
ENV APP_WORKDIR=$APP_WORKDIR
2024-11-26 07:39:59 +02:00
ENV LITE=$LITE
2024-11-25 12:10:22 +02:00
ENV PATH="/.venv/bin:$PATH"
2024-11-22 12:30:08 +02:00
2024-10-25 11:23:03 +03:00
WORKDIR $APP_WORKDIR
2024-06-28 12:54:55 +03:00
2024-11-25 12:10:22 +02:00
COPY . $APP_WORKDIR
COPY --from=builder /app/.venv /.venv
RUN echo "deb https://mirrors.aliyun.com/debian/ bookworm main contrib non-free non-free-firmware\n \
deb-src https://mirrors.aliyun.com/debian/ bookworm main contrib non-free non-free-firmware\n \
deb https://mirrors.aliyun.com/debian/ bookworm-updates main contrib non-free non-free-firmware\n \
deb-src https://mirrors.aliyun.com/debian/ bookworm-updates main contrib non-free non-free-firmware\n \
deb-src https://mirrors.aliyun.com/debian/ bookworm-updates main contrib non-free non-free-firmware\n \
deb https://mirrors.aliyun.com/debian/ bookworm-backports main contrib non-free non-free-firmware\n \
deb-src https://mirrors.aliyun.com/debian/ bookworm-backports main contrib non-free non-free-firmware\n \
deb https://mirrors.aliyun.com/debian-security/ bookworm-security main contrib non-free non-free-firmware\n \
deb-src https://mirrors.aliyun.com/debian-security/ bookworm-security main contrib non-free non-free-firmware\n" \
2024-08-14 12:38:34 +03:00
> /etc/apt/sources.list
2024-11-25 12:10:22 +02:00
RUN apt-get update && apt-get install -y --no-install-recommends cron
2024-11-26 07:39:59 +02:00
RUN if [ "$LITE" = False ]; then apt-get install -y --no-install-recommends chromium chromium-driver; fi \
2024-11-22 12:30:08 +02:00
&& apt-get clean && rm -rf /var/lib/apt/lists/*
2024-07-01 12:04:22 +03:00
2024-11-29 07:40:43 +02:00
RUN (crontab -l ; \
echo "0 22 * * * cd $APP_WORKDIR && /.venv/bin/python main.py"; \
echo "0 10 * * * cd $APP_WORKDIR && /.venv/bin/python main.py") | crontab -
2024-07-01 12:04:22 +03:00
2024-10-25 11:23:03 +03:00
EXPOSE 8000
2024-07-01 12:04:22 +03:00
2024-11-28 10:03:01 +02:00
COPY entrypoint.sh /iptv-api-entrypoint.sh
2024-11-26 07:39:59 +02:00
2024-11-28 10:03:01 +02:00
COPY config /iptv-api-config
2024-11-26 07:39:59 +02:00
2024-11-28 10:03:01 +02:00
RUN chmod +x /iptv-api-entrypoint.sh
2024-11-26 07:39:59 +02:00
2024-11-28 10:03:01 +02:00
ENTRYPOINT /iptv-api-entrypoint.sh