chore:docker

This commit is contained in:
guorong.zheng 2024-10-24 18:04:12 +08:00
parent 69b6451f05
commit 681f4b826f
2 changed files with 30 additions and 17 deletions

@ -1,6 +1,12 @@
dist
build
.github
*.log
**/*.log
docs
tkinter
tkinter_ui
**/*.md
**/*.jpg
**/*.png
version.json
.git
.github
.gitignore

@ -1,16 +1,22 @@
FROM python:3.8-slim
FROM python:3.8-slim-buster AS builder
COPY Pipfile Pipfile.lock ./
RUN pip install --no-cache-dir -i https://mirrors.aliyun.com/pypi/simple pipenv \
&& pipenv install --system
FROM python:3.8-slim-buster
ARG APP_WORKDIR=/tv
ENV APP_WORKDIR=$APP_WORKDIR
COPY . $APP_WORKDIR
ENV APP_WORKDIR=$APP_WORKDIR \
PYTHONUNBUFFERED=1
WORKDIR $APP_WORKDIR
RUN pip install -i https://mirrors.aliyun.com/pypi/simple pipenv
COPY --from=builder /usr/local/lib/python3.8/site-packages /usr/local/lib/python3.8/site-packages
RUN pipenv install
ENV PYTHONPATH /usr/local/lib/python3.8/site-packages
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 \
@ -23,11 +29,6 @@ RUN echo "deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib
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 \
xz-utils \
ffmpeg
ARG INSTALL_CHROMIUM=false
RUN if [ "$INSTALL_CHROMIUM" = "true" ]; then \
@ -36,13 +37,17 @@ RUN if [ "$INSTALL_CHROMIUM" = "true" ]; then \
chromium-driver; \
fi
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install -y --no-install-recommends \
cron \
ffmpeg \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN (crontab -l ; \
echo "0 22 * * * cd $APP_WORKDIR && /usr/local/bin/pipenv run python main.py scheduled_task"; \
echo "0 10 * * * cd $APP_WORKDIR && /usr/local/bin/pipenv run python main.py scheduled_task") | crontab -
EXPOSE 8000
COPY . $APP_WORKDIR
COPY entrypoint.sh /tv_entrypoint.sh
@ -50,4 +55,6 @@ COPY config /tv_config
RUN chmod +x /tv_entrypoint.sh
ENTRYPOINT /tv_entrypoint.sh
ENTRYPOINT /tv_entrypoint.sh
EXPOSE 8000