44 lines
1.0 KiB
Docker
44 lines
1.0 KiB
Docker
# ---- build stage ----
|
|
FROM golang:1.25-alpine AS build
|
|
WORKDIR /src
|
|
|
|
# Git CA certs (for go modules / HTTPS)
|
|
RUN apk add --no-cache ca-certificates
|
|
|
|
# Copy mod files first for better caching
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download
|
|
|
|
# Copy the rest of the source
|
|
COPY . .
|
|
|
|
ARG BUILD_TIME=""
|
|
ARG GIT_COMMIT="unknown"
|
|
ARG VERSION="dev"
|
|
|
|
# Build a static-ish binary (alpine musl)
|
|
RUN BUILD_TIME="${BUILD_TIME:-$(date -u +%Y-%m-%dT%H:%M:%SZ)}" && \
|
|
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
|
|
go build -trimpath \
|
|
-ldflags="-s -w -X main.buildTime=${BUILD_TIME} -X main.gitCommit=${GIT_COMMIT} -X main.version=${VERSION}" \
|
|
-o /out/ingestd ./cmd/ingestd
|
|
|
|
# ---- runtime stage ----
|
|
FROM alpine:3.22
|
|
WORKDIR /app
|
|
|
|
RUN apk add --no-cache ca-certificates && \
|
|
adduser -D -H -u 10001 appuser
|
|
|
|
# Copy binary + schema file used at startup
|
|
COPY --from=build /out/ingestd /app/ingestd
|
|
|
|
USER appuser
|
|
|
|
# Web UI
|
|
EXPOSE 8080
|
|
|
|
# default config path inside container
|
|
ENTRYPOINT ["/app/ingestd"]
|
|
CMD ["-config", "/app/config.yaml"]
|