Skip to content

Commit ae93ee7

Browse files
author
Your Name
committed
vomm
0 parents  commit ae93ee7

30 files changed

+1285
-0
lines changed

.github/FUNDING.yml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# These are supported funding model platforms
2+
3+
github: [wahyd4]
4+
patreon: # Replace with a single Patreon username
5+
open_collective: # Replace with a single Open Collective username
6+
ko_fi: # Replace with a single Ko-fi username
7+
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8+
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9+
liberapay: # Replace with a single Liberapay username
10+
issuehunt: # Replace with a single IssueHunt username
11+
otechie: # Replace with a single Otechie username
12+
custom: https://www.paypal.me/junvzhao

.github/ISSUE_TEMPLATE/bug_report.md

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
## Please try to use English to describe your question or issue.
11+
12+
**Describe the bug**
13+
A clear and concise description of what the bug is.
14+
15+
**To Reproduce**
16+
Steps to reproduce the behavior:
17+
1. Go to '...'
18+
2. Click on '....'
19+
3. Scroll down to '....'
20+
4. See error
21+
22+
**Expected behavior**
23+
A clear and concise description of what you expected to happen.
24+
25+
**Screenshots**
26+
If applicable, add screenshots to help explain your problem.

.github/stale.yaml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Number of days of inactivity before an issue becomes stale
2+
daysUntilStale: 30
3+
# Number of days of inactivity before a stale issue is closed
4+
daysUntilClose: 7
5+
# Issues with these labels will never be considered stale
6+
exemptLabels:
7+
- pinned
8+
- security
9+
# Label to use when marking an issue as stale
10+
staleLabel: wontfix
11+
# Comment to post when marking an issue as stale. Set to `false` to disable
12+
markComment: >
13+
This issue has been automatically marked as stale because it has not had
14+
recent activity. It will be closed if no further activity occurs. Thank you
15+
for your contributions.
16+
# Comment to post when closing a stale issue. Set to `false` to disable
17+
closeComment: "Closed due to no further updates have been provided."

.github/workflows/dockerimage.yml

