ops-docker
Write or modify Dockerfiles for this backend so it is ready to deploy on Linux. Use for tasks involving containerization, image optimization, or build/runtime issues in containers. Docker Compose is managed by the server — do not touch it.
- License 许可
- MIT
- 最近更新
- 2026-09-06
- Stars
- ★ 3
- Forks
- 0
01 前言 Front Matter
- name
- ops-docker
- description
- Write or modify Dockerfiles for this backend so it is ready to deploy on Linux. Use for tasks involving containerization, image optimization, or build/runtime issues in containers. Docker Compose is managed by the server — do not touch it.
02 资源文件 3
- 参考文档agents/openai.yaml266 B
- 参考文档references/context.md1.2 KB
- 参考文档templates/checklist.md1.3 KB
03 SKILL.md 正文
Skill: Ops Docker
Context (Required)
- Target: Dockerfile in
apps/api/and/orapps/worker/ - Stack: Go (Echo + sqlc for api, asynq for worker)
- Do NOT touch
docker-compose.yml— managed by the server
Principles
- Multi-stage build to minimize image size
builderstage: compile Go binaryrunnerstage: minimal alpine with binary only- Run as non-root user
- Build context is monorepo root so
packages/go-sharedandgo.workare available
Workflow
- Identify target app and its runtime needs.
- Copy
go.work,go.work.sum,packages/go-shared/, and the target app in builder stage. - Build Go binary in
builderstage. - Copy only the binary into
runnerstage. - Verify
CMD, port, and env var requirements before finishing.
Dockerfile Template (Echo API)
# Stage 1: Builder
FROM golang:1.26-alpine AS builder
WORKDIR /app
COPY go.work go.work.sum* ./
COPY packages/go-shared/ ./packages/go-shared/
COPY apps/api/ ./apps/api/
WORKDIR /app/apps/api
RUN go build -o /bin/server ./cmd/server/main.go
# Stage 2: Runner
FROM alpine:3.20
RUN apk --no-cache add ca-certificates tzdata
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
WORKDIR /app
COPY --from=builder --chown=appuser:appgroup /bin/server .
USER appuser
EXPOSE 8080
CMD ["./server"]
Dockerfile Template (asynq Worker)
# Stage 1: Builder
FROM golang:1.26-alpine AS builder
WORKDIR /app
COPY go.work go.work.sum* ./
COPY packages/go-shared/ ./packages/go-shared/
COPY apps/worker/ ./apps/worker/
WORKDIR /app/apps/worker
RUN go build -o /bin/worker ./cmd/worker/main.go
# Stage 2: Runner
FROM alpine:3.20
RUN apk --no-cache add ca-certificates tzdata
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
WORKDIR /app
COPY --from=builder --chown=appuser:appgroup /bin/worker .
USER appuser
CMD ["./worker"]
Rules
- Always build from monorepo root so
go.workresolvespackages/go-shared - Never copy
.envinto the image — inject via environment variable at runtime - Never expose unused ports
- Copy
go.work.sum*with glob to handle optional file gracefully
Prohibitions
- FORBIDDEN to modify
docker-compose.yml. - FORBIDDEN to run container as root unless strictly required.
- FORBIDDEN to copy the entire repo into the runner stage.
- FORBIDDEN to leave a Dockerfile that cannot be built deterministically.
Pre-Completion Checklist
- [ ] Dockerfile uses multi-stage build (golang:1.26-alpine builder, alpine:3.20 runner)
- [ ]
go.workandpackages/go-shared/copied in builder stage - [ ] Runner stage contains only the compiled binary
- [ ] Non-root user is used
- [ ] Port and CMD match target app
- [ ] All files end with newline (EOF)
04 同仓库更多 Skills
web-slicing
Convert screenshot/Figma designs into pixel-perfect frontend UI with reusable components. Use when the task focuses on visual and layout implementation.
web-seo-geo-friendly
Optimize public Next.js App Router pages for SEO and GEO (Generative Engine Optimization). Use when the user explicitly requests SEO/GEO optimization on public pages.
web-code-review
Review frontend code with a firm senior-lead standard, focusing on bugs, regressions, architecture risks, and test gaps in apps/web and the shared contracts the frontend depends on.
web-bugfix
Fix frontend bugs with minimum-touch changes, keep other surfaces stable, and sync schema, types, hooks, constants, tests, and related docs when impacted.
web-api-integrated
Integrate API endpoints into the frontend with Zod schemas, response types, constants, and react-query hooks. Use when implementing endpoints from an API contract, Postman, or Swagger.
skill-creator
Create a new skill from scratch with full structure — SKILL.md, references, templates, openai.yaml, Claude/OpenCode wrappers, and registration in manifest + AGENTS.md + CLAUDE.md.