Files
kami_boss/deploy/Dockerfile
danial e016db918b feat(order): 优化订单查询性能并添加上下文支持
- 在查询订单摘要信息时添加了对大量数据的分页处理,提升性能
- 新增 GetOrderCountByMap 函数用于获取订单总数
- 更新 QueryTotalSummary 和 QueryTodaySummary 函数,支持分页查询
- 为相关函数添加了 context 参数,以便于传递请求上下文
- 优化了部分代码结构,提高可读性和可维护性
2025-06-22 18:36:56 +08:00

48 lines
1.2 KiB
Docker

FROM golang:1.24 AS builder
# 定义参数
ARG USE_PROXY
WORKDIR /build
COPY .. /build/
# 根据USE_PROXY参数设置环境变量
RUN export GOPROXY=https://goproxy.cn,direct; \
export GO111MODULE=on \
&& export CGO_ENABLED=0 \
&& export GOOS=linux \
&& export GOARCH=amd64 \
&& go mod tidy && go build -ldflags="-s -w" main.go
FROM alpine:latest
WORKDIR /app
ENV TZ=Asia/Shanghai
ENV serverName=""
ENV gatewayAddr=""
ENV portalAddr=""
# 定义参数
ARG USE_PROXY
#设置国内镜像源,时区
RUN if [ "$USE_PROXY" = "1" ]; then \
echo "https://mirrors.aliyun.com/alpine/v3.18/main/" > /etc/apk/repositories && \
echo "https://mirrors.aliyun.com/alpine/v3.18/community/" >> /etc/apk/repositories; \
fi && \
apk update && \
apk upgrade && \
apk add --no-cache tzdata && \
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
echo "Asia/Shanghai" > /etc/timezone
COPY --from=builder /build/main /app/
COPY --from=builder /build/conf/ /app/conf/
COPY --from=builder /build/views/ /app/views/
COPY --from=builder /build/static/ /app/static/
COPY --from=builder /build/deploy/wait-for-it.sh /app/
# 启动服务
CMD ["sh", "wait-for-it.sh", "mysql:3306" , "./main"]
EXPOSE 12306