ARG DOTNET_SDK_IMAGE=mcr.microsoft.com/dotnet/sdk:8.0-bookworm-slim ARG DOTNET_RUNTIME_IMAGE=mcr.microsoft.com/dotnet/aspnet:8.0-bookworm-slim FROM ${DOTNET_SDK_IMAGE} AS build WORKDIR /src COPY ["LiveRecorder.sln", "./"] COPY ["src/LiveRecorder.Domain/LiveRecorder.Domain.csproj", "src/LiveRecorder.Domain/"] COPY ["src/LiveRecorder.Application/LiveRecorder.Application.csproj", "src/LiveRecorder.Application/"] COPY ["src/LiveRecorder.Infrastructure/LiveRecorder.Infrastructure.csproj", "src/LiveRecorder.Infrastructure/"] COPY ["src/LiveRecorder.WebApi/LiveRecorder.WebApi.csproj", "src/LiveRecorder.WebApi/"] RUN dotnet restore "src/LiveRecorder.WebApi/LiveRecorder.WebApi.csproj" COPY . . RUN dotnet publish "src/LiveRecorder.WebApi/LiveRecorder.WebApi.csproj" -c Release -o /app/publish /p:UseAppHost=false FROM ${DOTNET_RUNTIME_IMAGE} AS runtime RUN sed -i 's/deb.debian.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apt/sources.list.d/debian.sources RUN apt-get update -o Acquire::ForceIPv4=true \ && apt-get install -o Acquire::ForceIPv4=true -y --no-install-recommends ffmpeg nodejs ca-certificates curl jq \ && rm -rf /var/lib/apt/lists/* WORKDIR /app ENV ASPNETCORE_URLS=http://+:8080 ENV ASPNETCORE_ENVIRONMENT=Production ENV ConnectionStrings__DefaultConnection=Host=postgres;Port=5432;Database=live_recorder;Username=postgres;Password=postgres COPY --from=build /app/publish ./ RUN mkdir -p /app/data /app/records VOLUME ["/app/data", "/app/records"] EXPOSE 8080 ENTRYPOINT ["dotnet", "LiveRecorder.WebApi.dll"]