feat(raster): IO abstraction with godal implementation; cgo Dockerfile

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
2026-09-05 13:14:48 +05:00
parent 5ca6d9e662
commit 37d4f3519b
7 changed files with 345 additions and 6 deletions

View File

@@ -1,5 +1,8 @@
# Build context is the repo root: docker build -f build/package/Dockerfile .
FROM golang:1.26.1-alpine AS builder
FROM golang:1.26-alpine AS builder
# godal (GDAL bindings) needs cgo, a C toolchain and the GDAL headers.
RUN apk add --no-cache gdal-dev gcc musl-dev pkgconfig
WORKDIR /src
@@ -7,13 +10,13 @@ COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -trimpath -o /out/gis ./cmd/gis
RUN CGO_ENABLED=1 GOOS=linux go build -trimpath -o /out/gis ./cmd/gis
FROM alpine:3.20
FROM alpine:3.22
# gdal-tools provides gdal_translate / gdalinfo for raster COG conversion and
# ogr2ogr for extracting vector feature geometry (worker).
RUN apk add --no-cache ca-certificates tzdata gdal-tools \
# gdal: shared library for godal (raster math in the worker).
# gdal-tools: gdal_translate / gdalinfo (COG conversion) and ogr2ogr.
RUN apk add --no-cache ca-certificates tzdata gdal gdal-tools \
&& adduser -D -u 10001 app
WORKDIR /app