OP#176 edit Dockerfile RUN step
This commit is contained in:
12
Dockerfile
12
Dockerfile
@@ -4,22 +4,20 @@ FROM golang:1.22-alpine AS builder
|
|||||||
RUN apk add --no-cache git make gcc musl-dev
|
RUN apk add --no-cache git make gcc musl-dev
|
||||||
|
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
|
|
||||||
# Copy your local source (you already have it)
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
# fix go mod
|
# Fix missing go.sum entries
|
||||||
RUN go mod tidy
|
RUN go mod tidy
|
||||||
|
|
||||||
# Build the binary
|
# Build (default target = all)
|
||||||
RUN make
|
RUN make
|
||||||
|
|
||||||
# Verify it was built
|
# Verify binary exists and is executable — no --version check
|
||||||
RUN ls -la postgresql-prometheus-adapter && \
|
RUN ls -la postgresql-prometheus-adapter && \
|
||||||
./postgresql-prometheus-adapter --version
|
./postgresql-prometheus-adapter --help > /dev/null
|
||||||
|
|
||||||
|
|
||||||
# ───── Stage 2: Tiny, secure, non-root runtime ─────
|
# ───── Stage 2: Tiny runtime ─────
|
||||||
FROM gcr.io/distroless/static-debian12
|
FROM gcr.io/distroless/static-debian12
|
||||||
|
|
||||||
COPY --from=builder /src/postgresql-prometheus-adapter /usr/local/bin/postgresql-prometheus-adapter
|
COPY --from=builder /src/postgresql-prometheus-adapter /usr/local/bin/postgresql-prometheus-adapter
|
||||||
|
|||||||
Reference in New Issue
Block a user