Fix telemetry-server build: proper Docker context, Go 1.25, local module (#7247)
* fix(telemetry): make server build reproducible with proper context and deps * Update telemetry/server/go.mod: go version Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * telemetry/server: optimize Dockerfile (organize cache deps, copy proto); run as non-root --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
83c1bfbacd
commit
59ceb5862b
@@ -1,18 +1,30 @@
|
||||
FROM golang:1.21-alpine AS builder
|
||||
FROM golang:1.25-alpine AS builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY go.mod go.sum ./
|
||||
COPY telemetry/server/go.mod telemetry/server/go.sum ./telemetry/server/
|
||||
COPY telemetry/proto/ ./telemetry/proto/
|
||||
|
||||
WORKDIR /app/telemetry/server
|
||||
RUN go mod download
|
||||
|
||||
WORKDIR /app
|
||||
COPY . .
|
||||
|
||||
WORKDIR /app/telemetry/server
|
||||
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -ldflags '-extldflags "-static"' -o telemetry-server .
|
||||
|
||||
FROM alpine:latest
|
||||
RUN apk --no-cache add ca-certificates
|
||||
WORKDIR /root/
|
||||
RUN apk --no-cache add ca-certificates \
|
||||
&& addgroup -S appgroup \
|
||||
&& adduser -S appuser -G appgroup
|
||||
|
||||
COPY --from=builder /app/telemetry-server .
|
||||
WORKDIR /home/appuser/
|
||||
COPY --from=builder /app/telemetry/server/telemetry-server .
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
CMD ["./telemetry-server"]
|
||||
USER appuser
|
||||
|
||||
CMD ["./telemetry-server"]
|
||||
Reference in New Issue
Block a user