Created
July 2, 2024 16:53
-
-
Save isaacrlevin/7553f9853e59e841db9e64e645daa97f to your computer and use it in GitHub Desktop.
.NET Container with Playwright Library Support
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM mcr.microsoft.com/dotnet/sdk:8.0-jammy AS build-env | |
WORKDIR /App | |
# Copy everything | |
COPY . ./ | |
# Restore as distinct layers | |
RUN dotnet restore | |
# Build and publish a release | |
RUN dotnet publish -c Release -o out | |
# Build runtime image | |
FROM mcr.microsoft.com/dotnet/aspnet:8.0-jammy | |
WORKDIR / | |
COPY ../install-pwsh.sh / | |
RUN chmod -R +x /install-pwsh.sh | |
RUN /install-pwsh.sh | |
WORKDIR /App | |
COPY --from=build-env /App/out . | |
RUN pwsh ./playwright.ps1 install-deps | |
RUN pwsh ./playwright.ps1 install | |
# Change this to your project dll | |
ENTRYPOINT ["dotnet", "BlazorProject.dll"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
################################### | |
# Prerequisites | |
# Update the list of packages | |
apt-get update | |
# Install pre-requisite packages. | |
apt-get install -y wget curl apt-transport-https software-properties-common | |
# Get the version of Ubuntu | |
source /etc/os-release | |
# Download the Microsoft repository keys | |
wget -q https://packages.microsoft.com/config/ubuntu/$VERSION_ID/packages-microsoft-prod.deb | |
# Register the Microsoft repository keys | |
dpkg -i packages-microsoft-prod.deb | |
# Delete the Microsoft repository keys file | |
rm packages-microsoft-prod.deb | |
# Update the list of packages after we added packages.microsoft.com | |
apt-get update | |
################################### | |
# Install PowerShell | |
apt-get install -y powershell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment