diff --git a/Dockerfile b/Dockerfile index 70237f0..10544a6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,20 +1,11 @@ # Use the latest ASP.NET Core runtime image -FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base +FROM mcr.microsoft.com/dotnet/runtime:8.0 AS base +USER $APP_UID WORKDIR /app -EXPOSE 80 -EXPOSE 443 # Use the latest .NET SDK for building the application FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build - -# Install Node.js -# Note: Consider using a specific version of Node.js for better stability and compatibility -RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - \ - && apt-get install -y \ - nodejs \ - && rm -rf /var/lib/apt/lists/* - -# Set the working directory +ARG BUILD_CONFIGURATION=Release WORKDIR /src # Copy the project file and restore dependencies @@ -28,11 +19,12 @@ COPY . . WORKDIR "/src/TrailerDownloader" # Build the project -RUN dotnet build "TrailerDownloader.csproj" -c Release -o /app/build +RUN dotnet build "TrailerDownloader.csproj" -c $BUILD_CONFIGURATION -o /app/build # Publish the project FROM build AS publish -RUN dotnet publish "TrailerDownloader.csproj" -c Release -o /app/publish --no-restore --no-build +ARG BUILD_CONFIGURATION=Release +RUN dotnet publish "TrailerDownloader.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false # Final stage FROM base AS final