This commit is contained in:
parent
4af94d2f2f
commit
1b2b268c41
21
.drone.yml
Normal file
21
.drone.yml
Normal 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
8
Dockerfile
Normal 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
10
scripts/news_broadcast.sh
Normal 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
10
scripts/weather_report.sh
Normal 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
|
||||||
|
|
22
supervisor/conf.d/supervisord.conf
Normal file
22
supervisor/conf.d/supervisord.conf
Normal 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
|
Loading…
x
Reference in New Issue
Block a user