+102
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
name: Build and Push docker image
2+
on:
3+
pull_request:
4+
branches: master
5+
push:
6+
branches:
7+
- '*'
8+
tags:
9+
- v*
10+
jobs:
11+
build:
12+
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != 'wahyd4/aria2-ariang-docker'
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@master
16+
-
17+
name: Update APP VERSION
18+
if: contains(github.ref, '/tags/v')
19+
run: |
20+
VERSION=${GITHUB_REF#refs/tags/v}
21+
echo $VERSION > APP_VERSION
22+
-
23+
name: Prepare
24+
id: prepare
25+
run: |
26+
DOCKER_IMAGE=wahyd4/aria2-ui
27+
DOCKER_PLATFORMS=linux/amd64,linux/arm/v7,linux/arm64
28+
VERSION=edge
29+
30+
if [[ $GITHUB_REF == refs/tags/* ]]; then
31+
VERSION=${GITHUB_REF#refs/tags/v}
32+
fi
33+
TAGS="--tag ${DOCKER_IMAGE}:${VERSION}"
34+
if [[ $VERSION =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
35+
TAGS="$TAGS --tag ${DOCKER_IMAGE}:latest"
36+
fi
37+
38+
echo ::set-output name=docker_image::${DOCKER_IMAGE}
39+
echo ::set-output name=version::${VERSION}
40+
echo ::set-output name=buildx_args::--platform ${DOCKER_PLATFORMS} \
41+
--build-arg VERSION=${VERSION} \
42+
--build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') \
43+
--build-arg VCS_REF=${GITHUB_SHA::8} \
44+
${TAGS} --file Dockerfile .
45+
-
46+
name: Set up QEMU
47+
uses: docker/setup-qemu-action@v1
48+
-
49+
name: Set up Docker Buildx
50+
uses: docker/setup-buildx-action@v1
51+
-
52+
name: Cache Docker layers
53+
uses: actions/cache@v2
54+
id: cache
55+
with:
56+
path: /tmp/.buildx-cache
57+
key: ${{ runner.os }}-buildx-${{ github.sha }}
58+
restore-keys: |
59+
${{ runner.os }}-buildx-
60+
-
61+
name: Docker Buildx (build)
62+
run: |
63+
docker buildx build --output "type=image,push=false" ${{ steps.prepare.outputs.buildx_args }}
64+
-
65+
name: Login to DockerHub
66+
if: contains(github.ref, '/heads/master') || contains(github.ref, '/tags/v')
67+
uses: docker/login-action@v1
68+
with:
69+
username: ${{ secrets.DOCKER_HUB_USER }}
70+
password: ${{ secrets.DOCKER_HUB_PASS }}
71+
-
72+
name: Push docker images to Dockerhub
73+
if: contains(github.ref, '/heads/master') || contains(github.ref, '/tags/v')
74+
run: |
75+
docker buildx build --output "type=image,push=true" ${{ steps.prepare.outputs.buildx_args }}
76+
-
77+
name: Inspect image
78+
if: contains(github.ref, '/heads/master') || contains(github.ref, '/tags/v')
79+
run: |
80+
docker buildx imagetools inspect ${{ steps.prepare.outputs.docker_image }}:${{ steps.prepare.outputs.version }}
81+
-
82+
name: Commit changes
83+
if: contains(github.ref, '/tags/v')
84+
uses: EndBug/add-and-commit@v7
85+
with:
86+
author_name: junv-repo-bot
87+
author_email: [email protected]
88+
message: 'Update version'
89+
add: 'APP_VERSION'
90+
push: true
91+
branch: master
92+
-
93+
name: Update tag
94+
if: contains(github.ref, '/tags/v')
95+
env:
96+
API_KEY: ${{ secrets.BadgeAPIKey }}
97+
run: |
98+
VERSION=${GITHUB_REF#refs/tags/v}
99+
curl --max-time 6 -XPUT -D- 'https://badges.toozhao.com/val/aria2-ui-docker' \
100+
-H 'Content-Type: application/json' \
101+
-H 'API_KEY': ${API_KEY} \
102+
-d '{"value": "'${VERSION}'"}' || true
+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Docker Image Vulnability Check
2+
on:
3+
pull_request:
4+
branches: master
5+
push:
6+
branches:
7+
- '*'
8+
jobs:
9+
build:
10+
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != 'wahyd4/aria2-ariang-docker'
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@master
14+
- name: Build the Docker image
15+
run: docker build . --file Dockerfile --tag local/aria-ui:latest
16+
- name: Scan image
17+
uses: anchore/scan-action@v2
18+
with:
19+
image: "local/aria-ui:latest"
20+
fail-build: true
21+
severity-cutoff: high
22+
- name: grype scan JSON results
23+
run: for j in `ls ./anchore-reports/*.json`; do echo "---- ${j} ----"; cat ${j}; echo; done

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
conf/rclone.conf
2+
.devcontainer

APP_VERSION

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
4.14.1

Caddyfile

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#{
2+
# auto_https off
3+
#}
4+
5+
{$DOMAIN}
6+
7+
redir /ui / 301
8+
redir /ui/ / 301
9+
redir /rclone /rclone/ 301
10+
redir /files /files/ 301
11+
12+
reverse_proxy /jsonrpc 127.0.0.1:6800
13+
14+
route /rclone/* {
15+
uri strip_prefix /rclone
16+
reverse_proxy 127.0.0.1:5572
17+
}
18+
19+
route /files/* {
20+
uri strip_prefix /files
21+
reverse_proxy 127.0.0.1:8080
22+
}
23+
24+
route /ping {
25+
respond "app version: {env.APP_VERSION}"
26+
}
27+
28+
root * /usr/local/www/aria2
29+
file_server
30+
31+
encode gzip
32+
log {
33+
output stderr
34+
}

Dockerfile

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
FROM golang:alpine AS build-forego
2+
3+
RUN apk add --no-cache git openssh
4+
5+
WORKDIR /app
6+
7+
RUN git clone https://github.com/wahyd4/forego.git \
8+
&& cd forego \
9+
&& git checkout fix-go-mod \
10+
&& go mod download \
11+
&& go build -o forego \
12+
&& chmod +x forego
13+
14+
FROM alpine:edge
15+
16+
LABEL AUTHOR=Junv<[email protected]>
17+
18+
WORKDIR /app
19+
20+
ENV RPC_SECRET=""
21+
ENV ENABLE_AUTH=false
22+
ENV ENABLE_RCLONE=true
23+
ENV DOMAIN=:80
24+
ENV ARIA2_USER=user
25+
ENV ARIA2_PWD=password
26+
ENV ARIA2_SSL=false
27+
ENV ARIA2_EXTERNAL_PORT=80
28+
ENV PUID=1000
29+
ENV PGID=1000
30+
ENV CADDYPATH=/app
31+
ENV RCLONE_CONFIG=/app/conf/rclone.conf
32+
ENV XDG_DATA_HOME=/app/.caddy/data
33+
ENV XDG_CONFIG_HOME=/app/.caddy/config
34+
ENV RCLONE_CONFIG_BASE64=""
35+
ENV ENABLE_APP_CHECKER=true
36+
37+
ADD install.sh aria2c.sh caddy.sh Procfile init.sh start.sh rclone.sh new-version-checker.sh APP_VERSION /app/
38+
ADD conf /app/conf
39+
ADD Caddyfile SecureCaddyfile HerokuCaddyfile /usr/local/caddy/
40+
41+
COPY --from=build-forego /app/forego/forego /app
42+
43+
RUN ./install.sh
44+
45+
RUN rm ./install.sh
46+
47+
# folder for storing ssl keys
48+
VOLUME /app/conf/key
49+
50+
# file downloading folder
51+
VOLUME /data
52+
53+
EXPOSE 80 443
54+
55+
HEALTHCHECK --interval=30s --timeout=3s \
56+
CMD curl -f http://localhost/ping || exit 1
57+
58+
CMD ["./start.sh"]

HerokuCaddyfile

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
admin off
3+
auto_https off
4+
}
5+
6+
:PORT
7+
8+
basicauth / {
9+
ARIA2_USER ARIA2_PWD_ENCRYPT
10+
}
11+
12+
redir /ui / 301
13+
redir /ui/ / 301
14+
redir /rclone /rclone/ 301
15+
redir /files /files/ 301
16+
17+
reverse_proxy /jsonrpc 127.0.0.1:6800
18+
19+
route /rclone/* {
20+
uri strip_prefix /rclone
21+
reverse_proxy 127.0.0.1:5572
22+
}
23+
24+
route /files/* {
25+
uri strip_prefix /files
26+
reverse_proxy 127.0.0.1:8080
27+
}
28+
29+
route /ping {
30+
respond "app version: {env.APP_VERSION}"
31+
}
32+
33+
root * /usr/local/www/aria2
34+
file_server
35+
36+
encode gzip
37+
log {
38+
output stderr
39+
}

0 commit comments

Comments
 (0)