From 87a2e1897af258392871f867f0306394d95516bf Mon Sep 17 00:00:00 2001 From: Noah Hsu Date: Sat, 21 Jan 2023 00:14:24 +0800 Subject: [PATCH] add aria2.conf from `P3TERX` (close #1) --- .github/workflows/build.yml | 46 +++++++++++++++++++ .github/workflows/{docker.yml => release.yml} | 0 Dockerfile | 7 +-- entrypoint.sh | 8 +++- install.sh | 9 ++++ 5 files changed, 65 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/build.yml rename .github/workflows/{docker.yml => release.yml} (100%) create mode 100644 install.sh diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..ec786ea --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,46 @@ +name: build_docker + +on: + push: + branches: [ main ] + +jobs: + build_docker: + name: Docker + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: replace latest to tag + run: | + sed -i "s/latest/main/g" ./Dockerfile + cat ./Dockerfile + + - name: Docker meta + id: meta + uses: docker/metadata-action@v4 + with: + images: xhofe/alist-aria2 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Login to DockerHub + uses: docker/login-action@v2 + with: + username: xhofe + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push + id: docker_build + uses: docker/build-push-action@v3 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + platforms: linux/amd64,linux/arm64 diff --git a/.github/workflows/docker.yml b/.github/workflows/release.yml similarity index 100% rename from .github/workflows/docker.yml rename to .github/workflows/release.yml diff --git a/Dockerfile b/Dockerfile index d66cee9..2ec109c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,9 +3,10 @@ LABEL MAINTAINER="i@nn.ci" VOLUME /opt/alist/data/ WORKDIR /opt/alist/ COPY entrypoint.sh /entrypoint.sh -RUN apk add --no-cache aria2; \ - chmod +x /entrypoint.sh - +COPY install.sh /install.sh +RUN chmod +x /entrypoint.sh /install.sh; \ + /install.sh + ENV PUID=0 PGID=0 UMASK=022 EXPOSE 5244 ENTRYPOINT [ "/entrypoint.sh" ] \ No newline at end of file diff --git a/entrypoint.sh b/entrypoint.sh index c0e63f4..c0f204f 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -3,6 +3,10 @@ chown -R ${PUID}:${PGID} /opt/alist/ umask ${UMASK} -exec su-exec ${PUID}:${PGID} nohup aria2c --enable-rpc --rpc-allow-origin-all > /dev/null 2>&1 & +exec su-exec ${PUID}:${PGID} nohup aria2c \ + --enable-rpc \ + --rpc-allow-origin-all \ + --conf-path=/opt/alist/data/aria2/aria2.conf \ + >/dev/null 2>&1 & -exec su-exec ${PUID}:${PGID} ./alist server --no-prefix \ No newline at end of file +exec su-exec ${PUID}:${PGID} ./alist server --no-prefix diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..cccc3af --- /dev/null +++ b/install.sh @@ -0,0 +1,9 @@ +apk add --no-cache aria2 curl + +mkdir -p /opt/alist/data/aria2 +cd /opt/alist/data/aria2 +wget https://github.com/P3TERX/aria2.conf/archive/refs/heads/master.tar.gz +tar -zxvf master.tar.gz --strip-components=1 +rm -rf master.tar.gz +sed -i 's|rpc-secret|#rpc-secret|g' ./aria2.conf +./tracker.sh \ No newline at end of file