Skip to content

Commit

Permalink
Merge pull request #291 from AmiyaBot/V6-dev
Browse files Browse the repository at this point in the history
V6 dev
  • Loading branch information
vivien8261 authored Sep 27, 2024
2 parents 7610824 + ffade70 commit 262a3a7
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 13 deletions.
9 changes: 7 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
Dockerfile
docker.sh
install.sh
dockersh/
black.sh
.git/
.gitignore
.gitmodules
pluginsDev/
pluginsServer/
2 changes: 1 addition & 1 deletion .github/workflows/package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,4 @@ jobs:
with:
context: .
push: true
tags: amiyabot/amiyabot:latest
tags: amiyabot/amiyabot:2.0.2, amiyabot/amiyabot:latest
14 changes: 10 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,18 @@ WORKDIR /app
# 守护端口
EXPOSE 8088

# 拷贝当前目录下的所有文件到工作目录
# 工作目录
COPY requirements.txt /app
COPY entrypoint.sh /app
COPY . /temp
RUN tar -zcvf amiyabot.tar.gz --exclude=/temp/.git --exclude=/temp/.vscode --exclude=/temp/.idea --exclude=/temp/docker.sh \
--exclude=/temp/entrypoint.sh --exclude=/temp/install.sh --exclude=/temp/Dockerfile /temp/*

# 临时目录
COPY . /app/temp
WORKDIR /app/temp
RUN tar -zcvf amiyabot.tar.gz --exclude=.git --exclude=.vscode --exclude=.idea --exclude=docker.sh \
--exclude=entrypoint.sh --exclude=install.sh --exclude=Dockerfile *
RUN mv amiyabot.tar.gz /app
WORKDIR /app
RUN rm -rf temp

# 安装依赖
RUN pip install -r requirements.txt
Expand Down
2 changes: 2 additions & 0 deletions install.sh → dockersh/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,9 @@ while true; do
read confirm
if [ "$confirm" ]; then
if [ "$confirm" = "y" ]; then
sudo docker pull amiyabot/amiyabot:latest
eval $command
echo "服务已启动, 控制台地址: http://<本机ip>:$port"
break
elif [ "$confirm" = "n" ]; then
echo "已取消"
Expand Down
13 changes: 7 additions & 6 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@

BOT_FOLDER=/amiyabot

if [ ! -f "$BOT_FOLDER/first_run" ]; then
# step 1: 解压bot本体
# step 1: 解压/覆盖bot文件
if [ -f "amiyabot.tar.gz" ]; then
tar -zxvf amiyabot.tar.gz -C $BOT_FOLDER
# step 2: 进入bot目录
fi

# step 2: 判断是否首次运行
if [ ! -f "$BOT_FOLDER/first_run" ]; then
cd $BOT_FOLDER
# step 3: 初始化配置文件
python entrypoint.py
# step 4: 标记已初始化
touch first_run
fi

# step 5: 运行bot
# step 3: 启动bot
cd $BOT_FOLDER
python amiya.py

0 comments on commit 262a3a7

Please sign in to comment.