# NowSeen Recorder for Raspberry Pi, Linux and NAS.
# Built on the device itself (docker compose up -d), so it always matches that device:
# Intel/AMD or ARM (Raspberry Pi 4/5, ARM NAS). Also works with older Docker versions (e.g. Synology).

FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
WORKDIR /src
COPY NowSeenRecorder/NowSeenRecorder.csproj NowSeenRecorder/
RUN dotnet restore NowSeenRecorder/NowSeenRecorder.csproj
COPY NowSeenRecorder/ NowSeenRecorder/
RUN dotnet publish NowSeenRecorder/NowSeenRecorder.csproj -c Release --no-restore -o /app

FROM mcr.microsoft.com/dotnet/aspnet:10.0
# tzdata: file names use the local time of the TZ variable (e.g. Europe/Amsterdam).
RUN apt-get update && apt-get install -y --no-install-recommends tzdata && rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY --from=build /app .
ENV RECORDINGS_DIR=/recordings \
    DOTNET_gcServer=0
VOLUME /recordings
EXPOSE 8642
ENTRYPOINT ["dotnet", "NowSeenRecorder.dll"]
