2025-09-18 05:49:54 +01:00
|
|
|
FROM golang:1.25-alpine AS builder
|
2025-06-28 14:11:55 -07:00
|
|
|
|
|
|
|
WORKDIR /app
|
2025-09-18 05:49:54 +01:00
|
|
|
|
2025-06-28 14:11:55 -07:00
|
|
|
COPY go.mod go.sum ./
|
|
|
|
RUN go mod download
|
|
|
|
|
2025-09-18 05:49:54 +01:00
|
|
|
WORKDIR /app
|
2025-06-28 14:11:55 -07:00
|
|
|
COPY . .
|
2025-09-18 05:49:54 +01:00
|
|
|
|
|
|
|
WORKDIR /app/telemetry/server
|
2025-06-28 14:11:55 -07:00
|
|
|
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -ldflags '-extldflags "-static"' -o telemetry-server .
|
|
|
|
|
|
|
|
FROM alpine:latest
|
2025-09-18 05:49:54 +01:00
|
|
|
RUN apk --no-cache add ca-certificates \
|
|
|
|
&& addgroup -S appgroup \
|
|
|
|
&& adduser -S appuser -G appgroup
|
2025-06-28 14:11:55 -07:00
|
|
|
|
2025-09-18 05:49:54 +01:00
|
|
|
WORKDIR /home/appuser/
|
|
|
|
COPY --from=builder /app/telemetry/server/telemetry-server .
|
2025-06-28 14:11:55 -07:00
|
|
|
|
|
|
|
EXPOSE 8080
|
|
|
|
|
2025-09-18 05:49:54 +01:00
|
|
|
USER appuser
|
|
|
|
|
|
|
|
CMD ["./telemetry-server"]
|