Files
media/Dockerfile.bak
T
2026-06-26 09:07:38 +08:00

32 lines
692 B
Docker

# 阶段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"]