Compare commits

...
37 Commits
Author SHA1 Message Date
junv f7912556ad AI revise 2025-06-20 22:09:41 +10:00
junvandGitHub b22a36cb0d Update README.md 2025-06-11 21:17:54 +10:00
junv-repo-bot d19aee4d38 Update version 2025-03-07 06:39:23 +00:00
junvandGitHub 4a0bb9446f Make sure /ro and other resources are protected (#248) 2025-03-07 17:22:10 +11:00
junv-repo-bot 85e11866c1 Update version 2025-03-07 04:57:32 +00:00
junv 9a74f672b0 Update caddyfile 2025-03-07 15:21:33 +11:00
junvandGitHub e308b67902 use https://github.com/glowinthedark/caddy-file-server-browse-extension to enhance caddy file server user experience (#247) 2025-03-07 14:41:32 +11:00
junv-repo-bot 9ac63aef85 Update version 2025-03-07 02:57:50 +00:00
junvandGitHub 4c2cb0ddaf Enable caddy file server (#246)
* Enable caddy file server by default

* Update readme
2025-03-07 13:01:28 +11:00
junv-repo-bot e3beaca19e Update version 2025-03-06 12:35:07 +00:00
junv 9fb6123520 Urgent bug fix 2025-03-06 23:26:28 +11:00
junv-repo-bot 4394fde881 Update version 2025-03-06 12:17:53 +00:00
junv-repo-bot 21fbcad568 Update version 2025-03-06 12:07:22 +00:00
junvandGitHub 60a5a77193 Update README.md 2025-03-06 23:04:04 +11:00
junv-repo-bot 99c036f46c Update version 2025-03-06 11:51:44 +00:00
junvandGitHub ea0dbb9e14 Add logic to allow user disable filebrowser (#245) 2025-03-06 22:49:55 +11:00
junvandGitHub 3b41b6d1e2 Bump versions (#244)
* Bump versions

* Try to fix build
2025-03-06 22:41:39 +11:00
junvandGitHub 1a16f7195d Update versions (#241) 2023-11-11 08:22:13 +11:00
junv-repo-bot 3e39cacc35 Update version 2023-09-17 23:05:00 +00:00
divyam234andGitHub 6c3caac687 fix sed escaping (#239) 2023-09-18 08:52:04 +10:00
junv-repo-bot f400b16be3 Update version 2023-05-23 04:53:03 +00:00
junvandGitHub 8fbc2bb854 Add runit to fix chpst error (#237) 2023-05-22 13:52:41 +10:00
junvandGitHub e1c398c9d3 Try to make docker imager a bit smaller by removing unnecessary packages (#236) 2023-05-22 12:14:16 +10:00
junvandGitHub c3a5fda0a7 Switch to debian, which might fix some weired issues in RasberryPi (#235) 2023-05-21 19:50:04 +10:00
junvandGitHub a6c4ab584d Update README.md and not to recommend using 80 port 2023-05-04 09:20:33 +10:00
junv-repo-bot c81da61cec Update version 2023-04-20 05:07:37 +00:00
junvandGitHub 1e6c8855da Add ability to skip chown /data folder (#233)
* Add env FIX_DATA_VOLUME_PERMISSIONS to allow user to choose whether to chown the data folder

* Add another log
2023-04-20 13:38:50 +10:00
junvandGitHub 7597acf095 Minor readme correction 2023-04-14 15:56:40 +10:00
junvandGitHub 2f63249629 Update readme 2023-04-14 15:55:08 +10:00
junv-repo-bot b07e1388a4 Update version 2023-04-12 23:27:51 +00:00
junvandGitHub 197b0a433f bump versions (#232) 2023-04-13 09:14:53 +10:00
junvandGitHub 437436e9c0 Update readme about how to download file through curl and apple shortcuts to address #231 2023-04-13 08:50:58 +10:00
junv-repo-bot ec008b29bd Update version 2023-04-12 05:34:48 +00:00
junvandGitHub 014bb638f3 fix syntax error in aria2c.sh (#230)
* fix syntax error in aria2c.sh

* fix syntax error
2023-04-12 15:28:24 +10:00
junv-repo-bot fab62224f7 Update version 2023-04-12 05:03:57 +00:00
junvandGitHub 3cf974c98c Support just enable rpc-secret for aria2c (#229) 2023-04-12 14:59:48 +10:00
junv-repo-bot 0610f47717 Update version 2022-12-30 07:45:31 +00:00
19 changed files with 631 additions and 43 deletions
+11
View File
@@ -0,0 +1,11 @@
# Reduce build context size
.git
.gitignore
*.md
LICENSE
*.png
*.json
heroku.yml
k8s-manifest.yaml
Dockerfile.optimized
.dockerignore
+1 -1
View File
@@ -50,7 +50,7 @@ jobs:
uses: docker/setup-buildx-action@v1
-
name: Cache Docker layers
uses: actions/cache@v2
uses: actions/cache@v3
id: cache
with:
path: /tmp/.buildx-cache
+1 -1
View File
@@ -1 +1 @@
5.0.3
6.2.2
+9
View File
@@ -9,6 +9,7 @@ redir /ui / 301
redir /ui/ / 301
redir /rclone /rclone/ 301
redir /files /files/ 301
redir /ro /ro/ 301
reverse_proxy /rpc 127.0.0.1:6800
reverse_proxy /jsonrpc 127.0.0.1:6800
@@ -23,6 +24,14 @@ route /files/* {
reverse_proxy 127.0.0.1:8080
}
route /ro/* {
uri strip_prefix /ro
root * /data
file_server {
browse "{$CADDY_FILE_SERVER_BROWSE_HTML}"
}
}
route /ping {
respond "app version: {env.APP_VERSION}"
}
+7 -4
View File
@@ -1,6 +1,6 @@
FROM golang:alpine AS build-forego
FROM golang AS build-forego
RUN apk add --no-cache git openssh
RUN apt update && apt install -y git
WORKDIR /app
@@ -11,7 +11,7 @@ RUN git clone https://github.com/wahyd4/forego.git \
&& go build -o forego \
&& chmod +x forego
FROM alpine:edge
FROM debian:stable-slim
LABEL AUTHOR=Junv<wahyd4@gmail.com>
@@ -34,13 +34,16 @@ ENV XDG_CONFIG_HOME=/app/.caddy/config
ENV XDG_CACHE_HOME=/app/.cache
ENV RCLONE_CONFIG_BASE64=""
ENV ENABLE_APP_CHECKER=true
ENV ENABLE_FILEBROWSER=true
ENV CADDY_LOG_LEVEL=INFO
ENV RCLONE_AUTO_UPLOAD_PROVIDER=
ENV RCLONE_AUTO_UPLOAD_REMOTE_PATH=/downloads
ENV RCLONE_AUTO_UPLOAD_FILE_MIN_SIZE=1K
ENV RCLONE_AUTO_UPLOAD_FILE_MAX_SIZE=100G
ENV FIX_DATA_VOLUME_PERMISSIONS=false
ENV CADDY_FILE_SERVER_BROWSE_HTML=/app/browse.html
ADD install.sh aria2c.sh caddy.sh Procfile init.sh start.sh rclone.sh new-version-checker.sh APP_VERSION /app/
ADD install.sh aria2c.sh caddy.sh filebrowser.sh Procfile init.sh start.sh rclone.sh new-version-checker.sh APP_VERSION /app/
ADD conf /app/conf
ADD Caddyfile SecureCaddyfile HerokuCaddyfile /usr/local/caddy/
+152
View File
@@ -0,0 +1,152 @@
# Multi-stage build - Build forego with golang
FROM golang:1.21-bullseye AS build-forego
RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
WORKDIR /app
RUN git clone https://github.com/wahyd4/forego.git \
&& cd forego \
&& git checkout fix-go-mod \
&& go mod download \
&& CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-extldflags "-static"' -o forego \
&& chmod +x forego
# Build stage for downloading and preparing binaries
FROM debian:stable-slim AS build-deps
# Set versions - centralized for easy updates
ARG CADDY_VERSION=2.9.1
ARG FILEBROWSER_VERSION=v2.32.0
ARG RCLONE_VERSION=v1.69.1
ARG ARIANG_VERSION=1.3.10
# Install build dependencies
RUN apt-get update && apt-get install -y \
wget \
curl \
unzip \
tar \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /tmp
# Detect architecture and download binaries
RUN case "$(dpkg --print-architecture)" in \
amd64) \
PLATFORM=linux-amd64; \
CADDY_FILE=caddy_${CADDY_VERSION}_linux_amd64.tar.gz; \
RCLONE_FILE=rclone-${RCLONE_VERSION}-linux-amd64.zip; \
;; \
armhf) \
PLATFORM=linux-armv7; \
CADDY_FILE=caddy_${CADDY_VERSION}_linux_armv7.tar.gz; \
RCLONE_FILE=rclone-${RCLONE_VERSION}-linux-arm-v7.zip; \
;; \
arm64) \
PLATFORM=linux-arm64; \
CADDY_FILE=caddy_${CADDY_VERSION}_linux_arm64.tar.gz; \
RCLONE_FILE=rclone-${RCLONE_VERSION}-linux-arm64.zip; \
;; \
*) \
echo "[ERROR] unsupported arch $(dpkg --print-architecture), exit now"; \
exit 1; \
;; \
esac \
&& mkdir -p /app/bin /app/www \
# Download Caddy
&& wget -O caddy.tar.gz "https://github.com/caddyserver/caddy/releases/download/v${CADDY_VERSION}/${CADDY_FILE}" \
&& tar -xzf caddy.tar.gz -C /app/bin \
# Download Filebrowser
&& wget -O filebrowser.tar.gz "https://github.com/filebrowser/filebrowser/releases/download/${FILEBROWSER_VERSION}/${PLATFORM}-filebrowser.tar.gz" \
&& tar -xzf filebrowser.tar.gz -C /app/bin \
# Download Rclone
&& wget -O rclone.zip "https://downloads.rclone.org/${RCLONE_VERSION}/${RCLONE_FILE}" \
&& unzip rclone.zip \
&& cp rclone-*/rclone /app/bin/ \
# Download AriaNg
&& wget -O ariang.zip "https://github.com/mayswind/AriaNg/releases/download/${ARIANG_VERSION}/AriaNg-${ARIANG_VERSION}.zip" \
&& unzip ariang.zip -d /app/www/aria2 \
# Download custom browse.html
&& wget -O /app/browse.html "https://raw.githubusercontent.com/glowinthedark/caddy-file-server-browse-extension/39e997c91539d0f04fcce53a3cb6605b2ae9e50c/browse.html" \
# Clean up downloads
&& rm -rf *.tar.gz *.zip rclone-*
# Final runtime stage - debian:stable-slim as requested
FROM debian:stable-slim
LABEL AUTHOR=Junv<wahyd4@gmail.com>
WORKDIR /app
# Runtime environment variables
ENV RPC_SECRET="" \
ENABLE_AUTH=false \
ENABLE_RCLONE=true \
DOMAIN=:80 \
ARIA2_USER=user \
ARIA2_PWD=password \
ARIA2_SSL=false \
ARIA2_EXTERNAL_PORT=80 \
PUID=1000 \
PGID=1000 \
CADDYPATH=/app \
RCLONE_CONFIG=/app/conf/rclone.conf \
XDG_DATA_HOME=/app/.caddy/data \
XDG_CONFIG_HOME=/app/.caddy/config \
XDG_CACHE_HOME=/app/.cache \
RCLONE_CONFIG_BASE64="" \
ENABLE_APP_CHECKER=true \
ENABLE_FILEBROWSER=true \
CADDY_LOG_LEVEL=INFO \
RCLONE_AUTO_UPLOAD_PROVIDER= \
RCLONE_AUTO_UPLOAD_REMOTE_PATH=/downloads \
RCLONE_AUTO_UPLOAD_FILE_MIN_SIZE=1K \
RCLONE_AUTO_UPLOAD_FILE_MAX_SIZE=100G \
FIX_DATA_VOLUME_PERMISSIONS=false \
CADDY_FILE_SERVER_BROWSE_HTML=/app/browse.html
# Install only essential runtime dependencies in a single layer
RUN apt-get update && apt-get install -y \
aria2 \
curl \
libcap2-bin \
runit \
&& groupadd -g 1000 junv \
&& useradd -u 1000 -g junv -m -s /bin/bash junv \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Copy pre-built binaries from build stages
COPY --from=build-deps /app/bin/* /usr/local/bin/
COPY --from=build-deps /app/www /usr/local/www/
COPY --from=build-deps /app/browse.html /app/
COPY --from=build-forego /app/forego/forego /app/
# Copy application files in minimal layers
COPY --chmod=755 aria2c.sh caddy.sh filebrowser.sh init.sh start.sh rclone.sh new-version-checker.sh /app/
COPY Procfile APP_VERSION /app/
COPY conf /app/conf/
COPY Caddyfile SecureCaddyfile HerokuCaddyfile /usr/local/caddy/
# Set up permissions and directories in single layer
RUN chmod +x /usr/local/bin/* \
&& mkdir -p /usr/local/www/aria2/Download \
&& chmod +rw /app/conf/aria2.session \
&& chmod -R 755 /usr/local/www/aria2 \
&& mkdir -p /data /data/cloud /app/.caddy /app/.cache/aria2 \
&& chown -R junv:junv /data /app/.caddy /app/.cache \
&& ln -s /data/cloud /app/cloud \
&& setcap cap_net_bind_service=+ep /usr/local/bin/caddy
# Volumes
VOLUME ["/app/conf", "/data", "/app/.cache"]
# Expose ports
EXPOSE 80 443 6881
# Health check
HEALTHCHECK --interval=30s --timeout=3s \
CMD curl -f http://localhost/ping || exit 1
CMD ["./start.sh"]
+158
View File
@@ -0,0 +1,158 @@
# Multi-stage build - Build forego with golang
FROM golang:1.21-alpine AS build-forego
RUN apk add --no-cache git
WORKDIR /app
RUN git clone https://github.com/wahyd4/forego.git \
&& cd forego \
&& git checkout fix-go-mod \
&& go mod download \
&& CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-extldflags "-static"' -o forego \
&& chmod +x forego
# Build stage for downloading and preparing binaries
FROM alpine:3.19 AS build-deps
# Set versions - centralized for easy updates
ARG CADDY_VERSION=2.9.1
ARG FILEBROWSER_VERSION=v2.32.0
ARG RCLONE_VERSION=v1.69.1
ARG ARIANG_VERSION=1.3.10
# Install build dependencies
RUN apk add --no-cache \
wget \
unzip \
tar \
curl
WORKDIR /tmp
# Detect architecture and set platform variables
RUN case "$(arch)" in \
x86_64) \
PLATFORM=linux-amd64; \
CADDY_FILE=caddy_${CADDY_VERSION}_linux_amd64.tar.gz; \
RCLONE_FILE=rclone-${RCLONE_VERSION}-linux-amd64.zip; \
;; \
armv7l) \
PLATFORM=linux-armv7; \
CADDY_FILE=caddy_${CADDY_VERSION}_linux_armv7.tar.gz; \
RCLONE_FILE=rclone-${RCLONE_VERSION}-linux-arm-v7.zip; \
;; \
aarch64) \
PLATFORM=linux-arm64; \
CADDY_FILE=caddy_${CADDY_VERSION}_linux_arm64.tar.gz; \
RCLONE_FILE=rclone-${RCLONE_VERSION}-linux-arm64.zip; \
;; \
*) \
echo "[ERROR] unsupported arch $(arch), exit now"; \
exit 1; \
;; \
esac \
&& echo "PLATFORM=${PLATFORM}" > /tmp/platform.env \
&& echo "CADDY_FILE=${CADDY_FILE}" >> /tmp/platform.env \
&& echo "RCLONE_FILE=${RCLONE_FILE}" >> /tmp/platform.env
# Download and extract binaries
RUN . /tmp/platform.env \
&& mkdir -p /app/bin /app/www \
# Download Caddy
&& wget -O caddy.tar.gz "https://github.com/caddyserver/caddy/releases/download/v${CADDY_VERSION}/${CADDY_FILE}" \
&& tar -xzf caddy.tar.gz -C /app/bin \
# Download Filebrowser
&& wget -O filebrowser.tar.gz "https://github.com/filebrowser/filebrowser/releases/download/${FILEBROWSER_VERSION}/${PLATFORM}-filebrowser.tar.gz" \
&& tar -xzf filebrowser.tar.gz -C /app/bin \
# Download Rclone
&& wget -O rclone.zip "https://downloads.rclone.org/${RCLONE_VERSION}/${RCLONE_FILE}" \
&& unzip rclone.zip \
&& cp rclone-*/rclone /app/bin/ \
# Download AriaNg
&& wget -O ariang.zip "https://github.com/mayswind/AriaNg/releases/download/${ARIANG_VERSION}/AriaNg-${ARIANG_VERSION}.zip" \
&& unzip ariang.zip -d /app/www/aria2 \
# Download custom browse.html
&& wget -O /app/browse.html "https://raw.githubusercontent.com/glowinthedark/caddy-file-server-browse-extension/39e997c91539d0f04fcce53a3cb6605b2ae9e50c/browse.html" \
# Clean up
&& rm -rf *.tar.gz *.zip rclone-*
# Final runtime stage - use Alpine for minimal size
FROM alpine:3.19
LABEL AUTHOR=Junv<wahyd4@gmail.com>
WORKDIR /app
# Runtime environment variables
ENV RPC_SECRET="" \
ENABLE_AUTH=false \
ENABLE_RCLONE=true \
DOMAIN=:80 \
ARIA2_USER=user \
ARIA2_PWD=password \
ARIA2_SSL=false \
ARIA2_EXTERNAL_PORT=80 \
PUID=1000 \
PGID=1000 \
CADDYPATH=/app \
RCLONE_CONFIG=/app/conf/rclone.conf \
XDG_DATA_HOME=/app/.caddy/data \
XDG_CONFIG_HOME=/app/.caddy/config \
XDG_CACHE_HOME=/app/.cache \
RCLONE_CONFIG_BASE64="" \
ENABLE_APP_CHECKER=true \
ENABLE_FILEBROWSER=true \
CADDY_LOG_LEVEL=INFO \
RCLONE_AUTO_UPLOAD_PROVIDER= \
RCLONE_AUTO_UPLOAD_REMOTE_PATH=/downloads \
RCLONE_AUTO_UPLOAD_FILE_MIN_SIZE=1K \
RCLONE_AUTO_UPLOAD_FILE_MAX_SIZE=100G \
FIX_DATA_VOLUME_PERMISSIONS=false \
CADDY_FILE_SERVER_BROWSE_HTML=/app/browse.html
# Install runtime dependencies
RUN apk add --no-cache \
aria2 \
curl \
bash \
libcap \
runit \
shadow \
&& addgroup -g 1000 junv \
&& adduser -D -u 1000 -G junv -s /bin/bash junv \
&& rm -rf /var/cache/apk/*
# Copy pre-built binaries from build stage
COPY --from=build-deps /app/bin/* /usr/local/bin/
COPY --from=build-deps /app/www /usr/local/www/
COPY --from=build-deps /app/browse.html /app/
COPY --from=build-forego /app/forego/forego /app/
# Copy application files
COPY --chmod=755 aria2c.sh caddy.sh filebrowser.sh init.sh start.sh rclone.sh new-version-checker.sh /app/
COPY Procfile APP_VERSION /app/
COPY conf /app/conf/
COPY Caddyfile SecureCaddyfile HerokuCaddyfile /usr/local/caddy/
# Set up permissions and directories
RUN chmod +x /usr/local/bin/* \
&& mkdir -p /usr/local/www/aria2/Download \
&& chmod +rw /app/conf/aria2.session \
&& chmod -R 755 /usr/local/www/aria2 \
&& mkdir -p /data /data/cloud /app/.caddy /app/.cache/aria2 \
&& chown -R junv:junv /data /app/.caddy /app/.cache \
&& ln -s /data/cloud /app/cloud \
&& setcap cap_net_bind_service=+ep /usr/local/bin/caddy
# Volumes
VOLUME ["/app/conf", "/data", "/app/.cache"]
# Expose ports
EXPOSE 80 443 6881
# Health check
HEALTHCHECK --interval=30s --timeout=3s \
CMD curl -f http://localhost/ping || exit 1
CMD ["./start.sh"]
+12 -1
View File
@@ -5,7 +5,9 @@
:PORT
basicauth / {
@protected path / /index.html /css/* /js/* /ro /ro/* /jsonrpc
basicauth @protected {
ARIA2_USER ARIA2_PWD_ENCRYPT
}
@@ -13,6 +15,7 @@ redir /ui / 301
redir /ui/ / 301
redir /rclone /rclone/ 301
redir /files /files/ 301
redir /ro /ro/ 301
reverse_proxy /jsonrpc 127.0.0.1:6800
@@ -26,6 +29,14 @@ route /files/* {
reverse_proxy 127.0.0.1:8080
}
route /ro/* {
uri strip_prefix /ro
root * /data
file_server {
browse "{$CADDY_FILE_SERVER_BROWSE_HTML}"
}
}
route /ping {
respond "app version: {env.APP_VERSION}"
}
+83
View File
@@ -0,0 +1,83 @@
# Docker Image Size Optimization - Debian Base
## Current vs Optimized Comparison
### Original Dockerfile Issues:
1. **Download during runtime**: Large binaries downloaded during build
2. **Package manager waste**: No cleanup of apt caches
3. **Multiple layers**: Inefficient RUN command structure
4. **Unused build tools**: wget, unzip, tar remain in final image
5. **Redundant user setup**: User creation mixed with package installation
### Debian-Optimized Improvements:
#### 1. **Multi-Stage Build Enhancement**
- **Build stage**: Downloads all binaries (Caddy, Filebrowser, Rclone, AriaNg)
- **Runtime stage**: Only copies needed binaries
- **Result**: Removes ~50MB of download tools and temporary files
#### 2. **Layer Optimization**
```dockerfile
# BEFORE: Multiple RUN commands
RUN apt update
RUN apt install -y ...
RUN wget ...
RUN tar -zxf ...
RUN rm ...
# AFTER: Single optimized RUN command
RUN apt-get update && apt-get install -y ... \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
```
#### 3. **Package Management**
- Removed unnecessary packages (git, tar, unzip, wget from runtime)
- Proper cleanup: `apt-get clean + rm -rf /var/lib/apt/lists/*`
- **Size reduction**: ~30-40MB from package manager cleanup
#### 4. **Architecture Detection Improvement**
- Uses `dpkg --print-architecture` (Debian-native)
- More reliable than `arch` command
- Consistent with Debian ecosystem
#### 5. **File Organization**
- Pre-download all binaries in build stage
- Use `COPY --chmod=755` to reduce layers
- Single permissions setup RUN command
### Expected Size Reduction:
- **Conservative estimate**: 20-30% smaller (e.g., 400MB → 280-320MB)
- **Main savings**:
- Build tools removal: ~50MB
- Package cache cleanup: ~30-40MB
- Layer optimization: ~10-20MB
- Download deduplication: ~20MB
### Preserved Features:
✅ Same debian:stable-slim base image
✅ Multi-architecture support (amd64, armhf, arm64)
✅ All runtime functionality
✅ User permission handling
✅ Environment variables
✅ Health checks and volumes
### Risk Assessment:
- **Low risk**: No base image change
- **Low risk**: Same runtime dependencies
- **Low risk**: Improved build process only
- **Medium benefit**: Significant size reduction without compatibility issues
## Testing Commands:
```bash
# Build and compare
./compare-builds.sh
# Test functionality
docker run -d -p 6800:80 aria2-debian-optimized:latest
curl http://localhost:6800/ping
# Check final image size
docker images | grep aria2
```
+1 -1
View File
@@ -1,5 +1,5 @@
caddy: /app/caddy.sh
filebrowser: /app/filebrowser -p 8080 -d /app/filebrowser.db -r /data -b /files
filebrowser: /app/filebrowser.sh
aria2c: /app/aria2c.sh
rclone: /app/rclone.sh
newer_version_checker: /app/new-version-checker.sh
+26 -7
View File
@@ -23,6 +23,9 @@ English | [简体中文](https://github.com/wahyd4/aria2-ariang-docker/blob/mast
- [Supported Environment Variables](#supported-environment-variables)
- [Supported Volumes](#supported-volumes)
- [Auto HTTPS enabling](#auto-https-enabling)
- [Download Automation 🤖](#download-automation-)
- [Download file through iPhone/Mac Shortcuts app.](#download-file-through-iphonemac-shortcuts-app)
- [Download file through cURL](#download-file-through-curl)
- [Build the image by yourself](#build-the-image-by-yourself)
- [Docker Hub](#docker-hub)
- [Running it on Kubernetes (My favorite)](#running-it-on-kubernetes-my-favorite)
@@ -58,19 +61,20 @@ File Browser
* wahyd4/aria2-ui:latest
> Docker will pick the the proper ARCH for you. e.g. arm64v8 or x86_64
> Docker will pick proper CPU ARCH for you. e.g. arm64v8 or x86_64
## How to run
### Quick run
```shell
docker run -d --name aria2-ui -p 80:80 wahyd4/aria2-ui
docker run -d --name aria2-ui -p 8000:80 wahyd4/aria2-ui
```
* Aria2: <http://yourip>
* FileManger: <http://yourip/files>
* Rclone: <http://yourip/rclone>
* Aria2: <http://yourip:8000>
* Caddy File Server(Read Only) <http://yourip:8000/ro>
* FileManger: <http://yourip:8000/files>
* Rclone: <http://yourip:8000/rclone>
* Please use `admin`/`admin` as username and password to login `Filebrowser` for the first time. And use `user`/`password` to login `Rclone` if you don't update `ARIA2_USER` and `ARIA2_PWD`
### Full features run
@@ -121,7 +125,8 @@ Then simply run `docker-compose up -d`, that's it!
| ENV | Description|
|:---|:---|
| `ENABLE_AUTH` | Whether to enable Basic auth |
| `ENABLE_RCLONE` | Whether to disable Rclone, if you running this container offline or do not have stable connection to Github, please set to `false`
| `ENABLE_RCLONE` | Whether to disable Rclone, if you running this container offline or do not have stable connection to Github, please set to `false` |
| `ENABLE_FILEBROWSER` | Whether to disable Filebrowser, set it to `false` to disable it, by default it's enabled |
| `ARIA2_USER` | Basic Auth username, Rclone GUI uses it as well. |
| `ARIA2_PWD` | Basic Auth password, Rclone GUI uses it as well. |
| `ARIA2_EXTERNAL_PORT` | The Aria2 port which exposed to public to access to |
@@ -136,6 +141,7 @@ Then simply run `docker-compose up -d`, that's it!
| `RCLONE_AUTO_UPLOAD_REMOTE_PATH` | The file folder in remote cloud storage provider, default `/downloads`|
| `RCLONE_AUTO_UPLOAD_FILE_MIN_SIZE` | Set the minimum file size of auto uploader, files smaller than it won't be uploaded, default `1K` |
| `RCLONE_AUTO_UPLOAD_FILE_MAX_SIZE` | Set the limit of the Max file can be uploaded to 3rd party storage provider, default `100G`. |
| `FIX_DATA_VOLUME_PERMISSIONS` | Default value is `false`. When set to `true`, the container will run `chown -R` command against `/data` folder and `PUID` and `PGID` you set. Please set it to `true` when container complains you don't have enough permissions to manage the files and folders you mounted.|
### Supported Volumes
@@ -144,7 +150,7 @@ Then simply run `docker-compose up -d`, that's it!
|:---|:---|
| `/data` | The folder contains all the files you download. |
| `/app/conf/key` | The folder which stores Aria2 SSL `certificate` and `key` |file. `Notice`: The certificate file should be named `aria2.crt` and the key file should be named `aria2.key` |
| `/app/conf` | The Aria2 configuration and file session folder. Make sure you have `aria2.conf` and `aria2.session` file. For the first time `aria2.session` just need to be a empty file can be appended. You can also user the templates for these two file in the `conf` folder of this project. Please put your `rclone.conf` in this folder as well if you'd mount it to Rclone. So all the config files supported in this folder are: `aria2.conf`, `aria2.session`, `rclone.conf`. 🚨Warning🚨: if you don't mount `/app/conf`, whenever the container restarts, you'll lose your downloading progress. |
| `/app/conf` | The Aria2 configuration and file session folder. 🚨Please make sure you have `aria2.conf` and `aria2.session` file exist on your host, when yout mount /app/conf. For the first time `aria2.session` just need to be a empty file can be appended. You can also user the templates for these two file in the `conf` folder of this project. Please put your `rclone.conf` in this folder as well if you'd mount it to Rclone. So all the config files supported in this folder are: `aria2.conf`, `aria2.session`, `rclone.conf`. 🚨Warning🚨: if you don't mount `/app/conf`, whenever the container restarts, you'll lose your downloading progress. |
|`/app/conf/aria2.conf` | See description above👆🏼 |
|`/app/conf/aria2.session` | See description above👆🏼 |
|`/app/conf/rclone.conf` | See description above👆🏼 |
@@ -160,6 +166,18 @@ Make sure you have added proper `A` record point to the host you running to your
```bash
docker run -d --name aria2-ui -p 80:80 -p 443:443 -e DOMAIN=https://toozhao.com wahyd4/aria2-ui
```
## Download Automation 🤖
### Download file through iPhone/Mac Shortcuts app.
First [Download Shortcut](https://www.icloud.com/shortcuts/7483b8cec7484c0f98b72882d0f1e3e2), then follow the promots to setup aria2-ui URL and RPC_SECRET. Then you are all ready to go, just to run the shortcut and provide the file URL which you want to download or the magnet/torrent file URL.
### Download file through cURL
```bash
curl http://<ip>:<port>/jsonrpc -d "{\"jsonrcp\":\"2.0\",\"id\":\"someID\",\"method\":\"aria2.addUri\",\"params\":[\"token:someToken\",[\"http://some_file_url\"],{\"dir\":\"/data/downloads\"}]}"
```
## Build the image by yourself
```bash
@@ -191,3 +209,4 @@ I couldn't tell you how to run it in Kubernetes step by step, but once you have
2. If there is no speed at all when you downloading a BitTorrent file, please try to use a popular torrent file first to help the application to cache `DHT` file. Then the speed should get fast and fast, as well as downloading other links.
3. If you see any errors related to `setcap` which probably means the Linux you are running doesn't support running this application with `non-root` user. So please specify the `PUID` and `PGID` to `0` explicitly to use `root` user to run it.
4. How can I get `Rclone` authenticated? Due to Rclone is running in this docker image only as a component rather than an application, you can only interact with it via `/rclone` endpoint, and no other ports. So the web browser authentication mechanism doesn't work here. Please configure Rclone through command line within the container. You can follow the official doc [Configuring rclone on a remote / headless machine](https://rclone.org/remote_setup) or this [issue](https://github.com/wahyd4/aria2-ariang-docker/issues/118)
5. Why the app stopped working when I have `- v /<some-folder>:/app/conf` mounted. It happens when you mount the entire `/app/conf` folder but you don't have any files under that folder on your host. To fix this issue, please simply copy all files under [`conf`](https://github.com/wahyd4/aria2-ariang-docker/tree/master/conf) folder to your local folder that you mount to `/app/conf` and then rerun the container.
+12 -1
View File
@@ -5,7 +5,9 @@ log {
output stderr
}
basicauth / {
@protected path / /index.html /css/* /js/* /ro /ro/* /jsonrpc
basicauth @protected {
ARIA2_USER ARIA2_PWD_ENCRYPT
}
@@ -13,6 +15,7 @@ redir /ui / 301
redir /ui/ / 301
redir /rclone /rclone/ 301
redir /files /files/ 301
redir /ro /ro/ 301
reverse_proxy /rpc 127.0.0.1:6800
reverse_proxy /jsonrpc 127.0.0.1:6800
@@ -27,6 +30,14 @@ route /files/* {
reverse_proxy 127.0.0.1:8080
}
route /ro/* {
uri strip_prefix /ro
root * /data
file_server {
browse "{$CADDY_FILE_SERVER_BROWSE_HTML}"
}
}
route /ping {
respond "app version: {env.APP_VERSION}"
}
+16 -11
View File
@@ -1,21 +1,26 @@
#! /bin/bash -eu
sed -i 's/6800/'"${ARIA2_EXTERNAL_PORT}"'/g' /usr/local/www/aria2/js/aria-ng*.js
RPC_SECRET_BASE64=$(echo -n ${RPC_SECRET}|base64)
RPC_SECRET_BASE64=$(echo -n ${RPC_SECRET} | base64)
sed -i 's/secret:\"\"/secret:\"'"${RPC_SECRET_BASE64}"'\"/g' /usr/local/www/aria2/js/aria-ng*.js
if [ "$ARIA2_SSL" = "true" ]; then
echo "[INFO] Start aria2 with secure config"
if [[ "${ARIA2_SSL}" = "true" ]]; then
echo "[INFO] Start aria2 with secure config and rpc-secret"
/usr/bin/aria2c --conf-path="/app/conf/aria2.conf" \
--enable-rpc --rpc-listen-all \
--rpc-certificate=/app/conf/key/aria2.crt \
--rpc-private-key=/app/conf/key/aria2.key \
--rpc-secret="$RPC_SECRET" --rpc-secure \
/usr/bin/aria2c --conf-path="/app/conf/aria2.conf" \
--enable-rpc --rpc-listen-all \
--rpc-certificate=/app/conf/key/aria2.crt \
--rpc-private-key=/app/conf/key/aria2.key \
--rpc-secret="${RPC_SECRET}" --rpc-secure
elif [[ "${ARIA2_SSL}" = "false" ]] && [[ "${RPC_SECRET}" != "" ]]; then
echo "[INFO] Start aria2 with rpc-secret"
/usr/bin/aria2c --conf-path="/app/conf/aria2.conf" \
--enable-rpc \
--rpc-listen-all \
--rpc-secret="${RPC_SECRET}"
else
echo "[INFO] Start aria2 with standard mode"
/usr/bin/aria2c --conf-path="/app/conf/aria2.conf" --enable-rpc --rpc-listen-all
echo "[INFO] Start aria2 with standard mode"
/usr/bin/aria2c --conf-path="/app/conf/aria2.conf" --enable-rpc --rpc-listen-all
fi
+4 -4
View File
@@ -9,15 +9,15 @@ case $ENABLE_AUTH in
true)
echo "[INFO] Use Basic Auth config file "
export CADDY_FILE=/usr/local/caddy/SecureCaddyfile
sed -i 's/ARIA2_USER/'"${ARIA2_USER}"'/g' ${CADDY_FILE}
sed -i 's/ARIA2_PWD_ENCRYPT/'"${ARIA2_PWD_ENCRYPT}"'/g' ${CADDY_FILE}
sed -i "s#ARIA2_USER#${ARIA2_USER}#g" ${CADDY_FILE}
sed -i "s#ARIA2_PWD_ENCRYPT#${ARIA2_PWD_ENCRYPT}#g" ${CADDY_FILE}
;;
heroku)
echo "[INFO] Run Caddy with Heroku mode"
export CADDY_FILE=/usr/local/caddy/HerokuCaddyfile
sed -i 's/ARIA2_USER/'"${ARIA2_USER}"'/g' ${CADDY_FILE}
sed -i 's/ARIA2_PWD_ENCRYPT/'"${ARIA2_PWD_ENCRYPT}"'/g' ${CADDY_FILE}
sed -i "s#ARIA2_USER#${ARIA2_USER}#g" ${CADDY_FILE}
sed -i "s#ARIA2_PWD_ENCRYPT#${ARIA2_PWD_ENCRYPT}#g" ${CADDY_FILE}
sed -i 's/PORT/'"${PORT}"'/g' ${CADDY_FILE}
+42
View File
@@ -0,0 +1,42 @@
#!/bin/bash
echo "Building and comparing Docker images..."
# Build original image
echo "Building original image..."
docker build -f Dockerfile -t aria2-original:latest .
# Build Debian-optimized image
echo "Building Debian-optimized image..."
docker build -f Dockerfile.debian-optimized -t aria2-debian-optimized:latest .
# Build Alpine-optimized image
echo "Building Alpine-optimized image..."
docker build -f Dockerfile.optimized -t aria2-alpine-optimized:latest .
# Compare sizes
echo ""
echo "=== IMAGE SIZE COMPARISON ==="
echo "Original image:"
docker images aria2-original:latest --format "table {{.Repository}}\t{{.Tag}}\t{{.Size}}"
echo ""
echo "Debian-optimized image:"
docker images aria2-debian-optimized:latest --format "table {{.Repository}}\t{{.Tag}}\t{{.Size}}"
echo ""
echo "Alpine-optimized image:"
docker images aria2-alpine-optimized:latest --format "table {{.Repository}}\t{{.Tag}}\t{{.Size}}"
echo ""
echo "=== DETAILED LAYER ANALYSIS ==="
echo "Original layers:"
docker history aria2-original:latest --format "table {{.CreatedBy}}\t{{.Size}}"
echo ""
echo "Debian-optimized layers:"
docker history aria2-debian-optimized:latest --format "table {{.CreatedBy}}\t{{.Size}}"
echo ""
echo "Alpine-optimized layers:"
docker history aria2-alpine-optimized:latest --format "table {{.CreatedBy}}\t{{.Size}}"
Executable
+11
View File
@@ -0,0 +1,11 @@
#!/bin/bash -eu
echo "Checking if FileBrowser is enabled..."
if [ "$ENABLE_FILEBROWSER" = "true" ]; then
echo "Starting FileBrowser..."
/app/filebrowser -p 8080 -d /app/filebrowser.db -r /data -b /files
else
echo "FileBrowser is disabled. Set ENABLE_FILEBROWSER=true to enable it."
sleep 3650d
fi
+10 -3
View File
@@ -8,17 +8,24 @@ mkdir -p /app/.caddy
mkdir -p /app/.cache
mkdir -p /app/.cache/aria2
echo "[INFO] Run chown against app related folders and user ${PUID}"
chown -R junv:junv \
/app \
/app/.caddy \
/app/.cache \
/usr/local \
/var/log \
/data
/var/log
if [[ "${FIX_DATA_VOLUME_PERMISSIONS}" = "true" ]]; then
echo "[INFO] Setup user ${PUID} proper permissions for /data"
chown -R junv:junv /data
fi
chmod +x /app/caddy.sh \
/app/rclone.sh \
/app/aria2c.sh
/app/aria2c.sh \
/app/filebrowser.sh
echo "[INFO] Give caddy permissions to use low ports"
setcap cap_net_bind_service=+ep /usr/local/bin/caddy
+13 -9
View File
@@ -2,10 +2,10 @@
echo "[INFO] Set variables for $(arch)"
caddy_version=2.6.2
filebrowser_version=v2.23.0
rclone_version=v1.61.1
ariang_version=1.3.2
caddy_version=2.9.1
filebrowser_version=v2.32.0
rclone_version=v1.69.1
ariang_version=1.3.10
case "$(arch)" in
@@ -34,14 +34,15 @@ esac
filebrowser_file=${platform}-filebrowser.tar.gz
ariang_file=AriaNg-${ariang_version}.zip
adduser -D -u 1000 junv \
&& apk update \
&& apk add runit shadow wget bash curl openrc gnupg aria2 tar mailcap fuse vim libcap --no-cache \
groupadd junv \
&& useradd -g junv -m -s /bin/bash junv \
&& apt update \
&& apt install -y wget curl aria2 tar unzip libcap2-bin runit\
&& wget -N https://github.com/caddyserver/caddy/releases/download/v${caddy_version}/${caddy_file} \
&& tar -zxf ${caddy_file} \
&& mv caddy /usr/local/bin/ \
&& rm -rf ${caddy_file} \
&& wget -P /app -N https://raw.githubusercontent.com/glowinthedark/caddy-file-server-browse-extension/39e997c91539d0f04fcce53a3cb6605b2ae9e50c/browse.html \
&& platform=linux-amd64 \
&& wget -N https://github.com/filebrowser/filebrowser/releases/download/${filebrowser_version}/${filebrowser_file} \
&& tar -zxf ${filebrowser_file} \
@@ -65,6 +66,9 @@ adduser -D -u 1000 junv \
&& unzip ${ariang_file} \
&& rm -rf ${ariang_file} \
&& chmod -R 755 /usr/local/www/aria2 \
&& mkdir -p /data && chown junv:junv /data \
&& mkdir -p /data/cloud \
&& chown junv:junv /data/cloud \
&& ln -s /data/cloud /app
&& ln -s /data/cloud /app \
&& apt remove -y unzip\
&& apt clean
+62
View File
@@ -0,0 +1,62 @@
#!/bin/bash
echo "Testing Debian-optimized Docker image functionality..."
# Build the optimized image
echo "Building debian-optimized image..."
docker build -f Dockerfile.debian-optimized -t aria2-test:latest .
if [ $? -ne 0 ]; then
echo "❌ Build failed!"
exit 1
fi
echo "✅ Build successful!"
# Start container in background
echo "Starting container..."
docker run -d --name aria2-test-container -p 6800:80 -p 6881:6881 aria2-test:latest
# Wait for startup
echo "Waiting for services to start..."
sleep 10
# Test health endpoint
echo "Testing health endpoint..."
if curl -f http://localhost:6800/ping >/dev/null 2>&1; then
echo "✅ Health check passed!"
else
echo "❌ Health check failed!"
echo "Container logs:"
docker logs aria2-test-container
docker rm -f aria2-test-container
exit 1
fi
# Test AriaNg interface
echo "Testing AriaNg interface..."
if curl -f http://localhost:6800/ >/dev/null 2>&1; then
echo "✅ AriaNg interface accessible!"
else
echo "❌ AriaNg interface not accessible!"
fi
# Test aria2 RPC
echo "Testing aria2 RPC..."
if curl -f http://localhost:6800/jsonrpc >/dev/null 2>&1; then
echo "✅ Aria2 RPC accessible!"
else
echo "❌ Aria2 RPC not accessible!"
fi
# Show final image size
echo ""
echo "=== Final Image Size ==="
docker images aria2-test:latest --format "table {{.Repository}}\t{{.Tag}}\t{{.Size}}"
# Cleanup
echo ""
echo "Cleaning up test container..."
docker rm -f aria2-test-container
echo "✅ Functionality test completed!"