From 641cc3f48b63a0d0b884d21674f5a841161a2e3c Mon Sep 17 00:00:00 2001 From: amtoaer Date: Sat, 6 Jan 2024 01:43:16 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E4=BC=98=E5=8C=96=20dockerfile?= =?UTF-8?q?=EF=BC=8C=E7=BC=A9=E5=B0=8F=E9=95=9C=E5=83=8F=E4=BD=93=E7=A7=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index cec6b58..5817f13 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.11.7-alpine3.19 +FROM python:3.11.7-alpine3.19 as base WORKDIR /app @@ -6,17 +6,19 @@ ENV LANG=zh_CN.UTF-8 \ TZ=Asia/Shanghai \ BILI_IN_DOCKER=true -COPY poetry.lock pyproject.toml ./ - RUN apk add --no-cache ffmpeg tini \ && apk add --no-cache --virtual .build-deps \ gcc \ musl-dev \ libffi-dev \ openssl-dev \ - && pip install poetry \ - && poetry config virtualenvs.create false \ + && pip install poetry==1.7.1 pip3-autoremove==1.2.0 + +COPY poetry.lock pyproject.toml ./ + +RUN poetry config virtualenvs.create false \ && poetry install --only main --no-root \ + && pip3-autoremove -y poetry pip3-autoremove \ && apk del .build-deps \ && rm -rf \ /root/.cache \ @@ -24,6 +26,16 @@ RUN apk add --no-cache ffmpeg tini \ COPY . . +FROM scratch + +WORKDIR /app + +ENV LANG=zh_CN.UTF-8 \ + TZ=Asia/Shanghai \ + BILI_IN_DOCKER=true + +COPY --from=base / / + ENTRYPOINT [ "tini", "python", "entry.py" ] VOLUME [ "/app/config", "/app/data", "/app/thumb", "/Videos/Bilibilis" ] \ No newline at end of file