Skip to content

Commit

Permalink
improve(aria2): move aria2 data to /opt/aria2; fix permission issues
Browse files Browse the repository at this point in the history
References:

AlistGo/with_aria2#13

Co-authored-by: GoodbyeNJN <[email protected]>
  • Loading branch information
Mmx233 and GoodbyeNJN committed Dec 30, 2024
1 parent d2236af commit b532a7b
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 13 deletions.
14 changes: 9 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,16 @@ RUN apk update && \
apk add --no-cache bash ca-certificates su-exec tzdata; \
[ "$INSTALL_FFMPEG" = "true" ] && apk add --no-cache ffmpeg; \
[ "$INSTALL_ARIA2" = "true" ] && apk add --no-cache curl aria2 && \
mkdir -p /root/.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 /root/.aria2 && rm -f /tmp/aria-conf.tar.gz && \
sed -i 's|rpc-secret|#rpc-secret|g' /root/.aria2/aria2.conf && \
touch /root/.aria2/aria2.session && \
/root/.aria2/tracker.sh ; \
tar -zxvf /tmp/aria-conf.tar.gz -C /opt/aria2/.aria2 && 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/*

COPY --from=builder /app/bin/alist ./
Expand Down
14 changes: 9 additions & 5 deletions Dockerfile.ci
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,16 @@ RUN apk update && \
apk add --no-cache bash ca-certificates su-exec tzdata; \
[ "$INSTALL_FFMPEG" = "true" ] && apk add --no-cache ffmpeg; \
[ "$INSTALL_ARIA2" = "true" ] && apk add --no-cache curl aria2 && \
mkdir -p /root/.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 /root/.aria2 && rm -f /tmp/aria-conf.tar.gz && \
sed -i 's|rpc-secret|#rpc-secret|g' /root/.aria2/aria2.conf && \
touch /root/.aria2/aria2.session && \
/root/.aria2/tracker.sh ; \
tar -zxvf /tmp/aria-conf.tar.gz -C /opt/aria2/.aria2 && 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/*

COPY /build/${TARGETPLATFORM}/alist ./
Expand Down
6 changes: 3 additions & 3 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ umask ${UMASK}
if [ "$1" = "version" ]; then
./alist version
else
chown -R ${PUID}:${PGID} /opt/alist/

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=/root/.aria2/aria2.conf \
--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
fi

0 comments on commit b532a7b

Please sign in to comment.