a2bea8601a
Phase 1 of the in-app update flow — server side. Endpoints serve the bundled Android APK + sidecar version file from /app/client/. Returns 404 gracefully when files aren't present, so dev environments and pre-CI-wiring images degrade cleanly to "no update available." - internal/api/client_assets.go: handleClientVersion + handleClientAPK. Both unauthenticated (matches /healthz) so install flow doesn't depend on a live session. APK served with proper application/vnd.android.package-archive Content-Type + http.ServeContent so Range requests work for resumable downloads on flaky networks. - Path resolves to /app/client/ by default; MINSTREL_CLIENT_APK_DIR env var overrides for dev. - Dockerfile creates /app/client/ + commented COPY hooks for the CI sequencing phase. - Tests cover all four states: missing apk, apk-but-no-version, both present (200 with correct shape), apk stream (200 with correct Content-Type + body bytes). Phases 2 (Flutter client provider + banner + install intent + Android manifest changes) and 3 (CI sequencing to bake the APK into the image) land in follow-up commits. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
53 lines
1.9 KiB
Docker
53 lines
1.9 KiB
Docker
# syntax=docker/dockerfile:1.6
|
|
|
|
FROM node:22-bookworm-slim AS web
|
|
WORKDIR /web
|
|
COPY web/package.json web/package-lock.json ./
|
|
RUN npm ci
|
|
COPY web/ ./
|
|
RUN npm run build
|
|
|
|
FROM golang:1.23-bookworm AS builder
|
|
WORKDIR /src
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download
|
|
COPY . .
|
|
# Overwrite the committed placeholder with the freshly-built SPA assets.
|
|
COPY --from=web /web/build ./web/build
|
|
ENV CGO_ENABLED=0
|
|
RUN go build -trimpath -ldflags="-s -w" -o /out/minstrel ./cmd/minstrel
|
|
|
|
FROM debian:bookworm-slim
|
|
RUN apt-get update \
|
|
&& apt-get install -y --no-install-recommends ca-certificates ffmpeg \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
RUN groupadd --system --gid 1000 minstrel \
|
|
&& useradd --system --uid 1000 --gid minstrel --shell /usr/sbin/nologin minstrel
|
|
|
|
COPY --from=builder /out/minstrel /usr/local/bin/minstrel
|
|
COPY config.example.yaml /etc/smartmusic/config.yaml
|
|
|
|
# Pre-create the data directory owned by the runtime user. Cached artifacts
|
|
# (playlist cover collages, artist art, album-cover fallbacks) all land here.
|
|
# A non-writable path at this location silently breaks every downstream
|
|
# cache, so we create + chown it once at image build. Operators mount a
|
|
# named volume on top to persist across container recreates.
|
|
RUN mkdir -p /app/data /app/client && chown -R minstrel:minstrel /app
|
|
WORKDIR /app
|
|
|
|
# In-app update channel (#397): bundled Android APK + sidecar version
|
|
# file. CI populates these on tag releases via a build context COPY;
|
|
# leaving the COPY commented during scaffold means the endpoints return
|
|
# 404 until the CI sequencing lands. Operators can also drop these in
|
|
# at runtime via a volume mount on /app/client.
|
|
#
|
|
# COPY minstrel.apk /app/client/minstrel.apk
|
|
# COPY minstrel.apk.version /app/client/minstrel.apk.version
|
|
|
|
USER minstrel
|
|
EXPOSE 4533
|
|
ENV MINSTREL_STORAGE_DATA_DIR=/app/data
|
|
ENTRYPOINT ["/usr/local/bin/minstrel"]
|
|
CMD ["--config", "/etc/smartmusic/config.yaml"]
|