backend-python-cicd
GitLab CI + Docker 流水线
按「build → deploy」两阶段、分支触发规则与 Docker 多阶段构建,生成或维护 .gitlab-ci.yml、分支使用说明及部署脚本。部署方式固定为 dev → prod,且必须使用 Kubernetes(K8s)部署。生成或校验时必须遵循私有镜像源参考,尤其是 Python 相关:Docker 基础镜像使用 docker.dic.hillstonenet.com/library/python:*,pip/uv 安装依赖须使用约定镜像源(详见 assets/dockerfile-python-base.md)。文档与说明中的 Docker 命令、Git 命令均为可直接执行的命令:用户或 Agent 可将这些命令复制到终端直接运行,无需改写。在 .gitlab-ci.yml 中通过 dev_deploy / prod_deploy 调用 K8s 部署脚本,使用模板(如 dev_deployment.yaml.tpl)经 envsubst 替换后 kubectl apply。详细约定见 references/REFERENCE.md。
何时使用
- 用户要求「配置 GitLab CI」「写 .gitlab-ci.yml」「Docker 多阶段构建 + CI」「分支与部署流程」
- 用户需要流水线说明、分支约定或部署后 Docker 运行说明;或需区分「本地 Docker 构建测试」与「Git 提交触发流水线」两种方式、以及远程仓库前置检查
使用流程
0. 前置:远程仓库与构建方式
推荐顺序:先使用本地 Docker 构建测试,再通过 Git 提交触发流水线。
- 先:本地 Docker 构建与测试(必须优先执行):在项目根目录执行多阶段构建(见 assets/docker-build-commands.md),本地验证镜像能否正常构建与运行,并可本地
docker run做接口或功能验证;无需推送代码。Docker 命令可直接在终端执行(复制即用)。在确认本地构建与运行无误后,再执行步骤 2,避免有问题的提交触发流水线、占用 Runner 与部署环境。 - 再:通过 Git 提交触发流水线:将代码推送到配置了 GitLab CI 的远程仓库对应分支(如
develop、bugfix/*、master)后,GitLab 根据.gitlab-ci.yml自动创建并执行流水线,完成构建镜像、推送到私有仓库、执行部署脚本;无需在 GitLab 界面手动点击运行。Git 命令(如git remote、git push、git checkout等)可直接在终端执行,生成说明时应给出可复制执行的完整命令。
生成或说明文档时需强调上述顺序,并在「快速开始」或「开发流程」中把「本地 Docker 构建测试」放在「Git 推送触发流水线」之前。
More from hillstone-networks/agent-skills
project-initializer
Scaffolds new projects with README.md, AGENTS.md, and CI/CD (GitLab CI, GitHub Actions). Handles project type (generic / Flask backend / React frontend / Taro miniapp), tech stack, coding standards, quality level, and SDD (OpenSpec, SpecKit, GSD). All init flows (Flask, React, Taro) and conventions (backend-python-cicd, frontend-codegen, flask-backend-codegen, QA/testing, agent-roles/subagents) are built-in; no separate skills. Docs default to Chinese. Use when creating a project, initializing a repo, or setting up CI/CD/SDD.
13init-taro-miniapp
Initializes a Taro mini-program with npx @tarojs/cli init <projectName>; after init requires npm install, then creates directories under src, configures dev proxy for API, and may add/update README and AGENTS.md. No other file or config changes. Use when scaffolding a Taro/mini-program project.
8init-flask-backend
按分层架构与规范搭建 Flask API 后端项目,包含应用工厂、Blueprint/Flask-RESTful 路由、Service/Model 分层、权限与统一响应。在用户要创建或生成 Flask 后端、REST API 项目使用
8frontend-codegen
Generates React frontend code following project conventions: reuse-first (utils/components), UI vs business component split, data-driven routes, test-first (red/green), function components. When adding third-party libs, presents 3 options with pros/cons for user confirmation. Use when implementing features, pages, or components in a React + Ant Design + TypeScript + Vite project.
7flask-backend-codegen
项目规范生成 Flask API 后端代码(路由、Service、Model、Schema、权限策略与测试);开发中优先使用常见中间件,配置写入 .env.example、用法在 .env 补充。在用户要新增接口、新资源模块、或按规范生成/补全后端代码时使用。
7init-react-frontend
Scaffolds a new React frontend with Vite (Rolldown), React Compiler, TypeScript, Ant Design, react-router, Zustand, Vitest, jsdom, Tailwind CSS, Axios. Uses create-vite in Rolldown form with React + Compiler + TS by default. Creates utils, consts, route, components, test directories (route separate from consts); includes unit/component tests and end-to-end (e2e) testing. Optional CI/CD: defaults to GitLab CI, frontend built as nginx Docker image. All dependencies use latest versions. Use when initializing a frontend project or setting up React + TypeScript + Vite stack.
7