chore:docker
This commit is contained in:
parent
75a7be4bd7
commit
bce483c20c
35
Dockerfile
35
Dockerfile
@ -1,22 +1,15 @@
|
|||||||
FROM python:3.8-slim-buster AS builder
|
FROM python:3.8-slim
|
||||||
|
|
||||||
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
|
ARG APP_WORKDIR=/tv
|
||||||
|
|
||||||
ENV APP_WORKDIR=$APP_WORKDIR \
|
ENV APP_WORKDIR=$APP_WORKDIR
|
||||||
PYTHONUNBUFFERED=1
|
|
||||||
|
COPY . $APP_WORKDIR
|
||||||
|
|
||||||
WORKDIR $APP_WORKDIR
|
WORKDIR $APP_WORKDIR
|
||||||
|
|
||||||
COPY --from=builder /usr/local/lib/python3.8/site-packages /usr/local/lib/python3.8/site-packages
|
RUN pip install -i https://mirrors.aliyun.com/pypi/simple pipenv \
|
||||||
|
&& 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 \
|
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-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware\n \
|
||||||
@ -29,6 +22,10 @@ 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" \
|
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security/ bookworm-security main contrib non-free non-free-firmware\n" \
|
||||||
> /etc/apt/sources.list
|
> /etc/apt/sources.list
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
|
cron \
|
||||||
|
ffmpeg
|
||||||
|
|
||||||
ARG INSTALL_CHROMIUM=false
|
ARG INSTALL_CHROMIUM=false
|
||||||
|
|
||||||
RUN if [ "$INSTALL_CHROMIUM" = "true" ]; then \
|
RUN if [ "$INSTALL_CHROMIUM" = "true" ]; then \
|
||||||
@ -37,17 +34,13 @@ RUN if [ "$INSTALL_CHROMIUM" = "true" ]; then \
|
|||||||
chromium-driver; \
|
chromium-driver; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||||
cron \
|
|
||||||
ffmpeg \
|
|
||||||
&& apt-get clean \
|
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
RUN (crontab -l ; \
|
RUN (crontab -l ; \
|
||||||
echo "0 22 * * * cd $APP_WORKDIR && /usr/local/bin/pipenv run python main.py scheduled_task"; \
|
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 -
|
echo "0 10 * * * cd $APP_WORKDIR && /usr/local/bin/pipenv run python main.py scheduled_task") | crontab -
|
||||||
|
|
||||||
COPY . $APP_WORKDIR
|
EXPOSE 8000
|
||||||
|
|
||||||
COPY entrypoint.sh /tv_entrypoint.sh
|
COPY entrypoint.sh /tv_entrypoint.sh
|
||||||
|
|
||||||
@ -55,6 +48,4 @@ COPY config /tv_config
|
|||||||
|
|
||||||
RUN chmod +x /tv_entrypoint.sh
|
RUN chmod +x /tv_entrypoint.sh
|
||||||
|
|
||||||
ENTRYPOINT /tv_entrypoint.sh
|
ENTRYPOINT /tv_entrypoint.sh
|
||||||
|
|
||||||
EXPOSE 8000
|
|
Loading…
x
Reference in New Issue
Block a user