Go 项目,包含: - 服务端 updater:两阶段协议,ECDSA 签名验证,AES-GCM 加密 - 发送端 dcu-send:Gitea Action CLI - internal/auth:加解密/签名/会话管理 - internal/docker:Docker CLI 容器查找/拉取/重建 - action/:Gitea Action 定义 - deploy/Dockerfile:多阶段构建 - .gitea/workflows/build.yaml:CI/CD
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
FROM golang:1.25-alpine AS builder
|
||||
WORKDIR /src
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
COPY . .
|
||||
RUN CGO_ENABLED=0 go build -o /dcu-send ./cmd/dcu-send
|
||||
|
||||
FROM alpine:3.20
|
||||
RUN apk add --no-cache ca-certificates tzdata
|
||||
COPY --from=builder /dcu-send /usr/local/bin/dcu-send
|
||||
ENTRYPOINT ["dcu-send"]
|
||||
@@ -0,0 +1,34 @@
|
||||
name: Docker Compose Updater
|
||||
description: 触发远程 docker-compose 服务更新(拉取/重启)
|
||||
author: docker-compose-updater
|
||||
branding:
|
||||
icon: refresh-cw
|
||||
color: blue
|
||||
|
||||
inputs:
|
||||
url:
|
||||
description: Updater 地址,如 https://updater.example.com
|
||||
required: true
|
||||
project:
|
||||
description: docker-compose 项目名
|
||||
required: true
|
||||
service:
|
||||
description: 要操作的 service 名(api、frontend 等)
|
||||
required: true
|
||||
action:
|
||||
description: '操作类型: update(拉取+重启) / pull(仅拉取) / restart(仅重启)'
|
||||
required: false
|
||||
default: update
|
||||
signing_key:
|
||||
description: ECDSA 签名私钥 PEM 内容(Gitea Secret)
|
||||
required: true
|
||||
|
||||
runs:
|
||||
using: docker
|
||||
image: Dockerfile
|
||||
env:
|
||||
SIGNING_KEY: ${{ inputs.signing_key }}
|
||||
UPDATER_URL: ${{ inputs.url }}
|
||||
UPDATER_PROJECT: ${{ inputs.project }}
|
||||
UPDATER_SERVICE: ${{ inputs.service }}
|
||||
UPDATER_ACTION: ${{ inputs.action }}
|
||||
Reference in New Issue
Block a user