🔨 chore: add a light-weight dockerfile (#45)

* 🔨 chore: add dockerfile

* ️ perf: avoid use of cache directory with pip

* ️ perf: use alpine as base image

* 🐛 fix: use specific tagged image

* 💬 chore: update Dockerfile

* 📝 docs: update README

🐛 fix: use specific tagged image

💬 chore: update Dockerfile

📝 docs: update README

📝 docs: update README

️ perf: use multithread for ffmpeg
This commit is contained in:
Nyakku Shigure 2022-01-27 21:03:53 +08:00 committed by SigureMo
parent 6e35b4e30d
commit 28790d8d2a
No known key found for this signature in database
GPG Key ID: F99A3CD7BD76B247
4 changed files with 33 additions and 4 deletions

16
Dockerfile Normal file
View File

@ -0,0 +1,16 @@
FROM alpine:3.15
LABEL maintainer="siguremo" \
version="2.0.0-beta.9" \
description="light-weight container based on alpine for yutto"
RUN set -x \
&& sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories \
&& apk add -q --progress --update --no-cache --virtual .build-deps gcc g++ build-base \
&& apk add -q --progress --update --no-cache ffmpeg python3 python3-dev py-pip linux-headers libffi-dev openssl-dev \
&& python3 -m pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple \
&& python3 -m pip install --no-cache-dir --pre yutto[uvloop] \
&& apk del .build-deps
WORKDIR /app
ENTRYPOINT ["yutto", "-d", "/app"]

View File

@ -36,6 +36,16 @@ brew install yutto
yay -S yutto
```
### 使用 Docker <sup>测试中</sup>
你也可以尝试使用 docker 直接运行 yutto具体如何运行需要参考下后面的内容
```bash
docker run --rm -it -v /path/to/download:/app siguremo/yutto <url> [options]
```
与直接运行 yutto 不同的是,这里的下载目标路径是通过 `-v <path>:/app` 指定的,也就是说 docker 里的 yutto 会将内容下载到 docker 里的 `/app` 目录下,而你绑定的外部路径 `<path>` 就是下载路径。你也可以直接绑定 `$(pwd)`,此时就和本机 yutto 的默认行为一致啦,也是下载到当前目录下~
### pip 安装
在此之前请确保安装 Python3.9 及以上版本,并配置好 FFmpeg参照 [bilili 文档](https://bilili.sigure.xyz/guide/getting-started.html)
@ -56,8 +66,6 @@ poetry build
pip install ./dist/yutto-*.whl
```
// TODO: Dockerfile
## 主要功能
### 已支持的下载类型
@ -524,8 +532,6 @@ yutto file:///path/to/list --vcodec="avc:copy"
短期内不会bilili 并不会消失,在一段时间内 bilili 仍会做纠错性维护,只是不会提供新特性了。
yutto 现在也还不是非常稳定,需要稳定的体验的话请继续使用 bilili
## Roadmap
### 2.0.0-beta

View File

@ -44,3 +44,9 @@ clean-builds:
rm -rf build/
rm -rf dist/
rm -rf yutto.egg-info/
build-docker:
docker build -t {{DOCKER_NAME}} .
publish-docker:
docker buildx build --platform=linux/amd64,linux/arm64 -t {{DOCKER_NAME}} . --push

View File

@ -176,6 +176,7 @@ def merge_video_and_audio(
["-i", audio_path] if audio is not None else [],
["-vcodec", options["video_save_codec"]] if video is not None else [],
["-acodec", options["audio_save_codec"]] if audio is not None else [],
["-threads", str(os.cpu_count())],
["-y", output_path],
]