* build: add argument INSTALL_ARIA2 to dockerfile * feat: run aria2 in main entrypoint * feat(ci): environment matrix for docker release * improve(ci): allow overwrite artifacts in docker release * fix(ci): permission of alist binary in docker; entrypoint logic * improve(aria2): move aria2 data to /opt/aria2; fix permission issues References: https://github.com/AlistGo/with_aria2/pull/13 Co-authored-by: GoodbyeNJN <cc@fuckwall.cc> * fix(ci): aio image is not taking effect * fix(build): tar command in aria2 installation process (cherry picked from commit 647285408354807bae64df6a20fefb696ff787de) --------- Co-authored-by: GoodbyeNJN <cc@fuckwall.cc>
112 lines
3.0 KiB
YAML
112 lines
3.0 KiB
YAML
name: release_docker
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
|
|
env:
|
|
IMAGE_REGISTRY: 'xhofe/alist'
|
|
REGISTRY_USERNAME: 'xhofe'
|
|
REGISTRY_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
ARTIFACT_NAME: 'binaries_docker_release'
|
|
RELEASE_PLATFORMS: 'linux/amd64,linux/arm64,linux/arm/v7,linux/386,linux/arm/v6,linux/s390x,linux/ppc64le,linux/riscv64'
|
|
|
|
jobs:
|
|
build_binary:
|
|
name: Build Binaries for Docker Release
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
go-version: 'stable'
|
|
|
|
- name: Cache Musl
|
|
id: cache-musl
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: build/musl-libs
|
|
key: docker-musl-libs-v2
|
|
|
|
- name: Download Musl Library
|
|
if: steps.cache-musl.outputs.cache-hit != 'true'
|
|
run: bash build.sh prepare docker-multiplatform
|
|
|
|
- name: Build go binary
|
|
run: bash build.sh release docker-multiplatform
|
|
|
|
- name: Upload artifacts
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ${{ env.ARTIFACT_NAME }}
|
|
overwrite: true
|
|
path: |
|
|
build/
|
|
!build/*.tgz
|
|
!build/musl-libs/**
|
|
|
|
release_docker:
|
|
needs: build_binary
|
|
name: Release Docker image
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
image: ["latest", "ffmpeg", "aria2", "aio"]
|
|
include:
|
|
- image: "latest"
|
|
build_arg: ""
|
|
tag_favor: ""
|
|
- image: "ffmpeg"
|
|
build_arg: INSTALL_FFMPEG=true
|
|
tag_favor: "suffix=-ffmpeg,onlatest=true"
|
|
- image: "aria2"
|
|
build_arg: INSTALL_ARIA2=true
|
|
tag_favor: "suffix=-aria2,onlatest=true"
|
|
- image: "aio"
|
|
build_arg: |
|
|
INSTALL_FFMPEG=true
|
|
INSTALL_ARIA2=true
|
|
tag_favor: "suffix=-aio,onlatest=true"
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
- uses: actions/download-artifact@v4
|
|
with:
|
|
name: ${{ env.ARTIFACT_NAME }}
|
|
path: 'build/'
|
|
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v3
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Login to DockerHub
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: ${{ env.REGISTRY_USERNAME }}
|
|
password: ${{ env.REGISTRY_PASSWORD }}
|
|
|
|
- name: Docker meta
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: ${{ env.IMAGE_REGISTRY }}
|
|
flavor: |
|
|
latest=true
|
|
${{ matrix.tag_favor }}
|
|
|
|
- name: Build and push
|
|
id: docker_build
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
file: Dockerfile.ci
|
|
push: true
|
|
build-args: ${{ matrix.build_arg }}
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
platforms: ${{ env.RELEASE_PLATFORMS }} |