Containerize the telemetry ingest service and reorganize source layout. Added misc/data/Dockerfile with a multi-stage build (golang:1.23-alpine -> alpine:3.23) to produce /app/telemetry-ingest, run as a non-root user, expose :8080, and provide default env vars for configuration (LISTEN_ADDR, MAX_BODY_BYTES, RATE_LIMIT_RPM, RATE_BURST, RATE_KEY_MODE, ENABLE_REQUEST_LOGGING, UPSTREAM_TIMEOUT_MS). Renamed misc/ingest.go to misc/data/service.go to reflect the new directory structure.
22 lines
538 B
Docker
22 lines
538 B
Docker
# build stage
|
|
FROM golang:1.23-alpine AS build
|
|
WORKDIR /src
|
|
COPY . .
|
|
RUN go build -trimpath -ldflags "-s -w" -o /out/telemetry-ingest ./main.go
|
|
|
|
# runtime stage
|
|
FROM alpine:3.23
|
|
RUN adduser -D -H -s /sbin/nologin app
|
|
USER app
|
|
WORKDIR /app
|
|
COPY --from=build /out/telemetry-ingest /app/telemetry-ingest
|
|
EXPOSE 8080
|
|
ENV LISTEN_ADDR=":8080" \
|
|
MAX_BODY_BYTES="1024" \
|
|
RATE_LIMIT_RPM="60" \
|
|
RATE_BURST="20" \
|
|
RATE_KEY_MODE="ip" \
|
|
ENABLE_REQUEST_LOGGING="false" \
|
|
UPSTREAM_TIMEOUT_MS="4000"
|
|
CMD ["/app/telemetry-ingest"]
|