Skip to content

Commit b588e45

Browse files
committed
optimize aria2
1 parent 9d9f0d9 commit b588e45

File tree

3 files changed

+22
-26
lines changed

3 files changed

+22
-26
lines changed

nextcloud/aria2/Dockerfile

+5-9
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,14 @@ WORKDIR /root
77
ARG ARIANG_URL="https://github.com/mayswind/AriaNg/releases"
88
ENV RPC_SECRET=Hello ENABLE_AUTH=false DOMAIN=0.0.0.0:80 ARIA2_USER=user ARIA2_PWD=password
99

10-
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories \
11-
&& apk add --no-cache wget bash curl openrc gnupg screen aria2 tar
12-
13-
RUN curl https://getcaddy.com | bash -s personal http.realip
14-
1510
ADD conf /root/conf
1611
COPY aria2c.sh /root
17-
1812
COPY Caddyfile /usr/local/caddy/
1913

20-
#AriaNg
2114
RUN set -ex \
15+
&& sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories \
16+
&& apk add --no-cache wget bash curl openrc gnupg screen aria2 tar \
17+
&& curl https://getcaddy.com | bash -s personal http.realip \
2218
&& export ARIANG_VERSION=$(curl ${ARIANG_URL}/latest -si | grep 'Location:' | grep -oE "[0-9]{1,2}[0-9.]+") \
2319
&& aria2_path=/usr/local/www/aria2 \
2420
&& install -d ${aria2_path} ${aria2_path}/Download \
@@ -27,11 +23,11 @@ RUN set -ex \
2723
&& curl -kL ${ARIANG_URL}/download/${ARIANG_VERSION}/AriaNg-${ARIANG_VERSION}.zip -o /root/AriaNg-${ARIANG_VERSION}.zip
2824

2925
#The folder to store ssl keys
30-
VOLUME /root/conf/key
26+
VOLUME /root/conf/ssl
3127
# User downloaded files
3228
VOLUME /data
3329

34-
EXPOSE 6800 80 443
30+
EXPOSE 6800 80
3531

3632
CMD ["/bin/sh", "/root/aria2c.sh" ]
3733

nextcloud/aria2/aria2c.sh

+11-4
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ run_aria2() {
1414

1515
prepare() {
1616
#local aria2_path=/usr/local/www/aria2
17-
aria2_path=/var/www/html/aria
17+
local aria2_path=${CADDY_ROOT}
18+
if [ -z "$aria2_path" ] || [ ! -d "${aria2_path}" ];then
19+
echo "$aria2_path do not exist"
20+
return 1
21+
fi
1822

1923
local aria_ng=$(find /root/ -name AriaNg-*.zip)
2024
[ -d "$aria2_path" ] || install -d $aria2_path $aria2_path/Download
@@ -31,7 +35,11 @@ prepare() {
3135
echo "check version"
3236
local curr_ver=$(cd $aria2_path;grep -oE "buildVersion:\"v[0-9.]+" js/aria-ng-*.min.js |grep -oE "[0-9.]+")
3337
local docker_ver=$(find /root -name AriaNg-*.zip | grep -oE "[0-9.]+[0-9]")
34-
[ -z "$docker_ver" ] && return
38+
39+
if [ -z "$docker_ver" ];then
40+
echo "can not get ariaNg package"
41+
return 0
42+
fi
3543

3644
if [ "$curr_ver" != "$docker_ver" ];then
3745
echo "update ariaNg version from $curr_ver to $docker_ver"
@@ -40,9 +48,8 @@ prepare() {
4048
unzip -o $aria_ng
4149
cd -
4250
fi
51+
return 0
4352
}
4453

4554
prepare
4655
run_aria2
47-
48-

nextcloud/docker-compose.yml

+6-13
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,20 @@
11
version: '3'
22

33
services:
4-
nextcloud:
5-
image: nextcloud:latest
6-
volumes:
7-
- ./data/nextcloud:/var/www/html
8-
- ./data/user-files:/data
9-
restart: always
104
aria2:
115
image: bensonfx/aria2-ui
126
build: aria2
137
ports:
148
- "6800:6800"
15-
# - "80:80"
16-
# - "443:443"
179
volumes:
1810
- ./data/user-files:/data
19-
# volumes:
20-
# - /data/ssl:/root/conf/key
21-
# - ~/data/aria2/aria2.conf:/root/conf/aria2.conf
11+
# - ./data/ssl:/root/conf/ssl
2212
environment:
23-
- DOMAIN=:80
24-
# - SSL=true
13+
- CADDY_SERVER=:80
14+
- CADDY_ROOT=/var/www/html/aria2
15+
# - ARIA2_RPC_SSL=true
16+
# - ARIA2_RPC_KEY=/data/ssl/aria2.key
17+
# - ARIA2_RPC_CERT=/data/ssl/aria2.crt
2518
# - RPC_SECRET=Hello
2619
# - ARIA2_USER=admin
2720
# - ARIA2_PWD=password

0 commit comments

Comments
 (0)