-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.logbook
More file actions
59 lines (42 loc) · 1.46 KB
/
Dockerfile.logbook
File metadata and controls
59 lines (42 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# Multi-stage build for Windshift Logbook service
# Stage 1: Build Go binary
FROM golang:1.26.0-alpine AS builder
# Install build dependencies
RUN apk add --no-cache git
WORKDIR /build
# Copy go mod files and download dependencies
COPY go.mod go.sum ./
RUN --mount=type=cache,target=/go/pkg/mod \
go mod download
# Copy source code
COPY . .
# Build logbook binary (no CGO needed)
RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
CGO_ENABLED=0 \
go build -ldflags '-s -w' \
-o logbook ./cmd/logbook
# Create data directory
RUN mkdir -p /data/logbook && \
touch /data/.keep /data/logbook/.keep && \
chown -R 65534:65534 /data
# Stage 2: Runtime (needs system tools for text extraction)
FROM alpine:3.21
# Install runtime dependencies
RUN apk add --no-cache ca-certificates poppler-utils libstdc++
# Copy kreuzberg-cli for text extraction
COPY --from=ghcr.io/kreuzberg-dev/kreuzberg-cli:4.5.4 /usr/local/bin/kreuzberg /usr/local/bin/kreuzberg
# Pre-warm model cache (downloads OCR and layout detection models at build time)
RUN kreuzberg cache warm
# Copy binary
COPY --from=builder /build/logbook /logbook
# Copy data directory with correct ownership
COPY --from=builder --chown=65534:65534 /data /data
# Expose default port (internal only)
EXPOSE 8090
# Default environment variables
ENV LOGBOOK_PORT=8090
ENV LOGBOOK_STORAGE_PATH=/data/logbook
ENV LOG_LEVEL=info
USER 65534:65534
ENTRYPOINT ["/logbook"]