-
Notifications
You must be signed in to change notification settings - Fork 361
Expand file tree
/
Copy pathDockerfile.WindowsChromium
More file actions
50 lines (38 loc) · 1.97 KB
/
Dockerfile.WindowsChromium
File metadata and controls
50 lines (38 loc) · 1.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# -------------------------------------
# Build stage with .NET SDK
# -------------------------------------
FROM mcr.microsoft.com/dotnet/sdk:9.0-windowsservercore-ltsc2019 AS build
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop';"]
WORKDIR /src
COPY apps/pwabuilder-microsoft-store/ .
# Restore
RUN dotnet restore "PWABuilderWindowsChromium.csproj"
# # Build the project
RUN dotnet build "PWABuilderWindowsChromium.csproj" -c Release -o /app/build
RUN dotnet publish "PWABuilderWindowsChromium.csproj" -c Release -o /app/publish /p:UseAppHost=false
# -------------------------------------
# Final runtime image using full Windows image
# -------------------------------------
FROM mcr.microsoft.com/windows/server:ltsc2022 AS final
# App working directory
WORKDIR /app
SHELL ["cmd", "/S", "/C"]
# Set env variables (like aspnet image would)
ENV ASPNETCORE_URLS=http://+:5000
ENV ASPNETCORE_ENVIRONMENT=Production
# Expose the same ports as the ASP.NET Core base image
EXPOSE 5000
EXPOSE 443
# Install dotnet runtime using dotnet-install script
COPY apps/pwabuilder-microsoft-store/Resources/dotnet-install.ps1 .
RUN powershell -ExecutionPolicy Bypass -File ./dotnet-install.ps1 -Runtime aspnetcore -Version 9.0.0 -InstallDir C:\dotnet
RUN powershell $env:Path = 'C:\dotnet;' + $env:Path; [Environment]::SetEnvironmentVariable('PATH', $env:Path, [System.EnvironmentVariableTarget]::Machine)
# Install Windows SDK tools
RUN ["powershell.exe", "Set-ExecutionPolicy RemoteSigned -Scope CurrentUser"]
RUN powershell -Command "$ErrorActionPreference = 'Stop'; Invoke-WebRequest https://go.microsoft.com/fwlink/?linkid=2120843 -OutFile downloadsdk.exe -UseBasicParsing"
RUN powershell -Command "$ErrorActionPreference = 'Stop'; ./downloadsdk.exe /quiet /norestart /log log.txt"
RUN powershell -Command "$ErrorActionPreference = 'Stop'; Remove-Item downloadsdk.exe -Force
# Copy app from build stage
COPY --from=build /app/publish/ C:/app/
# Start the app
CMD dotnet "PWABuilderWindowsChromium.dll"