2026-06-17 10:17:39 +08: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
|
2026-06-17 10:25:02 +08:00
|
|
|
RUN sed -i "s|dl-cdn.alpinelinux.org|mirrors.aliyun.com|g" /etc/apk/repositories
|
2026-06-14 12:38:46 +08:00
|
|
|
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/inventory/inventory.go
|
|
|
|
|
|
2026-06-17 10:17:39 +08:00
|
|
|
FROM ${BASE_REGISTRY}/alpine:3.20
|
2026-06-17 10:25:02 +08:00
|
|
|
RUN sed -i "s|dl-cdn.alpinelinux.org|mirrors.aliyun.com|g" /etc/apk/repositories
|
2026-02-28 15:29:16 +08:00
|
|
|
RUN apk add --no-cache ca-certificates tzdata
|
|
|
|
|
WORKDIR /app
|
2026-06-14 12:38:46 +08:00
|
|
|
COPY --from=builder /server ./inventory
|
2026-02-28 15:29:16 +08:00
|
|
|
COPY deploy/etc/inventory.yaml etc/inventory.yaml
|
|
|
|
|
EXPOSE 9002
|
|
|
|
|
CMD ["./inventory", "-f", "etc/inventory.yaml"]
|