Refactor kafka to pure Go (franz-go), fix DBC stubs, update Dockerfile

This commit is contained in:
Chris Rai
2026-01-31 00:05:47 -05:00
parent fbb820d7b3
commit b5bec57dfa
776 changed files with 18945 additions and 2052 deletions

View File

@@ -1,27 +1,44 @@
ARG BASE_IMAGE=cloud_base_go
FROM ${BASE_IMAGE} as builder-go
# syntax=docker/dockerfile:1
WORKDIR /build/gateway_go
# Build stage
FROM golang:1.25-alpine AS builder
COPY ./gateway_go/go.mod ./gateway_go/go.sum ./
RUN go mod edit -replace fiskerinc.com/modules=../fiskerinc.com/modules \
&& go mod download
RUN apk add --no-cache git ca-certificates tzdata
COPY ./gateway_go ./
RUN go mod edit -replace fiskerinc.com/modules=../fiskerinc.com/modules \
&& go build -tags musl
WORKDIR /app
FROM alpine:3.17
# Copy go.work and module files for dependency caching
COPY go.work ./
COPY pkg/go.mod pkg/go.sum ./pkg/
COPY pkg/can-go/go.mod pkg/can-go/go.sum ./pkg/can-go/
COPY services/gateway/go.mod services/gateway/go.sum ./services/gateway/
RUN apk add --no-cache librdkafka --repository=https://dl-cdn.alpinelinux.org/alpine/edge/community \
&& apk add --no-cache ca-certificates
# Download dependencies (cached layer)
RUN --mount=type=cache,target=/go/pkg/mod \
go mod download -x
COPY ./modules_go/logger/log_config .
ENV LOG_CONFIG=log_config
# Copy source
COPY pkg/ ./pkg/
COPY services/gateway/ ./services/gateway/
COPY ./gateway_go/docs ./docs
COPY --from=builder-go /build/gateway_go/gateway .
# Build static binary
WORKDIR /app/services/gateway
RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
go build -ldflags="-s -w" -trimpath -o /gateway .
EXPOSE 8077
# Runtime stage - distroless for minimal attack surface
FROM gcr.io/distroless/static-debian12:nonroot
CMD ./gateway
COPY --from=builder /gateway /gateway
COPY --from=builder /app/services/gateway/docs /docs
COPY --from=builder /app/pkg/logger/log_config /log_config
COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo
ENV LOG_CONFIG=/log_config
ENV TZ=UTC
EXPOSE 8077 11011
ENTRYPOINT ["/gateway"]