mirror of
https://github.com/YaoFANGUK/video-subtitle-remover.git
synced 2026-02-15 12:24:47 +08:00
发布docker镜像
This commit is contained in:
97
.github/workflows/build-docker.yml
vendored
Normal file
97
.github/workflows/build-docker.yml
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
name: Docker Build and Push
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- '**'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
check-secrets:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
has_secrets: ${{ steps.check.outputs.has_secrets }}
|
||||
steps:
|
||||
- id: check
|
||||
run: |
|
||||
if [[ -n "${{ secrets.DOCKERHUB_USERNAME }}" && -n "${{ secrets.DOCKERHUB_TOKEN }}" ]]; then
|
||||
echo "has_secrets=true" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "has_secrets=false" >> $GITHUB_OUTPUT
|
||||
echo "未设置 Docker Hub 凭据,将跳过整个 Action"
|
||||
fi
|
||||
|
||||
build-and-push:
|
||||
needs: check-secrets
|
||||
if: needs.check-secrets.outputs.has_secrets == 'true'
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- type: cuda
|
||||
version: "11.8"
|
||||
- type: cuda
|
||||
version: "12.6"
|
||||
- type: cuda
|
||||
version: "12.8"
|
||||
- type: directml
|
||||
version: "latest"
|
||||
|
||||
steps:
|
||||
|
||||
- name: Show system
|
||||
run: |
|
||||
echo -e "Total CPU cores\t: $(nproc)"
|
||||
cat /proc/cpuinfo | grep 'model name'
|
||||
ulimit -a
|
||||
|
||||
- name: Free disk space
|
||||
run: |
|
||||
sudo rm -rf /usr/share/dotnet /usr/local/lib/android
|
||||
df -h
|
||||
|
||||
- name: 检出代码
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: 读取 VERSION
|
||||
id: version
|
||||
run: |
|
||||
VERSION=$(sed -n 's/^VERSION = "\(.*\)"/\1/p' backend/config.py)
|
||||
echo "VERSION=$VERSION" >> $GITHUB_ENV
|
||||
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
|
||||
shell: bash
|
||||
|
||||
- name: 设置 Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: 登录到 Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: 提取元数据
|
||||
id: meta
|
||||
uses: docker/metadata-action@v4
|
||||
with:
|
||||
images: ${{ secrets.DOCKERHUB_USERNAME }}/video-subtitle-remover
|
||||
tags: |
|
||||
type=raw,value=${{ env.VERSION }}-${{ matrix.type }}${{ matrix.type == 'cuda' && matrix.version || '' }}
|
||||
|
||||
- name: 构建并推送
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
file: ./docker/Dockerfile
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
build-args: |
|
||||
${{ matrix.type == 'cuda' && format('CUDA_VERSION={0}', matrix.version) || '' }}
|
||||
${{ matrix.type == 'directml' && 'USE_DIRECTML=1' || '' }}
|
||||
|
||||
- name: Docker Hub Description
|
||||
uses: peter-evans/dockerhub-description@v4
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
repository: ${{ secrets.DOCKERHUB_USERNAME }}/video-subtitle-remover
|
||||
19
README.md
19
README.md
@@ -31,6 +31,25 @@ Windows GPU版本v1.1.0(GPU):
|
||||
|
||||
> 仅供具有Nvidia显卡的用户使用(AMD的显卡不行)
|
||||
|
||||
**Docker版本:**
|
||||
```shell
|
||||
# Nvidia 10 20 30系显卡
|
||||
docker run -it --name vsr --gpus all eritpchy/video-subtitle-remover:1.1.1-cuda11.8
|
||||
|
||||
# Nvidia 40系显卡
|
||||
docker run -it --name vsr --gpus all eritpchy/video-subtitle-remover:1.1.1-cuda12.6
|
||||
|
||||
# Nvidia 50系显卡
|
||||
docker run -it --name vsr --gpus all eritpchy/video-subtitle-remover:1.1.1-cuda12.8
|
||||
|
||||
# AMD / Intel 独显 集显
|
||||
docker run -it --name vsr --gpus all eritpchy/video-subtitle-remover:1.1.1-directml
|
||||
|
||||
# 演示视频, 输入
|
||||
/vsr/test/test.mp4
|
||||
docker cp vsr:/vsr/test/test_no_sub.mp4 ./
|
||||
```
|
||||
|
||||
## 演示
|
||||
|
||||
- GUI版:
|
||||
|
||||
30
docker/Dockerfile
Normal file
30
docker/Dockerfile
Normal file
@@ -0,0 +1,30 @@
|
||||
FROM python:3.12
|
||||
|
||||
RUN --mount=type=cache,target=/root/.cache,sharing=private \
|
||||
apt update && \
|
||||
apt install -y libgl1-mesa-glx && \
|
||||
true
|
||||
|
||||
ADD . /vsr
|
||||
ARG CUDA_VERSION=11.8
|
||||
ARG USE_DIRECTML=0
|
||||
|
||||
# 如果是 CUDA 版本,执行 CUDA 特定设置
|
||||
RUN --mount=type=cache,target=/root/.cache,sharing=private \
|
||||
if [ "${USE_DIRECTML:-0}" != "1" ]; then \
|
||||
pip install paddlepaddle==3.0 && \
|
||||
pip install torch==2.7.0 torchvision==0.22.0 --index-url https://download.pytorch.org/whl/cu$(echo ${CUDA_VERSION} | tr -d '.') && \
|
||||
pip install -r /vsr/requirements.txt; \
|
||||
fi
|
||||
|
||||
# 如果是 DirectML 版本,执行 DirectML 特定设置
|
||||
RUN --mount=type=cache,target=/root/.cache,sharing=private \
|
||||
if [ "${USE_DIRECTML:-0}" = "1" ]; then \
|
||||
pip install paddlepaddle==3.0 && \
|
||||
pip install torch_directml==0.2.5.dev240914 && \
|
||||
pip install -r /vsr/requirements.txt; \
|
||||
fi
|
||||
|
||||
ENV LD_LIBRARY_PATH=/usr/local/lib/python3.12/site-packages/nvidia/cudnn/lib/
|
||||
WORKDIR /vsr
|
||||
CMD ["python", "/vsr/backend/main.py"]
|
||||
Reference in New Issue
Block a user