Browse Source

refactor: 🛠️ 优化构建和运行阶段的命令,增加调试信息并修正配置文件路径

pull/25/head
chenjiale 1 month ago
parent
commit
2212d57a26
  1. 23
      .drone.yml

23
.drone.yml

@ -19,7 +19,9 @@ steps:
- name: dockersock - name: dockersock
path: /var/run/docker.sock path: /var/run/docker.sock
commands: commands:
# 构建镜像 - echo "=== BUILD STAGE PWD ==="
- pwd
- ls -l
- docker build -t alert-python:latest -f Dockerfile . - docker build -t alert-python:latest -f Dockerfile .
- name: run python container - name: run python container
@ -28,15 +30,24 @@ steps:
- name: dockersock - name: dockersock
path: /var/run/docker.sock path: /var/run/docker.sock
commands: commands:
- echo "=== RUN STAGE PWD ==="
- pwd
- ls -l
# 确保 config.py 一定是文件(避免被误识别为目录)
- test -f $(pwd)/config.py || (echo "config.py not found" && exit 1)
- docker stop alert-python || true - docker stop alert-python || true
- docker rm alert-python || true - docker rm alert-python || true
# 防止目录误判(保险措施,不加也可以)
- test -f $(pwd)/model-lab/config.py || exit 1 - docker run -d --restart always \
- docker run -d --restart always --name alert-python --network alert-net \ --name alert-python \
--network alert-net \
-p 8082:8082 \ -p 8082:8082 \
-v $(pwd)/model-lab/config.py:/opt/alert/model-lab/config.py:ro \ -v $(pwd)/config.py:/opt/alert/model-lab/config.py:ro \
-v $(pwd)/model-lab/config.py:/app/config.py:ro \ -v $(pwd)/config.py:/app/config.py:ro \
alert-python:latest alert-python:latest
volumes: volumes:
- name: dockersock - name: dockersock
host: host:

Loading…
Cancel
Save