Dockerfile 922 B

1234567891011121314151617181920212223242526272829303132
  1. FROM python:3.8-slim
  2. ARG APP_WORKDIR=/tv
  3. ENV APP_WORKDIR=$APP_WORKDIR
  4. COPY . $APP_WORKDIR
  5. WORKDIR $APP_WORKDIR
  6. RUN pip install -i https://mirrors.aliyun.com/pypi/simple pipenv
  7. RUN pipenv install
  8. RUN sed -i "s@deb.debian.org@mirrors.aliyun.com@g" /etc/apt/sources.list \
  9. && sed -i "s@security.debian.org@mirrors.aliyun.com@g" /etc/apt/sources.list
  10. RUN apt-get update && apt-get install -y cron
  11. ARG INSTALL_CHROMIUM=false
  12. RUN if [ "$INSTALL_CHROMIUM" = "true" ]; then apt-get install -y chromium chromium-driver cron; fi
  13. RUN (crontab -l ; echo "0 22 * * * cd $APP_WORKDIR && /usr/local/bin/pipenv run python main.py scheduled_task 2>&1 | tee -a /var/log/tv.log"; echo "0 10 * * * cd $APP_WORKDIR && /usr/local/bin/pipenv run python main.py scheduled_task 2>&1 | tee -a /var/log/tv.log") | crontab -
  14. EXPOSE 8000
  15. COPY entrypoint.sh /tv_entrypoint.sh
  16. RUN chmod +x /tv_entrypoint.sh
  17. ENTRYPOINT /tv_entrypoint.sh