diff --git a/.dockerignore b/.dockerignore index d746682..1a9ea55 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,6 +1,12 @@ dist build -.github -*.log +**/*.log docs -tkinter \ No newline at end of file +tkinter_ui +**/*.md +**/*.jpg +**/*.png +version.json +.git +.github +.gitignore \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index c6276b8..57681cc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 \ No newline at end of file +ENTRYPOINT /tv_entrypoint.sh + +EXPOSE 8000 \ No newline at end of file