Skip to content

YARP WithStaticFiles + WithDockerfile: missing docs on required /wwwroot path in Docker image #476

@maddymontaquila

Description

@maddymontaquila

Bug Description

When using AddYarp("frontend").WithStaticFiles().WithDockerfile("./frontend"), there is no documentation explaining that the YARP container expects static files at /wwwroot. Users must write a multi-stage Dockerfile that copies built assets to /wwwroot using the mcr.microsoft.com/dotnet/nightly/yarp base image, but this is not documented anywhere.

Current Behavior

A user creates a Dockerfile that builds frontend assets (e.g., Vite/React) but doesn't know where to place the output. The container starts successfully but returns 404 for all requests. The only clue is a log line: The WebRootPath was not found: /wwwroot. Static files may be unavailable.

Expected Behavior

The YARP integration docs should document:

  1. That WithStaticFiles() expects files at /wwwroot inside the container
  2. A complete example Dockerfile showing the required multi-stage build pattern, e.g.:
FROM node:22-slim AS build
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build

FROM mcr.microsoft.com/dotnet/nightly/yarp
COPY --from=build /app/dist /wwwroot
  1. That the Dockerfile must use the YARP base image (mcr.microsoft.com/dotnet/nightly/yarp) as its final stage so dotnet /app/yarp.dll can run

Page URL

The YARP hosting integration page (if it exists) or the general deployment docs.

Additional Context

  • Aspire version: 13.3.0-pr.14149.g4bc5e9bf (all packages)
  • .NET SDK: 10.0.100
  • OS: macOS (Darwin arm64)
  • Discovered during aspire deploy to Azure Container Apps

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions