Files
pipu-music/services/api/Dockerfile
T
mrleo1nidandClaude Opus 5.5 9b50038bb4
ci / api / api (push) Successful in 27s
ci / docker / docker (образы собираются — их сервер собирает сам при обновлении) (push) Successful in 58s
feat(api): SHA-256 and Chromaprint fingerprints for the library (M5.5)
A background Fingerprinter runs after every scan and at startup, one file
at a time, filling media_files.sha256 and track_fingerprints (fpcalc raw,
first 120 s). Without fpcalc only SHA-256 is computed and files stay
queued for Chromaprint. Changing a file's content resets its prints.
Similarity() compares raw prints with a ±80-point alignment search; it is
the basis for duplicate detection in the upload queue.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 13:37:05 +03:00

31 lines
1.5 KiB
Docker
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# syntax=docker/dockerfile:1
# Сборка из корня репозитория:
# docker build -f services/api/Dockerfile --target api --build-arg VERSION=1.2.3 .
# docker build -f services/api/Dockerfile --target storage-agent --build-arg VERSION=1.2.3 .
FROM golang:1.24-alpine AS build
WORKDIR /src
COPY services/api/go.mod services/api/go.sum ./
RUN --mount=type=cache,target=/go/pkg/mod go mod download
COPY services/api/ ./
ARG VERSION=0.0.0-dev
ENV CGO_ENABLED=0
RUN --mount=type=cache,target=/go/pkg/mod --mount=type=cache,target=/root/.cache/go-build \
go build -trimpath -ldflags "-s -w -X pipu/api/internal/buildinfo.Version=${VERSION}" -o /out/api ./cmd/api && \
go build -trimpath -ldflags "-s -w -X pipu/api/internal/buildinfo.Version=${VERSION}" -o /out/storage-agent ./cmd/storage-agent
# api вызывает ffprobe (сканер), ffmpeg (транскодинг, M3) и fpcalc (отпечатки, M5.5) — нужен не distroless, а alpine.
FROM alpine:3.22 AS api
RUN apk add --no-cache ffmpeg chromaprint ca-certificates tzdata
COPY --from=build /out/api /usr/local/bin/api
USER 65532:65532
EXPOSE 8080
ENTRYPOINT ["/usr/local/bin/api"]
# Агенту нужны nfs-utils для mount -t nfs и root внутри контейнера (CAP_SYS_ADMIN задаётся в compose).
FROM alpine:3.22 AS storage-agent
RUN apk add --no-cache nfs-utils ca-certificates
COPY --from=build /out/storage-agent /usr/local/bin/storage-agent
EXPOSE 8090
ENTRYPOINT ["/usr/local/bin/storage-agent"]