ec2-backend-deployer
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseEC2 Backend Deployer
EC2 后端部署专家
Expert in deploying backend applications to EC2 instances using CI/CD pipelines, Docker containers, and GitHub Actions.
擅长使用CI/CD流水线、Docker容器和GitHub Actions将后端应用部署到EC2实例。
When to Use This Skill
何时使用此技能
Use when you're:
- Setting up CI/CD for backend deployment to EC2
- Configuring Docker-based deployments
- Implementing automated deployment pipelines
- Deploying NestJS, Next.js, or Express backends
- Setting up container registries and image management
- Configuring secure EC2 access (Tailscale)
当你需要以下操作时使用:
- 为后端部署到EC2设置CI/CD
- 配置基于Docker的部署
- 实现自动化部署流水线
- 部署NestJS、Next.js或Express后端
- 设置容器注册表和镜像管理
- 配置安全的EC2访问(Tailscale)
Quick Workflow
快速工作流程
- Dockerfile: Multi-stage build (base → builder → production)
- Registry: GitHub Container Registry (ghcr.io) recommended
- CI/CD: GitHub Actions with Tailscale for secure SSH
- Deploy: Docker Compose on EC2 with health checks
- Verify: Health endpoint + deployment verification
- Dockerfile:多阶段构建(基础 → 构建 → 生产)
- 注册表:推荐使用GitHub Container Registry (ghcr.io)
- CI/CD:结合Tailscale实现安全SSH的GitHub Actions
- 部署:在EC2上使用Docker Compose并配置健康检查
- 验证:健康端点 + 部署验证
Key Components
核心组件
Docker
Docker
- Multi-stage builds for smaller images
- Non-root user for security
- HEALTHCHECK for container orchestration
- BuildKit secrets for sensitive data
- 多阶段构建以生成更小的镜像
- 使用非root用户提升安全性
- HEALTHCHECK用于容器编排
- BuildKit密钥处理敏感数据
GitHub Actions
GitHub Actions
- for image building
docker/build-push-action - for secure access
tailscale/github-action - for deployment
appleboy/ssh-action
- 使用构建镜像
docker/build-push-action - 使用实现安全访问
tailscale/github-action - 使用执行部署
appleboy/ssh-action
EC2
EC2
- Docker Compose v2 required
- Health check verification
- Rollback procedures
- 需要Docker Compose v2
- 健康检查验证
- 回滚流程
References
参考资料
- Full guide: Dockerfile, CI/CD workflow, deployment, troubleshooting
- 完整指南:Dockerfile、CI/CD工作流、部署、故障排查