Go server receiving Colota location data into SQLite, with a trip-segmentation API and embedded web frontend for browsing trips on a map.
26 lines
719 B
Docker
26 lines
719 B
Docker
FROM golang:1.22-alpine AS builder
|
|
|
|
# gcc is required for go-sqlite3 (CGO)
|
|
RUN apk add --no-cache gcc musl-dev
|
|
|
|
WORKDIR /app
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download
|
|
|
|
COPY . .
|
|
RUN CGO_ENABLED=1 GOOS=linux go build -o breadcrumb .
|
|
|
|
# ── Runtime image ─────────────────────────────────────────────────────────────
|
|
FROM alpine:3.19
|
|
RUN apk add --no-cache ca-certificates
|
|
|
|
WORKDIR /app
|
|
COPY --from=builder /app/breadcrumb .
|
|
|
|
# Data directory for the SQLite file (mount a volume here)
|
|
RUN mkdir -p /data
|
|
|
|
EXPOSE 8080
|
|
|
|
ENTRYPOINT ["./breadcrumb"]
|
|
CMD ["-port", "8080", "-db", "/data/locations.db"]
|