File tree Expand file tree Collapse file tree 2 files changed +29
-15
lines changed Expand file tree Collapse file tree 2 files changed +29
-15
lines changed Original file line number Diff line number Diff line change 1- FROM golang:1.21-alpine AS builder
1+ FROM golang:1.23 AS builder
22
33WORKDIR /app
44
5- # Install build dependencies
6- RUN apk add --no-cache gcc musl-dev
5+ # Install build dependencies including librdkafka
6+ RUN apt-get update && apt-get install -y \
7+ gcc \
8+ librdkafka-dev \
9+ pkg-config \
10+ && rm -rf /var/lib/apt/lists/*
711
812# Copy go mod files
913COPY go.mod go.sum ./
@@ -12,20 +16,25 @@ RUN go mod download
1216# Copy source code
1317COPY . .
1418
15- # Build the application
16- RUN CGO_ENABLED=0 GOOS=linux go build -o main .
19+ # Build the application with CGO enabled
20+ RUN CGO_ENABLED=1 GOOS=linux go build -o main .
1721
1822# Final stage
19- FROM alpine:latest
23+ FROM debian:bookworm-slim
2024
2125WORKDIR /app
2226
27+ # Install runtime dependency
28+ RUN apt-get update && apt-get install -y \
29+ librdkafka1 \
30+ && rm -rf /var/lib/apt/lists/*
31+
2332# Copy the binary from builder
2433COPY --from=builder /app/main .
2534COPY views/ views/
2635
2736# Run as non-root user
28- RUN adduser -D appuser
37+ RUN useradd -r appuser
2938USER appuser
3039
3140EXPOSE 3000
Original file line number Diff line number Diff line change @@ -17,11 +17,16 @@ services:
1717 - ./secrets/tesla-ssl/tls.crt:/secrets/tesla-ssl/tls.crt:ro
1818 - ./secrets/tesla-ssl/tls.key:/secrets/tesla-ssl/tls.key:ro
1919 - ./secrets/fleet-api/private-key.pem:/secret/private-key.pem:ro
20- # fleet-telemetry-consumer:
21- # build:
22- # context: .
23- # dockerfile: Dockerfile
24- # ports:
25- # - "3000:3000"
26- # depends_on:
27- # - tesla-http-proxy
20+ fleet-telemetry-consumer :
21+ build :
22+ context : .
23+ dockerfile : Dockerfile
24+ ports :
25+ - " 3000:3000"
26+ depends_on :
27+ - tesla-http-proxy
28+ volumes :
29+ - ./secrets/fleet-telemetry-ssl/:/app/secrets/fleet-telemetry-ssl:ro
30+ - ./secrets/pg/:/app/secrets/pg:ro
31+ - ./secrets/fleet-api/:/app/secrets/fleet-api:ro
32+ - ./secrets/tesla-ssl/:/app/secrets/tesla-ssl:ro
You can’t perform that action at this time.
0 commit comments