Skip to content
Back to Deployment

Drone CI

Container-native CI/CD with .drone.yml and Docker pipeline steps.

CI/CDIntermediate

Why

Drone is container-native CI — every step runs in a Docker container. .drone.yml is simple, and it integrates with Gitea, GitHub, GitLab.

When

Use Drone for self-hosted CI with Docker. Avoid for managed (use GH Actions).

How

1. Install — Drone server + runner 2. Config — .drone.yml in repo 3. Step — Docker image + commands 4. Pipeline — trigger on push/PR 5. Secret — drone secret add 6. Volume — mount cache volumes 7. Plugin — pre-built steps (npm, docker)

Example

# .drone.yml kind: pipeline type: docker name: default steps: - name: test image: node:20 commands: [npm ci, npm test] - name: build image: node:20 commands: [npm run build] - name: deploy image: node:20 commands: [npx vercel --prod --token $VERCEL_TOKEN] when: { branch: [main] } trigger: { branch: [main, develop] }

Common Problems

  • ⚠Runner not connected — check DRONE_RPC_SECRET matches server
  • ⚠Secrets not available — add via drone CLI or UI, not in yml
  • ⚠Configuration drift between environments — use infrastructure-as-code (Terraform/Pulumi) to keep dev/staging/prod identical

Best Practices

  • ✓Use plugins for common steps — drone-plugin-node, drone-plugin-docker
  • ✓Cache with volumes — mount node_modules volume for speed
  • ✓Set up health checks and graceful shutdown — handle SIGTERM to drain in-flight requests before exit

FAQ