mirror of
https://ids-dev.idsbuybuybuy.com/ids-ecommerce/ids-svc-product.git
synced 2026-11-29 16:57:41 +08:00
34 lines
896 B
Docker
34 lines
896 B
Docker
# Build from the parent directory that contains both ids-svc-product/ and ids-proto/:
|
|
# docker build -f ids-svc-product/Dockerfile -t ids-svc-product:local .
|
|
#
|
|
# go.mod replace points at ../ids-proto, so both trees must be present in the context.
|
|
|
|
FROM golang:1.26.4-alpine AS builder
|
|
|
|
RUN apk add --no-cache ca-certificates git
|
|
|
|
WORKDIR /src
|
|
|
|
COPY ids-proto /src/ids-proto
|
|
COPY ids-svc-product/go.mod ids-svc-product/go.sum /src/ids-svc-product/
|
|
|
|
WORKDIR /src/ids-svc-product
|
|
RUN go mod download
|
|
|
|
COPY ids-svc-product/ /src/ids-svc-product/
|
|
|
|
RUN CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags="-s -w" -o /out/ids-svc-product ./cmd
|
|
|
|
FROM alpine:3.21
|
|
|
|
RUN apk add --no-cache ca-certificates tzdata \
|
|
&& adduser -D -H -u 10001 appuser
|
|
|
|
COPY --from=builder /out/ids-svc-product /usr/local/bin/ids-svc-product
|
|
|
|
USER appuser
|
|
|
|
EXPOSE 50052 9102
|
|
|
|
ENTRYPOINT ["/usr/local/bin/ids-svc-product"]
|