From eeb6ab0cbdfceb82f0d2f7dcf230ebb965edb619 Mon Sep 17 00:00:00 2001 From: lovegaoshi <106490582+lovegaoshi@users.noreply.github.com> Date: Sat, 30 Nov 2024 14:51:46 +0000 Subject: [PATCH] fix: build --- .github/workflows/build.aarch64.yaml | 41 ++++++++++++++++++++++++++++ .github/workflows/keepAlive.yml | 5 ++++ Dockerfile-aarch64 | 4 +-- biliupinit.py | 8 +++++- 4 files changed, 55 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/build.aarch64.yaml diff --git a/.github/workflows/build.aarch64.yaml b/.github/workflows/build.aarch64.yaml new file mode 100644 index 0000000..32dabad --- /dev/null +++ b/.github/workflows/build.aarch64.yaml @@ -0,0 +1,41 @@ +name: docker-aarch64 + +on: + schedule: + workflow_dispatch: + +jobs: + docker-aarch64: + runs-on: ubuntu-latest + steps: + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Login to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Free Disk Space (Ubuntu) + uses: jlumbroso/free-disk-space@main + with: + # this might remove tools that are actually needed, + # if set to "true" but frees about 6 GB + tool-cache: false + # all of these default to true, but feel free to set to + # "false" if necessary for your workflow + android: true + dotnet: true + haskell: true + large-packages: true + docker-images: false + swap-storage: false + + - name: Build and push + uses: docker/build-push-action@v4 + with: + push: true + tags: gaoshi/ipynb-inaseg:nightly-aarch64 + file: ./Dockerfile-aarch64 \ No newline at end of file diff --git a/.github/workflows/keepAlive.yml b/.github/workflows/keepAlive.yml index 63c7bce..a7ee84c 100644 --- a/.github/workflows/keepAlive.yml +++ b/.github/workflows/keepAlive.yml @@ -16,3 +16,8 @@ jobs: steps: - name: docker pull run: docker pull gaoshi/ipynb-inaseg:nightly-gpu + docker-gpu: + runs-on: ubuntu-latest + steps: + - name: docker pull + run: docker pull gaoshi/ipynb-inaseg:nightly-aarch64 diff --git a/Dockerfile-aarch64 b/Dockerfile-aarch64 index bc49e1f..dcd05c4 100644 --- a/Dockerfile-aarch64 +++ b/Dockerfile-aarch64 @@ -3,11 +3,11 @@ RUN sudo groupmod -g 1001 ubuntu RUN sudo usermod -u 1001 -g 1001 ubuntu RUN sudo apt-get update --allow-insecure-repositories RUN sudo apt-get -y --allow-unauthenticated install ffmpeg aria2 wget nano git -RUN sudo /home/ubuntu/python3-venv/python3 /inaseg/biliupinit.py --system aarch64-linux.tar.xz WORKDIR /inaseg RUN git clone https://github.com/lovegaoshi/inaSpeechSegmenter.git RUN cd inaSpeechSegmenter; pip install . COPY ./requirements.txt /inaseg/requirements.txt RUN pip3 install -r /inaseg/requirements.txt RUN pip3 install --force-reinstall git+https://github.com/grqz/yt-dlp.git@ie/bilibili/pi_fallbk -COPY . /inaseg \ No newline at end of file +COPY . /inaseg +RUN python3 /inaseg/biliupinit.py --system aarch64-linux.tar.xz \ No newline at end of file diff --git a/biliupinit.py b/biliupinit.py index c861bdc..1ee365e 100644 --- a/biliupinit.py +++ b/biliupinit.py @@ -10,6 +10,9 @@ parser.add_argument( '--system', type=str, default=r'x86_64-linux-musl.tar.xz', ) + parser.add_argument( + '--sudocp', type=bool, default=False, action='store_false' + ) args = parser.parse_args() req = requests.get('https://api.github.com/repositories/437055168/releases/latest').json() @@ -19,4 +22,7 @@ tarfile.open(biliup_tar_path).extractall() os.remove(biliup_tar_path) for file in glob.glob('biliupR*/*'): - os.rename(file, os.path.join('/bin', os.path.basename(file))) + if args.sudocp: + subprocess.call(['sudo', 'mv', file, '/bin']) + else: + os.rename(file, os.path.join('/bin', os.path.basename(file)))