add:Dockerfile

This commit is contained in:
xiabin 2025-01-15 10:31:24 +08:00
parent b7a8867716
commit 2622035dfa

26
Dockerfile Normal file
View File

@ -0,0 +1,26 @@
#编译阶段镜像
FROM golang:alpine AS builder
WORKDIR /app
COPY . .
RUN go env -w GOPRIVATE="gitea.youtukeji.com.cn"
RUN go env -w GOPROXY="https://goproxy.cn,direct"
RUN go mod tidy
RUN go build -o /app/ecpm cmd/main.go
#运行阶段镜像
FROM alpine AS runtime
WORKDIR /app
COPY --from=builder /app/ecpm /app/ecpm
ENV TZ=Asia/Shanghai
ENV APP_ENV=prod
ENV LOG_PATH=/app/data/logs/ecpm.log
ENTRYPOINT ["/app/ecpm"]
LABEL authors="xiabin"