From 2622035dfa3566c55b2a5890071f89023c0a9bd2 Mon Sep 17 00:00:00 2001 From: xiabin Date: Wed, 15 Jan 2025 10:31:24 +0800 Subject: [PATCH] add:Dockerfile --- Dockerfile | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..3bc363e --- /dev/null +++ b/Dockerfile @@ -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"