Skip to content

Commit

Permalink
🔨 优化构建
Browse files Browse the repository at this point in the history
  • Loading branch information
Cp0204 committed Apr 25, 2024
1 parent 726f835 commit 28dbe19
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ jobs:
build-args: |
MAINTAINER=${{ github.repository_owner }}
BRANCH=${{ github.ref_name }}
SOURCE_COMMIT=${{ github.sha }}
BUILD_SHA=${{ github.sha }}
BUILD_TAG=${{ github.ref }}
context: .
platforms: |
linux/amd64
Expand Down
6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ RUN pip install flask apscheduler requests treelib
# 时区
ENV TZ="Asia/Shanghai"

#构建版本
ARG BUILD_SHA
ARG BUILD_TAG
ENV BUILD_SHA=$BUILD_SHA
ENV BUILD_TAG=$BUILD_TAG

# 端口
EXPOSE 5005

Expand Down
11 changes: 10 additions & 1 deletion app/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,22 @@
import os


def get_app_ver():
BUILD_SHA = os.environ.get("BUILD_SHA", "")
BUILD_TAG = os.environ.get("BUILD_TAG", "")
if BUILD_TAG[:1] == "v":
return BUILD_TAG
else:
return f"{BUILD_TAG}({BUILD_SHA[:7]})"


# 文件路径
python_path = "python3" if os.path.exists("/usr/bin/python3") else "python"
script_path = os.environ.get("SCRIPT_PATH", "./quark_auto_save.py")
config_path = os.environ.get("CONFIG_PATH", "./config/quark_config.json")

app = Flask(__name__)
app.config["APP_VERSION"] = "0.2.9.2"
app.config["APP_VERSION"] = get_app_ver()
app.secret_key = "ca943f6db6dd34823d36ab08d8d6f65d"
app.json.ensure_ascii = False
app.json.sort_keys = False
Expand Down
2 changes: 1 addition & 1 deletion app/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ <h3>任务#<span v-html="index+1"></span></h3>
<div class="row">
<div class="col-sm-12 text-center">
<p>
<a target="_blank" href="https://github.com/Cp0204/quark-auto-save"><i class="bi bi-github"></i> Cp0204/quark_auto_save</a> v[[ version ]]
<a target="_blank" href="https://github.com/Cp0204/quark-auto-save"><i class="bi bi-github"></i> Cp0204/quark_auto_save</a> [[ version ]]
</p>
</div>
</div>
Expand Down

0 comments on commit 28dbe19

Please sign in to comment.