31 lines
741 B
Docker
31 lines
741 B
Docker
# Build context is the repo root: docker build -f build/package/Dockerfile .
|
|
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
|
|
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download
|
|
|
|
COPY . .
|
|
RUN CGO_ENABLED=1 GOOS=linux go build -trimpath -o /out/gis ./cmd/gis
|
|
|
|
FROM alpine:3.22
|
|
|
|
# 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
|
|
COPY --from=builder /out/gis /usr/local/bin/gis
|
|
|
|
USER app
|
|
|
|
EXPOSE 8080
|
|
|
|
ENTRYPOINT ["gis"]
|
|
CMD ["serve"]
|