Add bind domain feature to caddy aria2 docker image

This commit is contained in:
2017-08-30 17:46:07 +08:00
commit 165b50c6bf
10 changed files with 242 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
Aria2 + AriaNg
+14
View File
@@ -0,0 +1,14 @@
{$DOMAIN} {
proxy / file-manager:80 {
transparent
}
gzip
}
{$DOMAIN}/aria2 {
root /usr/local/www/aria2
timeouts none
gzip
log stdout
errors stdout
}
+28
View File
@@ -0,0 +1,28 @@
FROM abiosoft/caddy
MAINTAINER Junv<wahyd4@gmail.com>
WORKDIR /root
# For build image in local quickly
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories
RUN apk update && apk add wget bash curl openrc screen aria2 tar --no-cache
COPY aria2.conf /root
COPY aria2c.sh /root
COPY Caddyfile /usr/local/caddy/Caddyfile
RUN mkdir -p /usr/local/www && mkdir -p /usr/local/www/aria2
#AriaNg
RUN mkdir /usr/local/www/aria2/Download && cd /usr/local/www/aria2 \
&& wget -N --no-check-certificate https://github.com/mayswind/AriaNg/releases/download/0.2.0/aria-ng-0.2.0.zip && unzip aria-ng-0.2.0.zip && rm -rf aria-ng-0.2.0.zip \
&& chmod -R 755 /usr/local/www/aria2 \
&& chmod +x /root/aria2c.sh
EXPOSE 6800 80 443
ENTRYPOINT ["/bin/sh", "/root/aria2c.sh"]
# CMD ["/bin/sh", "/root/aria2c.sh" ]
+50
View File
@@ -0,0 +1,50 @@
#用户名
#rpc-user=user
#密码
#rpc-passwd=passwd
#上面的认证方式不建议使用,建议使用下面的token方式
#设置加密的密钥
#rpc-secret=token
#允许rpc
enable-rpc=true
#允许所有来源, web界面跨域权限需要
rpc-allow-origin-all=true
#允许外部访问,false的话只监听本地端口
rpc-listen-all=true
#RPC端口, 仅当默认端口被占用时修改
#rpc-listen-port=6800
#最大同时下载数(任务数), 路由建议值: 3
max-concurrent-downloads=5
#断点续传
continue=true
#同服务器连接数
max-connection-per-server=5
#最小文件分片大小, 下载线程数上限取决于能分出多少片, 对于小文件重要
min-split-size=10M
#单文件最大线程数, 路由建议值: 5
split=10
#下载速度限制
max-overall-download-limit=0
#单文件速度限制
max-download-limit=0
#上传速度限制
max-overall-upload-limit=0
#单文件速度限制
max-upload-limit=0
#断开速度过慢的连接
#lowest-speed-limit=0
#验证用,需要1.16.1之后的release版本
#referer=*
#文件保存路径, 默认为当前启动位置
dir=/user-files/superuser/
#文件缓存, 使用内置的文件缓存, 如果你不相信Linux内核文件缓存和磁盘内置缓存时使用, 需要1.16及以上版本
#disk-cache=0
#另一种Linux文件缓存方式, 使用前确保您使用的内核支持此选项, 需要1.15及以上版本(?)
#enable-mmap=true
#文件预分配, 能有效降低文件碎片, 提高磁盘性能. 缺点是预分配时间较长
#所需时间 none < falloc ? trunc « prealloc, falloc和trunc需要文件系统和内核支持
file-allocation=prealloc
# General Options
# log=var/log/aria2.log
# log-level=info
+4
View File
@@ -0,0 +1,4 @@
#!/bin/sh
echo "Run aria2c and ariaNG"
/usr/bin/aria2c --conf-path="/root/aria2.conf" -D --enable-rpc --rpc-listen-all \
&& caddy -quic --conf /usr/local/caddy/Caddyfile
+29
View File
@@ -0,0 +1,29 @@
FROM nginx:alpine
MAINTAINER junv<wahyd4@gmail.com>
# For build image in local quickly
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories
RUN apk update && apk add wget bash curl openrc screen aria2 tar --no-cache
COPY aria2.conf /root
COPY aria2c.sh /root
COPY nginx.conf /etc/nginx/nginx.conf
COPY conf.d/ /etc/nginx/conf.d/
RUN mkdir -p /usr/local/www && mkdir -p /usr/local/www/aria2
#AriaNg
RUN mkdir /usr/local/www/aria2/Download && cd /usr/local/www/aria2 \
&& wget -N --no-check-certificate https://github.com/mayswind/AriaNg/releases/download/0.2.0/aria-ng-0.2.0.zip && unzip aria-ng-0.2.0.zip && rm -rf aria-ng-0.2.0.zip \
&& chmod -R 755 /usr/local/www/aria2 \
&& chmod +x /root/aria2c.sh
# forward request and error logs to docker log collector
RUN ln -sf /dev/stdout /var/log/nginx/access.log && ln -sf /dev/stderr /var/log/nginx/error.log
EXPOSE 6800 80
CMD ["sh", "/root/aria2c.sh" ]
+50
View File
@@ -0,0 +1,50 @@
#用户名
#rpc-user=user
#密码
#rpc-passwd=passwd
#上面的认证方式不建议使用,建议使用下面的token方式
#设置加密的密钥
#rpc-secret=token
#允许rpc
enable-rpc=true
#允许所有来源, web界面跨域权限需要
rpc-allow-origin-all=true
#允许外部访问,false的话只监听本地端口
rpc-listen-all=true
#RPC端口, 仅当默认端口被占用时修改
#rpc-listen-port=6800
#最大同时下载数(任务数), 路由建议值: 3
max-concurrent-downloads=5
#断点续传
continue=true
#同服务器连接数
max-connection-per-server=5
#最小文件分片大小, 下载线程数上限取决于能分出多少片, 对于小文件重要
min-split-size=10M
#单文件最大线程数, 路由建议值: 5
split=10
#下载速度限制
max-overall-download-limit=0
#单文件速度限制
max-download-limit=0
#上传速度限制
max-overall-upload-limit=0
#单文件速度限制
max-upload-limit=0
#断开速度过慢的连接
#lowest-speed-limit=0
#验证用,需要1.16.1之后的release版本
#referer=*
#文件保存路径, 默认为当前启动位置
dir=/user-files/superuser/
#文件缓存, 使用内置的文件缓存, 如果你不相信Linux内核文件缓存和磁盘内置缓存时使用, 需要1.16及以上版本
#disk-cache=0
#另一种Linux文件缓存方式, 使用前确保您使用的内核支持此选项, 需要1.15及以上版本(?)
#enable-mmap=true
#文件预分配, 能有效降低文件碎片, 提高磁盘性能. 缺点是预分配时间较长
#所需时间 none < falloc ? trunc « prealloc, falloc和trunc需要文件系统和内核支持
file-allocation=prealloc
# General Options
# log=var/log/aria2.log
# log-level=info
+4
View File
@@ -0,0 +1,4 @@
#!/bin/sh
echo "Run aria2c and ariaNG"
/usr/bin/aria2c --conf-path="/root/aria2.conf" -D --enable-rpc --rpc-listen-all \
&& nginx -g 'daemon off;'
+32
View File
@@ -0,0 +1,32 @@
server{
# server_name localhost;
listen 80;
client_max_body_size 10240M;
location / {
proxy_pass http://file-manager-server;
proxy_set_header Host $http_host;
client_max_body_size 10240M;
}
location /aria2 {
# try_files $uri $uri/ /index.html;
root /usr/local/www/;
index index.html index.htm;
proxy_set_header Host $http_host;
}
# location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc|css|js|woff2)$ {
# expires 24h;
# access_log off;
# add_header Cache-Control "public";
# }
}
upstream file-manager-server {
server file-manager;
}
+30
View File
@@ -0,0 +1,30 @@
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
server_names_hash_bucket_size 128;
include /etc/nginx/conf.d/*.conf;
}