muyu-apiserver/deploy/Dockerfile.system
Chever John 4144628cb6 build(deploy): replace pre-compiled arm64 binaries with multi-stage Go compilation for amd64
WHY: existing Dockerfiles copied pre-compiled arm64 binaries which cannot
run on the amd64 K3s cluster (exec format error). Also fixed port conflicts
when running muyu alongside iloom in docker-compose.

HOW:
- rewrite 3 Dockerfiles (system/inventory/gateway) to multi-stage builds
  using golang:1.24-alpine with CGO_ENABLED=0 GOARCH=amd64
- parameterize host ports in docker-compose to avoid conflicts (3306->13306,
  6379->16379, 8080->18080)
- fix inv_product unique key from product_name-only to composite
  (product_name, spec, color) to allow same-name products with different specs
- add X-Token to Authorization header middleware in gateway for
  iloom frontend compatibility

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-06-14 12:38:46 +08:00

16 lines
423 B
Docker

FROM golang:1.24-alpine AS builder
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/system/system.go
FROM alpine:3.20
RUN apk add --no-cache ca-certificates tzdata
WORKDIR /app
COPY --from=builder /server ./system
COPY deploy/etc/system.yaml etc/system.yaml
EXPOSE 9001
CMD ["./system", "-f", "etc/system.yaml"]