AgentSkillsCN

devops-packaging-service

服务打包配置的脚手架搭建。关键词:打包、服务、DevOps、脚手架搭建。

SKILL.md
--- frontmatter
name: devops-packaging-service
description: "Scaffold service packaging configuration. Keywords: packaging, service, devops, scaffolding."

Scaffold: HTTP Service Packaging

This document is an entrypoint for service packaging scaffolding. The step-by-step flow is in /.system/skills/ssot/repo/scaffolding/devops-packaging-service/SKILL.md.


1. Purpose & Scope

Purpose: Generate packaging skeleton for deploying a module as an HTTP service (Docker, container registry, etc.).

Scope:

  • Creates packaging configuration files
  • Sets up Dockerfile template
  • Configures build scripts
  • Records packaging decisions in workdocs

Out of scope:

  • Actual Docker image building
  • Container registry authentication
  • Deployment (see devops_deploy_service.md)
  • Job/batch workload packaging (see devops_packaging_job.md)

2. Inputs & Preconditions

Required Inputs

ParameterTypeDescription
service_namestringService identifier (used in image tags)
module_idstringSource module being packaged
portintegerService port (default: 8080)

Optional Inputs

ParameterTypeDefaultDescription
base_imagestringpython:3.11-slimDocker base image
build_commandstring(derived)Custom build command
health_check_pathstring/healthHealth check endpoint
registrystring""Container registry URL

Preconditions

  1. Target module exists in /modules/<module_id>/
  2. Module has a runnable entrypoint (src/ contains application code)
  3. /ops/packaging/ directory exists
  4. Human has container registry credentials (if pushing images)

3. Step-by-Step Flow (AI + Human)

See /.system/skills/ssot/repo/scaffolding/devops-packaging-service/SKILL.md.


4. Tools & Scripts

ToolPurpose
scripts/devops/scaffold/devops_packaging_service.pyOrchestrator script
/ops/packaging/scripts/build.shGenerated build script

5. Outputs & Side Effects

Files Created

code
ops/packaging/services/<service_name>/
  Dockerfile          # Docker build configuration
  build.sh            # Build script
  config.yaml         # Packaging configuration
  README.md           # Human-facing documentation

Dockerfile Template

dockerfile
# Auto-generated by devops_packaging_service scaffold
FROM python:3.11-slim

WORKDIR /app

# Install dependencies
COPY modules/<module_id>/requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Copy application code
COPY modules/<module_id>/src/ ./src/

# Health check
HEALTHCHECK --interval=30s --timeout=3s   CMD curl -f http://localhost:<port>/health || exit 1

# Run application
EXPOSE <port>
CMD ["python", "-m", "src.main"]

Configuration File

yaml
service_name: <service_name>
module_id: <module_id>
port: <port>
base_image: python:3.11-slim
health_check_path: /health
registry: ""
build_args: {}

6. Safety & Rollback

Safety Measures

  • --dry-run always available for preview
  • Human approval required before execution
  • No actual Docker builds during scaffold
  • Credentials not stored in generated files

Rollback Procedure

If scaffold fails or needs reverting:

  1. Delete the packaging directory:
    bash
    rm -rf ops/packaging/services/<service_name>/
    

7. Next Steps After Scaffolding

  1. Review and customize generated Dockerfile
  2. Build image locally:
    bash
    cd ops/packaging/services/<service_name>
    ./build.sh
    
  3. Push to registry (requires credentials):
    bash
    docker push <registry>/<service_name>:latest
    
  4. Configure deployment (see /.system/skills/ssot/repo/scaffolding/devops-deploy-service/SKILL.md)

8. Related Documents

  • /.system/skills/ssot/repo/scaffolding/devops-packaging-job/templates/packaging_template.md - Packaging knowledge template
  • /.system/skills/ssot/repo/scaffolding/devops-packaging-job/SKILL.md - Job packaging scaffold
  • /.system/skills/ssot/repo/scaffolding/devops-deploy-service/SKILL.md - Service deployment scaffold
  • /ops/packaging/AGENTS.md - Packaging strategy