feat:docker build and run

This commit is contained in:
guorong.zheng 2024-08-15 16:33:32 +08:00
parent fbfb47620c
commit 5a51d53518
3 changed files with 26 additions and 16 deletions

@ -12,27 +12,27 @@ RUN pip install -i https://mirrors.aliyun.com/pypi/simple pipenv
RUN pipenv install
RUN echo "deb https://mirrors.ustc.edu.cn/debian/ bookworm main contrib non-free non-free-firmware\n \
deb-src https://mirrors.ustc.edu.cn/debian/ bookworm main contrib non-free non-free-firmware\n \
deb https://mirrors.ustc.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware\n \
deb-src https://mirrors.ustc.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware\n \
deb-src https://mirrors.ustc.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware\n \
deb https://mirrors.ustc.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware\n \
deb-src https://mirrors.ustc.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware\n \
deb https://mirrors.ustc.edu.cn/debian-security/ bookworm-security main contrib non-free non-free-firmware\n \
deb-src https://mirrors.ustc.edu.cn/debian-security/ bookworm-security main contrib non-free non-free-firmware\n" \
RUN echo "deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware\n \
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware\n \
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware\n \
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware\n \
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware\n \
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware\n \
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware\n \
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security/ bookworm-security main contrib non-free non-free-firmware\n \
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security/ bookworm-security main contrib non-free non-free-firmware\n" \
> /etc/apt/sources.list
RUN apt-get update && apt-get install -y --no-install-recommends \
cron \
wget \
xz-utils
RUN wget -q https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-i686-static.tar.xz && \
tar -xf ffmpeg-release-i686-static.tar.xz && \
mv ffmpeg-*-static/ffmpeg /usr/local/bin/ && \
mv ffmpeg-*-static/ffprobe /usr/local/bin/ && \
rm -rf ffmpeg-*-static*
COPY tmp/ffmpeg-release-i686-static.tar.xz /tmp/
RUN tar -xf /tmp/ffmpeg-release-i686-static.tar.xz -C /tmp/ \
&& cp /tmp/ffmpeg-*/ffmpeg /usr/local/bin/ \
&& cp /tmp/ffmpeg-*/ffprobe /usr/local/bin/ \
&& rm -rf /tmp/ffmpeg-*
ARG INSTALL_CHROMIUM=false
@ -50,6 +50,8 @@ EXPOSE 8000
COPY entrypoint.sh /tv_entrypoint.sh
COPY config /tv_config
RUN chmod +x /tv_entrypoint.sh
ENTRYPOINT /tv_entrypoint.sh

@ -1,6 +1,14 @@
#!/bin/bash
pipenv run python $APP_WORKDIR/main.py scheduled_task 2>&1 | tee -a /var/log/tv.log
for file in /tv_config/*; do
filename=$(basename "$file")
target_file="$APP_WORKDIR/config/$filename"
if [ ! -e "$target_file" ]; then
cp "$file" "$target_file"
fi
done
PYTHONUNBUFFERED=1 pipenv run python $APP_WORKDIR/main.py scheduled_task 2>&1 | tee -a /var/log/tv.log
cron

Binary file not shown.