Docker Image bauen und veröffentlichen / docker (push) Successful in 23m3s
Alpine lacks shared-mime-info, so file extensions with no built-in Go mime type (ODF, OOXML, epub, ics, ...) fall back to content sniffing and are served as "application/zip", breaking Collabora/DAVx5 on Android. Switch to debian:bookworm-slim and install shared-mime-info. Also install wget for the /healthz healthcheck instead of curl.
42 lines
1.2 KiB
Docker
42 lines
1.2 KiB
Docker
# ---- Build stage ----
|
|
FROM golang:1.25-alpine AS builder
|
|
|
|
WORKDIR /src
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download
|
|
|
|
COPY . .
|
|
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o /bin/davserver ./cmd/server
|
|
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o /bin/nidusctl ./tools/nidusctl
|
|
|
|
# ---- Runtime stage ----
|
|
FROM debian:bookworm-slim
|
|
|
|
# shared-mime-info: the OS MIME database (/usr/share/mime/globs2) that Go's
|
|
# mime.TypeByExtension consults. Without it, file extensions with no built-in
|
|
# Go type (ODF/.ods, OOXML/.docx, ebook/.epub, calendar/.ics, ...) fall back
|
|
# to content sniffing and are served as "application/zip", which breaks
|
|
# Collabora/DAVx5 on Android. wget: used by the /healthz healthcheck.
|
|
RUN apt-get update \
|
|
&& apt-get install -y --no-install-recommends \
|
|
ca-certificates tzdata wget shared-mime-info \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
WORKDIR /app
|
|
|
|
COPY --from=builder /bin/davserver /usr/local/bin/davserver
|
|
COPY --from=builder /bin/nidusctl /usr/local/bin/nidusctl
|
|
|
|
# Default data location
|
|
VOLUME ["/app/data"]
|
|
|
|
# environment variables (override as needed)
|
|
ENV NIDUS_DATA_DIR=/app/data
|
|
ENV NIDUS_HOST=0.0.0.0
|
|
ENV NIDUS_PORT=8080
|
|
ENV NIDUS_LOG_LEVEL=warn
|
|
ENV NIDUS_LOG_FORMAT=text
|
|
|
|
EXPOSE 8080
|
|
|
|
ENTRYPOINT ["davserver"]
|