FROM --platform=$BUILDPLATFORM crazymax/osxcross:14.5-debian AS osxcross FROM --platform=$BUILDPLATFORM tonistiigi/xx:1.5.0 AS xx ##################################################### ### Get TagLib FROM --platform=$BUILDPLATFORM public.ecr.aws/docker/library/alpine:3.20 AS taglib-build ARG TARGETPLATFORM ARG CROSS_TAGLIB_VERSION=2.0.2-1 ENV CROSS_TAGLIB_RELEASES_URL=https://github.com/navidrome/cross-taglib/releases/download/v${CROSS_TAGLIB_VERSION}/ RUN PLATFORM=$(echo ${TARGETPLATFORM} | tr '/' '-') \ FILE=taglib-${PLATFORM}.tar.gz && \ DOWNLOAD_URL=${CROSS_TAGLIB_RELEASES_URL}${FILE} && \ wget ${DOWNLOAD_URL}; \ mkdir /taglib && \ tar -xzf ${FILE} -C /taglib ##################################################### ### Build Navidrome UI FROM --platform=$BUILDPLATFORM public.ecr.aws/docker/library/node:lts-alpine3.20 AS ui WORKDIR /app # Install node dependencies COPY ui/package.json ui/package-lock.json ./ RUN npm ci # Build bundle COPY ui/ ./ RUN npm run build -- --outDir=/build FROM scratch AS ui-bundle COPY --from=ui /build /build ##################################################### ### Build Navidrome binary FROM --platform=$BUILDPLATFORM public.ecr.aws/docker/library/golang:1.23-bookworm AS base RUN apt-get update && apt-get install -y clang lld COPY --from=xx / / WORKDIR /workspace FROM --platform=$BUILDPLATFORM base AS build # Install build dependencies for the target platform ARG TARGETPLATFORM ARG GIT_SHA ARG GIT_TAG RUN xx-apt install -y binutils gcc g++ libc6-dev zlib1g-dev RUN xx-verify --setup RUN --mount=type=bind,source=. \ --mount=type=cache,target=/root/.cache \ --mount=type=cache,target=/go/pkg/mod \ go mod download RUN --mount=type=bind,source=. \ --mount=from=ui,source=/build,target=./ui/build,ro \ --mount=from=osxcross,src=/osxcross/SDK,target=/xx-sdk,ro \ --mount=type=cache,target=/root/.cache \ --mount=type=cache,target=/go/pkg/mod \ --mount=from=taglib-build,target=/taglib,src=/taglib,ro <