Skip to content

Build with 2 projects #1

Description

@lolik20

How i can build container with 2 projects?

FROM mcr.microsoft.com/dotnet/core/aspnet:6.0-alpine AS base
WORKDIR /app

FROM mcr.microsoft.com/dotnet/core/sdk:6.0-alpine AS build
WORKDIR /src
COPY ["RentServiceApp.csproj", "./"]
COPY ["RentServiceCommon.csproj", "./"]

RUN dotnet restore "./RentServiceApp.csproj"
COPY . .
WORKDIR "/src/."
RUN dotnet build "RentServiceApp.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "RentServiceApp.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENV ASPNETCORE_URLS http://*:5000
ENTRYPOINT ["dotnet", "RentServiceApp.csproj"]
Building api
Step 1/17 : FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
 ---> e3f3ae957ae9
Step 2/17 : WORKDIR /app
 ---> Using cache
 ---> e075be1c0883

Step 3/17 : FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
 ---> 1f349786b71f
Step 4/17 : WORKDIR /src
 ---> Using cache
 ---> 8c4e004fccc2
Step 5/17 : COPY ["RentServiceApp.csproj", "./"]
 ---> Using cache
 ---> e44973d1a797
Step 6/17 : COPY ["RentServiceCommon.csproj", "./"]
ERROR: Service 'api' failed to build: COPY failed: file not found in build context or excluded by .dockerignore: stat RentServiceCommon.csproj: file does not exist

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions