Compare commits

...
10 Commits
Author SHA1 Message Date
junv 59c67bad8c Update the app version before build docker containers 2021-10-13 23:57:22 +11:00
junv-repo-bot c2881479a9 Update version 2021-10-13 12:51:45 +00:00
junvandGitHub 1f4a331147 Refine the logic of app new version checker (#181) 2021-10-13 23:48:37 +11:00
junv-repo-bot 461f0e9451 Update version 2021-10-13 12:22:50 +00:00
junv 381e7a760c github action fix 2021-10-13 23:10:55 +11:00
junvandGitHub 56190aea72 Add new version checker (#180)
* Add logic to allow user check new version

* update action
2021-10-13 23:01:35 +11:00
junv 42f1317afe Ignore curl error in github action 2021-10-13 17:23:26 +11:00
junv a6c21b228e Fix syntax issue in bash 2021-10-13 17:13:25 +11:00
junv feb2d5781b Add step to update tag 2021-10-13 16:54:09 +11:00
junvandGitHub 53985992c6 Build forego from source code (#179) 2021-10-12 23:23:10 +11:00
6 changed files with 72 additions and 7 deletions
+28
View File
@@ -13,6 +13,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
-
name: Update APP VERSION
if: contains(github.ref, '/tags/v')
run: |
VERSION=${GITHUB_REF#refs/tags/v}
echo $VERSION > APP_VERSION
-
name: Prepare
id: prepare
@@ -72,3 +78,25 @@ jobs:
if: contains(github.ref, '/heads/master') || contains(github.ref, '/tags/v')
run: |
docker buildx imagetools inspect ${{ steps.prepare.outputs.docker_image }}:${{ steps.prepare.outputs.version }}
-
name: Commit changes
if: contains(github.ref, '/tags/v')
uses: EndBug/add-and-commit@v7
with:
author_name: junv-repo-bot
author_email: me@toozhao.com
message: 'Update version'
add: 'APP_VERSION'
push: true
branch: master
-
name: Update tag
if: contains(github.ref, '/tags/v')
env:
API_KEY: ${{ secrets.BadgeAPIKey }}
run: |
VERSION=${GITHUB_REF#refs/tags/v}
curl --max-time 6 -XPUT -D- 'https://badges.toozhao.com/val/aria2-ui-docker' \
-H 'Content-Type: application/json' \
-H 'API_KEY': ${API_KEY} \
-d '{"value": "'${VERSION}'"}' || true
+1
View File
@@ -0,0 +1 @@
4.9.1
+18 -1
View File
@@ -1,3 +1,18 @@
FROM golang:alpine AS build-forego
RUN apk add --no-cache git openssh
WORKDIR /app
RUN git clone https://github.com/wahyd4/forego.git \
&& cd forego \
&& git checkout 20180216151118 \
&& go mod init \
&& go mod vendor \
&& go mod download \
&& go build -o forego \
&& chmod +x forego
FROM alpine:edge
LABEL AUTHOR=Junv<wahyd4@gmail.com>
@@ -20,10 +35,12 @@ ENV XDG_DATA_HOME=/app/.caddy/data
ENV XDG_CONFIG_HOME=/app/.caddy/config
ENV RCLONE_CONFIG_BASE64=""
ADD install.sh aria2c.sh caddy.sh Procfile init.sh start.sh rclone.sh /app/
ADD install.sh aria2c.sh caddy.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/
COPY --from=build-forego /app/forego/forego /app
RUN ./install.sh
RUN rm ./install.sh
+1
View File
@@ -2,3 +2,4 @@ caddy: /app/caddy.sh
filebrowser: /app/filebrowser -p 8080 -d /app/filebrowser.db -r /data -b /files
aria2c: /app/aria2c.sh
rclone: /app/rclone.sh
newer_version_checker: /app/new-version-checker.sh
-6
View File
@@ -13,20 +13,17 @@ case "$(arch)" in
platform=linux-amd64
caddy_file=caddy_${caddy_version}_linux_amd64.tar.gz
rclone_file=rclone-${rclone_version}-${platform}.zip
forego_file=forego-stable-${platform}.tgz
;;
armv7l)
platform=linux-armv7
caddy_file=caddy_${caddy_version}_linux_armv7.tar.gz
rclone_file=rclone-${rclone_version}-linux-arm-v7.zip
forego_file=forego-stable-linux-arm.tgz
;;
aarch64)
platform=linux-arm64
caddy_file=caddy_${caddy_version}_linux_arm64.tar.gz
rclone_file=rclone-${rclone_version}-${platform}.zip
forego_file=forego-stable-${platform}.tgz
;;
*)
@@ -50,9 +47,6 @@ adduser -D -u 1000 junv \
&& tar -zxf ${filebrowser_file} \
&& rm -rf ${filebrowser_file} \
&& rm LICENSE README.md CHANGELOG.md \
&& wget -N https://bin.equinox.io/c/ekMN3bCZFUn/${forego_file} \
&& tar -zxf ${forego_file} \
&& rm -rf ${forego_file} \
&& mkdir -p /usr/local/www \
&& mkdir -p /usr/local/www/aria2 \
&& rm -rf init /app/*.txt \
+24
View File
@@ -0,0 +1,24 @@
#! /bin/bash -u
sleep 5
set -e
APP_VERSION=$(cat APP_VERSION)
set +e
while true; do
echo "[INFO] $(date -u +'%Y-%m-%dT%H:%M:%SZ') Checking for new version against ${APP_VERSION} ..."
newer_version=$(curl --max-time 6 -s https://badges.toozhao.com/val/aria2-ui-docker?version=${APP_VERSION})
if [[ -z ${newer_version} ]]; then
echo "[WARN] $(date -u +'%Y-%m-%dT%H:%M:%SZ') Failed to check new version."
sleep 86400
continue
fi
if [[ ${newer_version} > ${APP_VERSION} ]]; then
echo "[INFO] $(date -u +'%Y-%m-%dT%H:%M:%SZ') Found newer Docker image version wahyd4/aria2-ui:${newer_version}, please consider to upgrade by using docker pull command to have better user experience."
# check new version daily
sleep 86400
continue
fi
echo "[INFO] $(date -u +'%Y-%m-%dT%H:%M:%SZ') Good job, you are using the latest version docker image"
sleep 86400
done