Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

870
Views
Archivo Docker - Proyecto de omisión. porque no se encontró

Tengo 3 Proyectos en una solución.

[Solución] 'BuySellApi' (3 Proyectos)
  | 
  +-- [ComprarVenderApi]
  | |
  | +--- BuySellApi.csproj (Este proyecto contiene el archivo Docker)
  |
  +-- [ComprarVenderApi.Core]
  | |
  | +--- BuySellApi.Core.csproj
  |
  +-- [ComprarVenderApi.Datos]
       |
       +--- BuySellApi.Data.csproj

 1. BuySellApi.csproj -> API
 2. BuySellApi.Data/BuySellApi.Data.csproj -> Modelo
 3. BuySellApi.Core/BuySellApi.Core.csproj -> Acceso a datos

Estoy tratando de construir esto usando Docker especificando los siguientes comandos en Dockerfile

 FROM microsoft/dotnet:2.2-aspnetcore-runtime AS base WORKDIR /app EXPOSE 5000 ENV ASPNETCORE_URLS=http://+:5000 FROM microsoft/dotnet:2.2-sdk AS build WORKDIR /src COPY ["BuySellApi.csproj", "./"] COPY ["BuySellApi.Data/BuySellApi.Data.csproj", "./"] COPY ["BuySellApi.Core/BuySellApi.Core.csproj", "./"] RUN dotnet restore "./BuySellApi.csproj" COPY . . WORKDIR "/src/." RUN dotnet build "BuySellApi.csproj" -c Release -o /app FROM build AS publish RUN dotnet publish "BuySellApi.csproj" -c Release -o /app FROM base AS final WORKDIR /app COPY --from=publish /app . ENTRYPOINT ["dotnet", "BuySellApi.dll", "--server.urls", "http://0.0.0.0:5000"]

Después de ejecutar el siguiente comando

docker build -t cog/buysellapi.

Recibo el error de la siguiente manera:

 e:\Apps\trunk\BuySell\BuySellApi>docker build -t cog/buysellapi . Sending build context to Docker daemon 19.15MB Step 1/19 : FROM microsoft/dotnet:2.2-aspnetcore-runtime AS base ---> ce06b36fcba4 Step 2/19 : WORKDIR /app ---> Using cache ---> 184385dc16fb Step 3/19 : EXPOSE 5000 ---> Using cache ---> 0e0cdd17e04d Step 4/19 : ENV ASPNETCORE_URLS=http://+:5000 ---> Using cache ---> 54cee58d679f Step 5/19 : FROM microsoft/dotnet:2.2-sdk AS build ---> a4974ac66bfc Step 6/19 : WORKDIR /src ---> Using cache ---> 7f9a2990f973 Step 7/19 : COPY ["BuySellApi.csproj", "./"] ---> Using cache ---> d526083ece6d Step 8/19 : COPY ["BuySellApi.Data/BuySellApi.Data.csproj", "./"] COPY failed: stat /mnt/sda1/var/lib/docker/tmp/docker-builder475321395/BuySellApi.Data/BuySellApi.Data.csproj: no such file or directory

No está copiando datos y capas centrales . Cuando intento lo mismo para una solución con un solo proyecto, funciona bien.

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

Según su entrada, propongo la siguiente estructura de carpetas y Dockerfile.

 [Solution] 'BuySellApi' (3 Projects) | +-- Dockerfile | +-- [BuySellApi] | | | +--- BuySellApi.csproj | +-- [BuySellApi.Core] | | | +--- BuySellApi.Core.csproj | +-- [BuySellApi.Data] | +--- BuySellApi.Data.csproj

Dockerfile

 FROM microsoft/dotnet:2.2-aspnetcore-runtime AS base WORKDIR /app EXPOSE 5000 ENV ASPNETCORE_URLS=http://+:5000 FROM microsoft/dotnet:2.2-sdk AS build WORKDIR /src COPY . . RUN dotnet restore ". BuySellApi/BuySellApi.csproj" WORKDIR "/src/BuySellApi" RUN dotnet build "BuySellApi.csproj" -c Release -o /app FROM build AS publish WORKDIR "/src/BuySellApi" RUN dotnet publish "BuySellApi.csproj" -c Release -o /app FROM base AS final WORKDIR /app COPY --from=publish /app . ENTRYPOINT ["dotnet", "BuySellApi.dll", "--server.urls", "http://0.0.0.0:5000"]
over 4 years ago · Santiago Trujillo Report

0

En mi caso, no se encontró el archivo del proyecto porque estaba creando un contenedor de Linux y, por alguna razón, el nombre del archivo del proyecto y su ruta tenían mayúsculas y minúsculas diferentes a las del sistema de archivos.

over 4 years ago · Santiago Trujillo Report

0

Según lo sugerido por @Mihai

Moví mi Dockerfile directamente bajo el archivo de solución y le hice algunos cambios como se muestra a continuación:

 FROM microsoft/dotnet:2.2-aspnetcore-runtime AS base WORKDIR /app EXPOSE 5000 ENV ASPNETCORE_URLS=http://+:5000 FROM microsoft/dotnet:2.2-sdk AS build WORKDIR /src COPY ["BuySellApi/BuySellApi.csproj", "BuySellApi/"] COPY ["BuySellApi.Core/BuySellApi.Core.csproj", "BuySellApi.Core/"] COPY ["BuySellApi.Data/BuySellApi.Data.csproj", "BuySellApi.Data/"] RUN dotnet restore "BuySellApi/BuySellApi.csproj" COPY . . WORKDIR "/src/BuySellApi" RUN dotnet build "BuySellApi.csproj" -c Release -o /app FROM build AS publish RUN dotnet publish "BuySellApi.csproj" -c Release -o /app FROM base AS final WORKDIR /app COPY --from=publish /app . ENTRYPOINT ["dotnet", "BuySellApi.dll", "--server.urls", "http://0.0.0.0:5000"]
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!