chore: 构建与仓库整理

- .gitignore 排除运行时产物(run/、cpa/、dist/、二进制、日志)
- dist 构建产物移出版本库(磁盘保留,发布走 Release 产物)
- Makefile/Dockerfile/docker-compose/config.yaml.example 同步 ops-assistant 更名
- 新增 VERSION 文件(0.0.1)
This commit is contained in:
2026-09-13 07:42:49 +08:00
parent 81939825d1
commit 811574cc6b
7 changed files with 93 additions and 24 deletions
+8 -8
View File
@@ -19,10 +19,10 @@ COPY . .
# 编译
RUN CGO_ENABLED=1 go build \
-ldflags "-X xiaji-go/version.Version=${VERSION} \
-X xiaji-go/version.GitCommit=${GIT_COMMIT} \
-X xiaji-go/version.BuildTime=${BUILD_TIME}" \
-o xiaji-go cmd/main.go
-ldflags "-X ops-assistant/version.Version=${VERSION} \
-X ops-assistant/version.GitCommit=${GIT_COMMIT} \
-X ops-assistant/version.BuildTime=${BUILD_TIME}" \
-o ops-assistant cmd/main.go
# ============ 运行阶段 ============
FROM debian:bookworm-slim
@@ -34,7 +34,7 @@ ENV TZ=Asia/Shanghai
WORKDIR /app
# 从构建阶段复制
COPY --from=builder /build/xiaji-go .
COPY --from=builder /build/ops-assistant .
COPY --from=builder /build/templates/ ./templates/
COPY --from=builder /build/config.yaml.example ./config.yaml.example
@@ -44,9 +44,9 @@ COPY --from=builder /go/pkg/mod/github.com/yanyiwu/gojieba@v1.3.0/dict/ /app/dic
# 数据目录
VOLUME ["/app/data"]
EXPOSE 9521
EXPOSE 9621
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD curl -f http://localhost:9521/health || exit 1
CMD curl -f http://localhost:9621/health || exit 1
ENTRYPOINT ["./xiaji-go"]
ENTRYPOINT ["./ops-assistant"]