automated_api/.drone.yml
lixin e7c79e1d4a
Some checks failed
continuous-integration/drone/push Build is failing
ci(drone): Update Drone pipeline configuration for Docker deployment
- Renamed pipeline from 'nodejs-deploy' to 'automated-api'
- Added Docker-in-Docker (dind) service with privileged mode
- Configured Docker socket volume mounting for build and deploy stages
- Simplified Docker deployment configuration
2025-01-25 10:45:50 +08:00

69 lines
1.4 KiB
YAML

kind: pipeline
type: docker
name: automated-api
volumes:
- name: node_modules
host:
path: /usr/local/blackend/node_modules
- name: pnpm_cache
host:
path: /usr/local/blackend/pnpm_cache
services:
- name: docker
image: docker:dind
privileged: true
environment:
DOCKER_TLS_CERTDIR: ""
volumes:
- name: docker_sock
path: /var/run/docker.sock
steps:
- name: build-docker
image: plugins/docker
settings:
dockerfile: Dockerfile
tags:
- latest
- ${DRONE_COMMIT_SHA:0:8}
volumes:
- name: node_modules
path: /drone/src/node_modules
- name: pnpm_cache
path: /root/.local/share/pnpm/store
- name: docker_sock
path: /var/run/docker.sock
- name: deploy
image: docker:dind
commands:
- 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