diff --git a/Dockerfile.bak b/Dockerfile.bak new file mode 100644 index 0000000..2600889 --- /dev/null +++ b/Dockerfile.bak @@ -0,0 +1,31 @@ +# 阶段1: 构建 +FROM golang:alpine AS builder + +RUN apk add --no-cache git ca-certificates tzdata + +ENV TZ=Asia/Shanghai +RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone + +ENV GO111MODULE=on +ENV GOPROXY=https://goproxy.cn,direct +ENV CGO_ENABLED=0 +ENV GOTOOLCHAIN=auto +WORKDIR /build + +COPY . . + +RUN go mod download && go mod tidy + +RUN go build -ldflags="-s -w" -o main ./main.go + + +# 阶段2: 运行时(继承 media-deps 基础镜像) +FROM redfuture-media-deps:latest + +# 复制二进制和运行时必需的文件 +COPY --from=builder /build/main . +COPY --from=builder /build/config.yml . +COPY --from=builder /build/scripts ./scripts +EXPOSE 3010 + +CMD ["./main"]