- Implemented end-to-end tests for API health checks, performance, behavior, and documentation. - Created integration tests for database connection, CRUD operations, transactions, and connection pool management. - Developed unit tests for configuration loading, environment variable handling, validation, default values, and helper functions. - Established a test setup with environment management and basic usage examples for the testing framework.
32 lines
542 B
Docker
32 lines
542 B
Docker
# 开发环境 Dockerfile
|
|
FROM golang:1.22-alpine AS builder
|
|
|
|
# 安装必要的工具
|
|
RUN apk add --no-cache git ca-certificates tzdata
|
|
|
|
# 设置工作目录
|
|
WORKDIR /app
|
|
|
|
# 复制 go mod 文件
|
|
COPY go.mod go.sum ./
|
|
|
|
# 设置 Go 代理
|
|
RUN go env -w GOPROXY=https://goproxy.cn,direct
|
|
|
|
# 下载依赖
|
|
RUN go mod download
|
|
|
|
# 复制源代码
|
|
COPY . .
|
|
|
|
# 设置时区
|
|
ENV TZ=Asia/Shanghai
|
|
|
|
# 安装 air 用于热重载
|
|
RUN go install github.com/air-verse/air@latest
|
|
|
|
# 暴露端口
|
|
EXPOSE 8080 9090
|
|
|
|
# 启动命令
|
|
CMD ["air", "-c", ".air.toml"] |