File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -71,11 +71,33 @@ RUN dotnet build "PWABuilder.csproj" -c Release -o /app/build
7171FROM build AS publish
7272RUN dotnet publish "PWABuilder.csproj" -c Release -o /app/publish /p:UseAppHost=false
7373
74- # Final stage
75- FROM base AS final
74+ # Final stage/image
75+ FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS final
76+
77+ # Install Chrome dependencies and create non-root user
78+ RUN apt-get update \
79+ && apt-get install -y wget gnupg \
80+ && wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
81+ && sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \
82+ && apt-get update \
83+ && wget -O /tmp/chrome.deb https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_130.0.6723.116-1_amd64.deb \
84+ && apt-get install -y /tmp/chrome.deb \
85+ && rm /tmp/chrome.deb \
86+ && apt-get purge -y --auto-remove wget gnupg \
87+ && rm -rf /var/lib/apt/lists/* \
88+ && groupadd -r pwabuilder && useradd -r -g pwabuilder -d /app -s /bin/bash pwabuilder \
89+ && chown -R pwabuilder:pwabuilder /app
90+
7691WORKDIR /app
92+ EXPOSE 8080
93+
94+ # Copy from publish stage
7795COPY --from=publish /app/publish .
7896
97+ # Explicitly copy environment-specific appsettings files
98+ COPY --from=build /src/appsettings.Production.json ./appsettings.Production.json
99+ COPY --from=build /src/appsettings.Staging.json ./appsettings.Staging.json
100+
79101# Enable detailed logging for debugging
80102ENV ASPNETCORE_DETAILEDERRORS=true
81103ENV Logging__LogLevel__Default=Information
Original file line number Diff line number Diff line change 5050 <ItemGroup >
5151 <None Include =" Resources\IOS\**" CopyToOutputDirectory =" PreserveNewest" />
5252 </ItemGroup >
53+
54+ <!-- Explicitly include environment-specific appsettings files in publish -->
55+ <ItemGroup >
56+ <Content Include =" appsettings.Production.json" >
57+ <CopyToPublishDirectory >PreserveNewest</CopyToPublishDirectory >
58+ </Content >
59+ <Content Include =" appsettings.Staging.json" >
60+ <CopyToPublishDirectory >PreserveNewest</CopyToPublishDirectory >
61+ </Content >
62+ </ItemGroup >
5363</Project >
You can’t perform that action at this time.
0 commit comments