mirror of https://github.com/Xhofe/alist
feat(docker release): improve aria2 image, add aio image (#7750)
* 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>pull/7754/head
parent
365fc40dfe
commit
4dce53d72b
|
@ -5,9 +5,16 @@ on:
|
||||||
tags:
|
tags:
|
||||||
- 'v*'
|
- '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:
|
jobs:
|
||||||
release_docker:
|
build_binary:
|
||||||
name: Release Docker
|
name: Build Binaries for Docker Release
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
|
@ -31,11 +38,45 @@ jobs:
|
||||||
- name: Build go binary
|
- name: Build go binary
|
||||||
run: bash build.sh release docker-multiplatform
|
run: bash build.sh release docker-multiplatform
|
||||||
|
|
||||||
- name: Docker meta
|
- name: Upload artifacts
|
||||||
id: meta
|
uses: actions/upload-artifact@v4
|
||||||
uses: docker/metadata-action@v5
|
|
||||||
with:
|
with:
|
||||||
images: xhofe/alist
|
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
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v3
|
uses: docker/setup-qemu-action@v3
|
||||||
|
@ -46,8 +87,17 @@ jobs:
|
||||||
- name: Login to DockerHub
|
- name: Login to DockerHub
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
username: xhofe
|
username: ${{ env.REGISTRY_USERNAME }}
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
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
|
- name: Build and push
|
||||||
id: docker_build
|
id: docker_build
|
||||||
|
@ -56,53 +106,7 @@ jobs:
|
||||||
context: .
|
context: .
|
||||||
file: Dockerfile.ci
|
file: Dockerfile.ci
|
||||||
push: true
|
push: true
|
||||||
|
build-args: ${{ matrix.build_arg }}
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/386,linux/arm/v6,linux/s390x,linux/ppc64le,linux/riscv64
|
platforms: ${{ env.RELEASE_PLATFORMS }}
|
||||||
|
|
||||||
- name: Docker meta with ffmpeg
|
|
||||||
id: meta-ffmpeg
|
|
||||||
uses: docker/metadata-action@v5
|
|
||||||
with:
|
|
||||||
images: xhofe/alist
|
|
||||||
flavor: |
|
|
||||||
latest=true
|
|
||||||
suffix=-ffmpeg,onlatest=true
|
|
||||||
|
|
||||||
- name: Build and push with ffmpeg
|
|
||||||
id: docker_build_ffmpeg
|
|
||||||
uses: docker/build-push-action@v6
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
file: Dockerfile.ci
|
|
||||||
push: true
|
|
||||||
tags: ${{ steps.meta-ffmpeg.outputs.tags }}
|
|
||||||
labels: ${{ steps.meta-ffmpeg.outputs.labels }}
|
|
||||||
build-args: INSTALL_FFMPEG=true
|
|
||||||
platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/386,linux/arm/v6,linux/s390x,linux/ppc64le,linux/riscv64
|
|
||||||
|
|
||||||
release_docker_with_aria2:
|
|
||||||
needs: release_docker
|
|
||||||
name: Release docker with aria2
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout repo
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
repository: alist-org/with_aria2
|
|
||||||
ref: main
|
|
||||||
persist-credentials: false
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Add tag
|
|
||||||
run: |
|
|
||||||
git config --local user.email "bot@nn.ci"
|
|
||||||
git config --local user.name "IlaBot"
|
|
||||||
git tag -a ${{ github.ref_name }} -m "release ${{ github.ref_name }}"
|
|
||||||
|
|
||||||
- name: Push tags
|
|
||||||
uses: ad-m/github-push-action@master
|
|
||||||
with:
|
|
||||||
github_token: ${{ secrets.MY_TOKEN }}
|
|
||||||
branch: main
|
|
||||||
repository: alist-org/with_aria2
|
|
17
Dockerfile
17
Dockerfile
|
@ -10,6 +10,7 @@ RUN bash build.sh release docker
|
||||||
FROM alpine:edge
|
FROM alpine:edge
|
||||||
|
|
||||||
ARG INSTALL_FFMPEG=false
|
ARG INSTALL_FFMPEG=false
|
||||||
|
ARG INSTALL_ARIA2=false
|
||||||
LABEL MAINTAINER="i@nn.ci"
|
LABEL MAINTAINER="i@nn.ci"
|
||||||
|
|
||||||
WORKDIR /opt/alist/
|
WORKDIR /opt/alist/
|
||||||
|
@ -18,13 +19,25 @@ RUN apk update && \
|
||||||
apk upgrade --no-cache && \
|
apk upgrade --no-cache && \
|
||||||
apk add --no-cache bash ca-certificates su-exec tzdata; \
|
apk add --no-cache bash ca-certificates su-exec tzdata; \
|
||||||
[ "$INSTALL_FFMPEG" = "true" ] && apk add --no-cache ffmpeg; \
|
[ "$INSTALL_FFMPEG" = "true" ] && apk add --no-cache ffmpeg; \
|
||||||
|
[ "$INSTALL_ARIA2" = "true" ] && apk add --no-cache curl aria2 && \
|
||||||
|
mkdir -p /opt/aria2/.aria2 && \
|
||||||
|
wget https://github.com/P3TERX/aria2.conf/archive/refs/heads/master.tar.gz -O /tmp/aria-conf.tar.gz && \
|
||||||
|
tar -zxvf /tmp/aria-conf.tar.gz -C /opt/aria2/.aria2 --strip-components=1 && rm -f /tmp/aria-conf.tar.gz && \
|
||||||
|
sed -i 's|rpc-secret|#rpc-secret|g' /opt/aria2/.aria2/aria2.conf && \
|
||||||
|
sed -i 's|/root/.aria2|/opt/aria2/.aria2|g' /opt/aria2/.aria2/aria2.conf && \
|
||||||
|
sed -i 's|/root/.aria2|/opt/aria2/.aria2|g' /opt/aria2/.aria2/script.conf && \
|
||||||
|
sed -i 's|/root|/opt/aria2|g' /opt/aria2/.aria2/aria2.conf && \
|
||||||
|
sed -i 's|/root|/opt/aria2|g' /opt/aria2/.aria2/script.conf && \
|
||||||
|
touch /opt/aria2/.aria2/aria2.session && \
|
||||||
|
/opt/aria2/.aria2/tracker.sh ; \
|
||||||
rm -rf /var/cache/apk/*
|
rm -rf /var/cache/apk/*
|
||||||
|
|
||||||
COPY --from=builder /app/bin/alist ./
|
COPY --from=builder /app/bin/alist ./
|
||||||
COPY entrypoint.sh /entrypoint.sh
|
COPY entrypoint.sh /entrypoint.sh
|
||||||
RUN chmod +x /entrypoint.sh && /entrypoint.sh version
|
RUN chmod +x /opt/alist/alist && \
|
||||||
|
chmod +x /entrypoint.sh && /entrypoint.sh version
|
||||||
|
|
||||||
ENV PUID=0 PGID=0 UMASK=022
|
ENV PUID=0 PGID=0 UMASK=022 RUN_ARIA2=${INSTALL_ARIA2}
|
||||||
VOLUME /opt/alist/data/
|
VOLUME /opt/alist/data/
|
||||||
EXPOSE 5244 5245
|
EXPOSE 5244 5245
|
||||||
CMD [ "/entrypoint.sh" ]
|
CMD [ "/entrypoint.sh" ]
|
|
@ -2,6 +2,7 @@ FROM alpine:edge
|
||||||
|
|
||||||
ARG TARGETPLATFORM
|
ARG TARGETPLATFORM
|
||||||
ARG INSTALL_FFMPEG=false
|
ARG INSTALL_FFMPEG=false
|
||||||
|
ARG INSTALL_ARIA2=false
|
||||||
LABEL MAINTAINER="i@nn.ci"
|
LABEL MAINTAINER="i@nn.ci"
|
||||||
|
|
||||||
WORKDIR /opt/alist/
|
WORKDIR /opt/alist/
|
||||||
|
@ -10,13 +11,25 @@ RUN apk update && \
|
||||||
apk upgrade --no-cache && \
|
apk upgrade --no-cache && \
|
||||||
apk add --no-cache bash ca-certificates su-exec tzdata; \
|
apk add --no-cache bash ca-certificates su-exec tzdata; \
|
||||||
[ "$INSTALL_FFMPEG" = "true" ] && apk add --no-cache ffmpeg; \
|
[ "$INSTALL_FFMPEG" = "true" ] && apk add --no-cache ffmpeg; \
|
||||||
|
[ "$INSTALL_ARIA2" = "true" ] && apk add --no-cache curl aria2 && \
|
||||||
|
mkdir -p /opt/aria2/.aria2 && \
|
||||||
|
wget https://github.com/P3TERX/aria2.conf/archive/refs/heads/master.tar.gz -O /tmp/aria-conf.tar.gz && \
|
||||||
|
tar -zxvf /tmp/aria-conf.tar.gz -C /opt/aria2/.aria2 --strip-components=1 && rm -f /tmp/aria-conf.tar.gz && \
|
||||||
|
sed -i 's|rpc-secret|#rpc-secret|g' /opt/aria2/.aria2/aria2.conf && \
|
||||||
|
sed -i 's|/root/.aria2|/opt/aria2/.aria2|g' /opt/aria2/.aria2/aria2.conf && \
|
||||||
|
sed -i 's|/root/.aria2|/opt/aria2/.aria2|g' /opt/aria2/.aria2/script.conf && \
|
||||||
|
sed -i 's|/root|/opt/aria2|g' /opt/aria2/.aria2/aria2.conf && \
|
||||||
|
sed -i 's|/root|/opt/aria2|g' /opt/aria2/.aria2/script.conf && \
|
||||||
|
touch /opt/aria2/.aria2/aria2.session && \
|
||||||
|
/opt/aria2/.aria2/tracker.sh ; \
|
||||||
rm -rf /var/cache/apk/*
|
rm -rf /var/cache/apk/*
|
||||||
|
|
||||||
COPY /build/${TARGETPLATFORM}/alist ./
|
COPY /build/${TARGETPLATFORM}/alist ./
|
||||||
COPY entrypoint.sh /entrypoint.sh
|
COPY entrypoint.sh /entrypoint.sh
|
||||||
RUN chmod +x /entrypoint.sh && /entrypoint.sh version
|
RUN chmod +x /opt/alist/alist && \
|
||||||
|
chmod +x /entrypoint.sh && /entrypoint.sh version
|
||||||
|
|
||||||
ENV PUID=0 PGID=0 UMASK=022
|
ENV PUID=0 PGID=0 UMASK=022 RUN_ARIA2=${INSTALL_ARIA2}
|
||||||
VOLUME /opt/alist/data/
|
VOLUME /opt/alist/data/
|
||||||
EXPOSE 5244 5245
|
EXPOSE 5244 5245
|
||||||
CMD [ "/entrypoint.sh" ]
|
CMD [ "/entrypoint.sh" ]
|
|
@ -1,11 +1,19 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
chown -R ${PUID}:${PGID} /opt/alist/
|
|
||||||
|
|
||||||
umask ${UMASK}
|
umask ${UMASK}
|
||||||
|
|
||||||
if [ "$1" = "version" ]; then
|
if [ "$1" = "version" ]; then
|
||||||
./alist version
|
./alist version
|
||||||
else
|
else
|
||||||
|
if [ "$RUN_ARIA2" = "true" ]; then
|
||||||
|
chown -R ${PUID}:${PGID} /opt/aria2/
|
||||||
|
exec su-exec ${PUID}:${PGID} nohup aria2c \
|
||||||
|
--enable-rpc \
|
||||||
|
--rpc-allow-origin-all \
|
||||||
|
--conf-path=/opt/aria2/.aria2/aria2.conf \
|
||||||
|
>/dev/null 2>&1 &
|
||||||
|
fi
|
||||||
|
|
||||||
|
chown -R ${PUID}:${PGID} /opt/alist/
|
||||||
exec su-exec ${PUID}:${PGID} ./alist server --no-prefix
|
exec su-exec ${PUID}:${PGID} ./alist server --no-prefix
|
||||||
fi
|
fi
|
Loading…
Reference in New Issue