From 6cbacbd127e7024cf23cfcc4eaca23e4295ecec6 Mon Sep 17 00:00:00 2001 From: DDSDerek <108336573+DDSDerek@users.noreply.github.com> Date: Thu, 4 Jan 2024 20:51:03 +0800 Subject: [PATCH] chore: Optimization docker (#17) * feat: docker build adds cache * fix: dockerfile optimization * doc: dockerhub pictures are not displayed properly --------- Co-authored-by: DDSRem <1448139087@qq.com> --- .github/workflows/docker-image-debug.yml | 4 +++- .github/workflows/docker-image.yml | 2 ++ Dockerfile | 25 +++++++++++++++--------- README.md | 4 ++-- 4 files changed, 23 insertions(+), 12 deletions(-) diff --git a/.github/workflows/docker-image-debug.yml b/.github/workflows/docker-image-debug.yml index 864986b..8528170 100644 --- a/.github/workflows/docker-image-debug.yml +++ b/.github/workflows/docker-image-debug.yml @@ -43,4 +43,6 @@ jobs: linux/arm64/v8 push: true tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha, scope=${{ github.workflow }} + cache-to: type=gha, scope=${{ github.workflow }} \ No newline at end of file diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 2747b11..46c2a91 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -45,6 +45,8 @@ jobs: push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha, scope=${{ github.workflow }} + cache-to: type=gha, scope=${{ github.workflow }} - name: Update DockerHub description uses: peter-evans/dockerhub-description@v3 diff --git a/Dockerfile b/Dockerfile index d72a9de..6f2a8bf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,22 +1,29 @@ -FROM python:3.11.6-alpine3.18 AS base +FROM python:3.11.6-alpine3.19 WORKDIR /app -ENV BILI_IN_DOCKER=true +ENV LANG=zh_CN.UTF-8 \ + TZ=Asia/Shanghai \ + BILI_IN_DOCKER=true COPY poetry.lock pyproject.toml ./ -RUN apk add ffmpeg \ +RUN apk add --no-cache ffmpeg tini \ && apk add --no-cache --virtual .build-deps \ - gcc \ - musl-dev \ - libffi-dev \ - openssl-dev \ + gcc \ + musl-dev \ + libffi-dev \ + openssl-dev \ && pip install poetry \ && poetry config virtualenvs.create false \ && poetry install --no-dev --no-interaction --no-ansi \ - && apk del .build-deps + && apk del .build-deps \ + && rm -rf \ + /root/.cache \ + /tmp/* COPY . . -ENTRYPOINT [ "python", "entry.py" ] \ No newline at end of file +ENTRYPOINT [ "tini", "python", "entry.py" ] + +VOLUME [ "/app/config", "/app/data", "/app/thumb", "/Videos/Bilibilis" ] \ No newline at end of file diff --git a/README.md b/README.md index e6b0108..1d450e8 100644 --- a/README.md +++ b/README.md @@ -13,9 +13,9 @@ ## 工作截图 -![下载视频](asset/run.png) +![下载视频](https://raw.githubusercontent.com/amtoaer/bili-sync/main/asset/run.png) -![EMBY 识别](asset/emby.png) +![EMBY 识别](https://raw.githubusercontent.com/amtoaer/bili-sync/main/asset/emby.png) ## 配置文件