From 87b4dbee77a7dc84f3916af8f38f8863c18e2cc7 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Wed, 28 Jan 2026 03:14:59 -0800 Subject: fix: Switch Dockerfile to Debian for go-libsql glibc compatibility go-libsql includes pre-compiled Rust libraries built against glibc. Alpine uses musl libc which is incompatible (undefined mmap64, fstat64). --- Dockerfile | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/Dockerfile b/Dockerfile index 50f7003..23bdd76 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,10 @@ -# Build stage -FROM golang:1.24-alpine AS builder +# Build stage - using Debian for glibc compatibility with go-libsql +FROM golang:1.24-bookworm AS builder WORKDIR /app # Install build dependencies -RUN apk add --no-cache git +RUN apt-get update && apt-get install -y --no-install-recommends git ca-certificates && rm -rf /var/lib/apt/lists/* # Copy go mod files COPY go.mod go.sum ./ @@ -14,23 +14,23 @@ RUN go mod download COPY . . # Build the binary with version info -RUN CGO_ENABLED=0 GOOS=linux go build \ +RUN CGO_ENABLED=1 GOOS=linux go build \ -ldflags="-s -w \ -X main.version=$(git describe --tags --always --dirty 2>/dev/null || echo dev) \ -X main.commit=$(git rev-parse --short HEAD 2>/dev/null || echo none) \ -X main.date=$(date -u +%Y-%m-%dT%H:%M:%SZ)" \ -o kaze ./cmd/kaze -# Runtime stage -FROM alpine:3.19 +# Runtime stage - using Debian slim for glibc compatibility +FROM debian:bookworm-slim WORKDIR /app -# Install CA certificates for HTTPS requests -RUN apk add --no-cache ca-certificates tzdata +# Install CA certificates and timezone data +RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates tzdata wget && rm -rf /var/lib/apt/lists/* # Create non-root user -RUN adduser -D -u 1000 kaze +RUN useradd -r -u 1000 -m kaze # Create data directory before switching user RUN mkdir -p /app/data && chown -R kaze:kaze /app @@ -49,6 +49,5 @@ HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 \ CMD wget --no-verbose --tries=1 --spider http://localhost:8080/ || exit 1 # Run the application -# Config and database will be in /app/data volume mount ENTRYPOINT ["./kaze"] CMD ["--config", "/app/data/config.yaml"] -- cgit v1.2.3