automated_api/.drone.yml
lixin 506f322154
Some checks failed
continuous-integration/drone/push Build is failing
ci(drone): Update Docker deployment configuration for Aliyun registry
- Renamed pipeline and Docker image to 'nodejs-app'
- Configured Aliyun container registry with credentials
- Updated Docker run command to use new image name and registry
- Added Docker registry mirror configuration
- Simplified deployment process with more specific image tagging
2025-01-25 10:30:43 +08:00

73 lines
1.7 KiB
YAML

kind: pipeline
type: docker
name: nodejs-deploy
volumes:
- name: node_modules
host:
path: /usr/local/blackend/node_modules
- name: pnpm_cache
host:
path: /usr/local/blackend/pnpm_cache
steps:
- name: build-docker
image: plugins/docker
settings:
dockerfile: Dockerfile
repo: your-registry/nodejs-app
tags:
- latest
- ${DRONE_COMMIT_SHA:0:8}
registry: registry.cn-hangzhou.aliyuncs.com # 替换为您的镜像仓库地址
username:
from_secret: docker_username
password:
from_secret: docker_password
volumes:
- name: node_modules
path: /drone/src/node_modules
- name: pnpm_cache
path: /root/.local/share/pnpm/store
- name: deploy
image: docker:dind
commands:
- mkdir -p /etc/docker
- |
echo '{
"registry-mirrors": [
"https://docker.1panel.live",
"https://ustc-edu-cn.mirror.aliyuncs.com",
"https://ccr.ccs.tencentyun.com",
"https://docker.m.daocloud.io"
]
}' > /etc/docker/daemon.json
- docker stop nodejs-app || true
- docker rm nodejs-app || true
- >
docker run -d
--name nodejs-app
--restart always
-p 8001:8001
-v /usr/local/blackend/node_modules:/app/node_modules
-v /usr/local/blackend/pnpm_cache:/root/.local/share/pnpm/store
-e NODE_ENV=production
-e PORT=8001
your-registry/nodejs-app:latest
volumes:
- name: docker_sock
path: /var/run/docker.sock
volumes:
- name: docker_sock
host:
path: /var/run/docker.sock
trigger:
branch:
- main
- develop
event:
- push
- pull_request