0

Docker file cant find csproj while deploy

my directory

exception while deploy

My docker compose yml file in main directory

version: "3.7"

services:
  reverseproxy:
    image: fff
    build:
      context: ./Nginx
      dockerfile: Dockerfile
    ports:
      - "80:80"
      - "443:443"
    restart: always

  api:
    image: bbb
    depends_on:
      - reverseproxy
    build:
      context: ./RentServiceApp
      dockerfile: Dockerfile
    expose:
      - "5000"
    restart: always

My docker file in RentServiceApp

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

FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY ["RentServiceApp.csproj", "./"]
COPY ["../RentService.Common/RentService.Common.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.dll"]

RentServiceApp is main project

RentServiceCommon is library project

example taked from https://github.com/tonysneed/Demo.AspNetCore-Nginx-Ssl

maks gang
  • 1
  • 1
  • Please add code and data as text ([using code formatting](/editing-help#code)), not images. Images: A) don't allow us to copy-&-paste the code/errors/data for testing; B) don't permit searching based on the code/error/data contents; and [many more reasons](//meta.stackoverflow.com/a/285557). Images should only be used, in addition to text in code format, if having the image adds something significant that is not conveyed by just the text code/error/data. – gunr2171 Jul 06 '22 at 19:20
  • Where is the dockerfile in relationship to the RentService.Common folder? – gunr2171 Jul 06 '22 at 19:25
  • i haven't dockerfile in Common project. Because this is library – maks gang Jul 06 '22 at 19:27
  • Does this answer your question? [How to include files outside of Docker's build context?](https://stackoverflow.com/questions/27068596/how-to-include-files-outside-of-dockers-build-context) – gunr2171 Jul 06 '22 at 19:30
  • I can’t add dockerfile to my library. I think I need to move up my docker file – maks gang Jul 06 '22 at 19:33

0 Answers0