我已在桌面 Windows 10 操作系统中从 Ubuntu bash shell 安装了 nginx-extras ,需要为 ASP.NET Core 3.1 Blazor Web 程序集应用程序启动 docker 容器来提供静态网页服务。我的 nginx.conf:
events { }
http {
include mime.types;
types {
application/wasm wasm;
}
server {
listen 80;
index index.html;
location / {
root /var/www/web;
try_files $uri $uri/ /index.html =404;
}
}
}
Run Code Online (Sandbox Code Playgroud)
Dockerfile:
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build-env
WORKDIR /app
COPY . ./
RUN dotnet publish -c Release -o output
FROM nginx:alpine
WORKDIR /var/www/web
COPY --from=build-env /app/output/wwwroot .
COPY nginx.conf /etc/nginx/nginx.conf
EXPOSE 80 …Run Code Online (Sandbox Code Playgroud)