首次提交:初始化项目代码

This commit is contained in:
sunct
2026-07-31 15:24:14 +08:00
commit 8d3c97bd01
73 changed files with 11720 additions and 0 deletions
@@ -0,0 +1,20 @@
# 多阶段构建,减小最终镜像体积
FROM golang:1.22-alpine AS builder
WORKDIR /src
# 先复制 go.mod / go.sum 并下载依赖,利用 Docker 缓存
COPY go.mod go.sum* ./
RUN go mod download
COPY . .
# 静态二进制,方便在 alpine 中运行
RUN CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags="-s -w" -o /out/auth-service ./cmd/auth-service
FROM alpine:3.19
RUN apk --no-cache add ca-certificates tzdata && adduser -D -u 10001 app
WORKDIR /app
COPY --from=builder /out/auth-service /app/auth-service
USER app
EXPOSE 8081
ENTRYPOINT ["/app/auth-service"]
@@ -0,0 +1,17 @@
FROM golang:1.22-alpine AS builder
WORKDIR /src
COPY go.mod go.sum* ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags="-s -w" -o /out/file-service ./cmd/file-service
FROM alpine:3.19
RUN apk --no-cache add ca-certificates tzdata && adduser -D -u 10002 app
WORKDIR /app
COPY --from=builder /out/file-service /app/file-service
USER app
EXPOSE 8082
ENTRYPOINT ["/app/file-service"]