Files
proxy-platform/deployments/Dockerfile.scheduler
T

35 lines
637 B
Docker
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 调度中心 Dockerfile
FROM golang:1.21-alpine AS builder
WORKDIR /app
# 安装依赖
RUN apk add --no-cache git
# 复制 go.mod 和 go.sum
COPY go.mod go.sum ./
RUN go mod download
# 复制源代码
COPY . .
# 构建
RUN CGO_ENABLED=0 GOOS=linux go build -o /scheduler ./cmd/scheduler
# 运行镜像
FROM alpine:latest
WORKDIR /app
# 安装 ca-certificates(用于 HTTPS
RUN apk --no-cache add ca-certificates tzdata
# 从构建阶段复制二进制文件
COPY --from=builder /scheduler /app/scheduler
COPY --from=builder /app/configs /app/configs
# 暴露端口
EXPOSE 8080 1080
# 运行
ENTRYPOINT ["/app/scheduler"]