first commit
This commit is contained in:
34
Dockerfile
Normal file
34
Dockerfile
Normal file
@@ -0,0 +1,34 @@
|
||||
# ---- 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 . .
|
||||
|
||||
# Build a static-ish binary (alpine musl)
|
||||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
|
||||
go build -trimpath -ldflags="-s -w" -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
|
||||
COPY internal/db/schema.sql /app/internal/db/schema.sql
|
||||
|
||||
USER appuser
|
||||
|
||||
# default config path inside container
|
||||
ENTRYPOINT ["/app/ingestd"]
|
||||
CMD ["-config", "/app/config.yaml"]
|
||||
Reference in New Issue
Block a user