Dockerfile
# Builder Image (needs CGO for libsql)
FROM golang:1.24-bookworm AS builder
WORKDIR /src
COPY go.mod go.sum ./
RUN go mod download
COPY pkg/ pkg/
COPY example/ example/
WORKDIR /src
RUN go build -o /bin/example ./example
# Runner Image
FROM debian:bookworm-slim
# Install Node.js for esbuild runtime bundling
RUN apt-get update && apt-get install -y curl && \
curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
apt-get install -y nodejs && \
apt-get clean && rm -rf /var/lib/apt/lists/*
ENV PORT=8080
ENV ENV=production
EXPOSE 8080
WORKDIR /app
# Copy binary
COPY --from=builder /bin/example /usr/local/bin/example
# Copy frontend source for runtime bundling
COPY example/index.ts index.ts
COPY example/components/ components/
COPY example/package.json package.json
RUN npm install
CMD ["example"]