2026-07-04 02:29:54 +00:00
|
|
|
ARG BASE_REGISTRY=harbor-in-k3s.cheverjohn.me/library
|
|
|
|
|
FROM ${BASE_REGISTRY}/golang:1.24-alpine AS builder
|
|
|
|
|
ENV GOPROXY=https://goproxy.cn,direct
|
|
|
|
|
RUN sed -i "s|dl-cdn.alpinelinux.org|mirrors.aliyun.com|g" /etc/apk/repositories
|
|
|
|
|
RUN apk add --no-cache git
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
COPY go.mod go.sum ./
|
|
|
|
|
RUN go mod download
|
|
|
|
|
COPY . .
|
|
|
|
|
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o /server ./rpc/purchase/purchase.go
|
|
|
|
|
|
|
|
|
|
FROM ${BASE_REGISTRY}/alpine:3.20
|
|
|
|
|
RUN sed -i "s|dl-cdn.alpinelinux.org|mirrors.aliyun.com|g" /etc/apk/repositories
|
2026-06-17 23:16:28 +08:00
|
|
|
RUN apk add --no-cache ca-certificates tzdata gettext
|
2026-06-15 09:20:56 +08:00
|
|
|
WORKDIR /app
|
2026-07-04 02:29:54 +00:00
|
|
|
COPY --from=builder /server ./purchase
|
2026-06-15 09:20:56 +08:00
|
|
|
COPY deploy/etc/purchase.yaml etc/purchase.yaml
|
2026-06-17 23:16:28 +08:00
|
|
|
COPY deploy/entrypoint.sh /entrypoint.sh
|
2026-06-15 09:20:56 +08:00
|
|
|
EXPOSE 9003
|
2026-06-17 23:16:28 +08:00
|
|
|
ENTRYPOINT ["/entrypoint.sh"]
|
2026-06-15 09:20:56 +08:00
|
|
|
CMD ["./purchase", "-f", "etc/purchase.yaml"]
|