feat: 统一sql命名、函数命名
This commit is contained in:
33
scripts/Dockerfile
Normal file
33
scripts/Dockerfile
Normal file
@@ -0,0 +1,33 @@
|
||||
FROM golang:1.24-alpine AS builder
|
||||
|
||||
# 安装 UPX
|
||||
RUN apk add --no-cache upx
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# 复制依赖文件
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
# 复制代码
|
||||
COPY . .
|
||||
|
||||
# 构建静态链接的二进制文件
|
||||
RUN go build -ldflags="-s -w" -o server ./cmd \
|
||||
&& upx -9 server
|
||||
|
||||
# alpine:3.19 scratch 最小体积
|
||||
FROM scratch
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# 复制二进制文件
|
||||
COPY --from=builder /app/server .
|
||||
|
||||
# 环境变量
|
||||
ENV APP_ENV=production
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
# 运行服务
|
||||
CMD ["./server"]
|
||||
Reference in New Issue
Block a user