license-server/Dockerfile

29 lines
472 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.

FROM golang:1.22 AS builder
WORKDIR /app
# 拷贝 mod 文件go.sum 可能还不存在)
COPY go.mod ./
# 自动生成 go.sum等价于开发时的 go mod tidy
RUN go mod tidy
# 再复制所有源代码
COPY . .
# 构建二进制
RUN go build -o license-server main.go
# 最小运行时镜像
FROM alpine:latest
RUN apk add --no-cache ca-certificates sqlite
WORKDIR /root/
COPY --from=builder /app/license-server .
EXPOSE 13579
CMD ["./license-server"]