This commit is contained in:
+22
@@ -0,0 +1,22 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
|
||||
FROM golang:1.22-bookworm AS build
|
||||
WORKDIR /src
|
||||
COPY go.mod ./
|
||||
COPY cmd/ ./cmd/
|
||||
COPY internal/ ./internal/
|
||||
RUN go mod tidy && go mod download
|
||||
RUN CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags="-s -w" -o /out/gateway ./cmd/gateway
|
||||
|
||||
# Alpine: non-root + wget for HEALTHCHECK (distroless has no shell/wget).
|
||||
FROM alpine:3.19
|
||||
RUN apk add --no-cache ca-certificates wget \
|
||||
&& addgroup -S gateway -g 65532 \
|
||||
&& adduser -S -u 65532 -G gateway gateway
|
||||
COPY --from=build /out/gateway /gateway
|
||||
USER gateway:gateway
|
||||
EXPOSE 8080
|
||||
ENV CONFIG_PATH=/etc/telemt-gateway/config.yaml
|
||||
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
||||
CMD wget -q -O- http://127.0.0.1:8080/health >/dev/null || exit 1
|
||||
ENTRYPOINT ["/gateway"]
|
||||
Reference in New Issue
Block a user