automated_api/.drone.yml
lixin 457dd08b8d
Some checks failed
continuous-integration/drone/push Build is failing
ci(.drone.yml): 优化 Docker in Docker (DinD) 服务并添加等待步骤
- 将 Docker 服务镜像改为 plugins/docker
- 添加 wait-for-dind 步骤,等待 10 秒以确保 DinD 服务启动完成
- 将 build-docker-image 和 run-container 步骤的镜像改为 plugins/docker
2025-01-10 13:34:13 +08:00

51 lines
1.1 KiB
YAML

kind: pipeline
type: docker
name: nodejs-22-docker-ci
services:
- name: docker
image: plugins/docker
environment:
DOCKER_TLS_CERTDIR: ""
privileged: true
steps:
- name: wait-for-dind
image: busybox
commands:
- sleep 10 # 等待 10 秒以确保 DinD 服务启动完成
- name: git-clone
image: alpine/git
commands:
- git clone http://120.48.5.80:3000/lixin/automated_api.git
- cd automated_api
- name: build-docker-image
image: plugins/docker
volumes:
- name: docker-socket
path: /var/run/docker.sock
privileged: true
working_directory: automated_api
commands:
- docker info
- docker build -t rz/automated_api:latest -f Dockerfile .
- name: run-container
image: plugins/docker
volumes:
- name: docker-socket
path: /var/run/docker.sock
privileged: true
commands:
- echo "Checking Docker version"
- docker version
- echo "Running container"
- docker run -d -p 8001:8001 rz/automated_api:latest
trigger:
branch:
- main
event:
- push