通过drone自动构建
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
seahi 2025-04-16 09:18:47 +08:00
parent 4af94d2f2f
commit 1b2b268c41
5 changed files with 71 additions and 0 deletions

21
.drone.yml Normal file
View File

@ -0,0 +1,21 @@
kind: pipeline
type: docker
name: Build docker iamge
node:
name: pve
steps:
- name: Build supervisor image
pull: if-not-exists
image: plugins/docker:20.10
privileged: false
settings:
dockerfile: Dockerfile
auto-tag: true
registry: harbor.seahi.me
repo: harbor.seahi.me/stu/task-supervisor
username:
from_secret: harbor_username
password:
from_secret: harbor_password

8
Dockerfile Normal file
View File

@ -0,0 +1,8 @@
FROM ubuntu
RUN apt update -y && apt install -y supervisor
COPY supervisor /etc/supervisor
COPY scripts /scripts
CMD ["/usr/bin/supervisord"]

10
scripts/news_broadcast.sh Normal file
View File

@ -0,0 +1,10 @@
#!/bin/bash
echo "新闻播报服务启动中..."
while true
do
# 模拟每5秒输出一次新闻头条
echo "[新闻播报] 当前时间: $(date '+%Y-%m-%d %H:%M:%S')头条今日科技新闻新型AI技术发布"
sleep 5
done

10
scripts/weather_report.sh Normal file
View File

@ -0,0 +1,10 @@
#!/bin/bash
echo "天气预报服务启动中..."
while true
do
# 模拟每10秒输出一次天气预报
echo "[天气预报] 当前时间: $(date '+%Y-%m-%d %H:%M:%S')天气晴朗温度25°C"
sleep 10
done

View File

@ -0,0 +1,22 @@
[supervisord]
# 设置是否在前台启动
nodaemon=true
# 关闭supervisor自身的日志
logfile=/dev/null
loglevel=error
logfile_maxbytes=0
# 定义被管理的进程
[program:weather_report]
command=/bin/bash /scripts/weather_report.sh
stdout_logfile=/dev/stdout # 将标准输出重定向到容器标准输出
stdout_logfile_maxbytes=0
stdout_events_enabled=false
[program:news_broadcast]
command=/bin/bash /scripts/news_broadcast.sh
stdout_logfile=/dev/stdout # 将标准输出重定向到容器标准输出
stdout_logfile_maxbytes=0
stdout_events_enabled=false