C#C
C#4y ago
Hulkstance

Dockerfile cannot find dependent project in the parent directory

 .
 +---src
 |   +---MarketData.Api
 |   +---MarketData.Messages
 |   +---MarketData.Subscriber
 |       +---Dockerfile
 +---MarketData.sln


# Stage 1 - Build
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS builder

WORKDIR /app/src

# Restore
COPY ./src/MarketData.Messages/MarketData.Messages.csproj ./MarketData.Messages/
COPY *.csproj .
RUN dotnet restore

# Build
COPY . .
RUN dotnet publish -c Release -o /app/publish --no-self-contained --no-restore

# Stage 2 - Publish
FROM mcr.microsoft.com/dotnet/aspnet:7.0
WORKDIR /app

RUN addgroup --system --gid 101 app \
    && adduser --system --ingroup app --uid 101 app


COPY --from=builder --chown=app:app /app/publish .

USER app
ENTRYPOINT ["./MarketData.Subscriber"]


The issue is within that statement: COPY ./src/MarketData.Messages/MarketData.Messages.csproj ./MarketData.Messages/.

failed to compute cache key: "/src/MarketData.Messages/MarketData.Messages.csproj" not found: not found
Was this page helpful?