Skip to content

Commit

Permalink
尝试添加docker版本
Browse files Browse the repository at this point in the history
  • Loading branch information
Biubush committed Apr 18, 2024
1 parent 9f7ee7f commit d3a599e
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 4 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: Build the Flask Project
run: |
mkdir dist
pyinstaller -D app.py --add-data "./static:./static" --add-data "./templates:./templates" --distpath dist -n alys
pyinstaller -D app.py --add-data "./static:./static" --add-data "./templates:./templates" --static --distpath dist -n alys
- name: Package the Flask Project
run: |
Expand Down Expand Up @@ -69,7 +69,7 @@ jobs:
pip install -r requirements.txt --break-system-packages
mkdir dist
mkdir binary
pyinstaller -D app.py --add-data "./static:./static" --add-data "./templates:./templates" --distpath dist -n alys
pyinstaller -D app.py --add-data "./static:./static" --add-data "./templates:./templates" --static --distpath dist -n alys
mv dist/alys dist/alys_${{ steps.extract_tag.outputs.tag_name }}_linux_arm64
cd dist
tar -czf alys_${{ steps.extract_tag.outputs.tag_name }}_linux_arm64.tar.gz *
Expand Down Expand Up @@ -108,7 +108,7 @@ jobs:
- name: Build the Flask Project
run: |
mkdir dist
pyinstaller -D app.py --add-data "./static;./static" --add-data "./templates;./templates" --distpath dist -n alys
pyinstaller -D app.py --add-data "./static;./static" --add-data "./templates;./templates" --static --distpath dist -n alys
- name: Package the Flask Project
run: |
Expand Down
17 changes: 17 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# 使用官方的 Debian Buster Slim 作为基础镜像
FROM debian:buster-slim

# 设置工作目录
WORKDIR /app

# 将本地的 init.sh 脚本复制到镜像中的 /app 目录下
COPY init.sh /app/init.sh

# 安装 curl 和 wget
RUN apt-get update && apt-get install -y curl wget python3 python3-pip git

# 开放容器的 8587 端口
EXPOSE 8587

# 定义容器启动时执行的命令,即运行 init.sh 脚本
CMD ["/bin/bash", "/app/init.sh"]
2 changes: 1 addition & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ def before_request():
WEBSITE = None # 个人ALYS项目域名
USER = None # 临时用户记录,用于登录阿里云盘
STARTUP = False # 标志初始化结束
VERSION = "V1.0.9" # 当前版本号
VERSION = "V1.0.8" # 当前版本号
# ---------------------------------------路由--------------------------------------


Expand Down
26 changes: 26 additions & 0 deletions init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash

set -e # 设置遇到错误立即退出脚本

# 克隆仓库
echo "克隆仓库 ..."
if ! git clone https://github.com/Biubush/alys.git; then
echo "无法克隆仓库,请检查网络连接或仓库地址是否正确。"
exit 1
fi
cd alys || exit 1

# 安装依赖
echo "安装依赖 ..."
if ! python3 -m pip install -i https://mirrors.aliyun.com/pypi/simple/ -r requirements.txt; then

echo "安装依赖失败,请检查依赖是否正确配置或网络连接是否正常。"
exit 1
fi

# 运行 app.py
echo "开始运行 alys程序 ..."
if ! python3 app.py; then
echo "启动应用程序失败,请检查应用程序是否正确配置。"
exit 1
fi
Binary file modified requirements.txt
Binary file not shown.

0 comments on commit d3a599e

Please sign in to comment.