ARG DOTNET_VERSION=5.0

FROM mcr.microsoft.com/dotnet/sdk:${DOTNET_VERSION}-buster-slim

ARG SOURCE_DIR=/src
ARG ARTIFACT_DIR=/jellyfin

WORKDIR ${SOURCE_DIR}
COPY . .

ENV DOTNET_CLI_TELEMETRY_OPTOUT=1

# because of changes in docker and systemd we need to not build in parallel at the moment
# see https://success.docker.com/article/how-to-reserve-resource-temporarily-unavailable-errors-due-to-tasksmax-setting
RUN dotnet publish Jellyfin.Server --disable-parallel --configuration Release --output="${ARTIFACT_DIR}" --self-contained --runtime linux-arm "-p:DebugSymbols=false;DebugType=none"