Skip to content

Commit af8a5cb

Browse files
committed
Fix Dockerfile paths to match updated folder structure
The `COPY` commands were updated to remove the "src/" prefix, as the project folders (e.g., `GymMgmt.Api`, `GymMgmt.Application`) are located at the root level. This ensures the correct files are copied during the build process. The `RUN dotnet restore` command was adjusted to reflect the new path for the `GymMgmt.Api.csproj` file, removing the "src/" prefix. The `WORKDIR` for the build and publish step was updated from `/src/src/GymMgmt.Api` to `/src/GymMgmt.Api`, eliminating the redundant "src/" directory. These changes resolve path mismatches, ensuring the Docker build process runs reliably.
1 parent 321485f commit af8a5cb

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

Dockerfile

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,20 @@
22
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
33
WORKDIR /src
44

5-
# Copy the csproj files first to cache the restore (optimization step)
6-
# Note: We maintain the folder structure 'src/ProjectName'
7-
COPY ["src/GymMgmt.Api/GymMgmt.Api.csproj", "src/GymMgmt.Api/"]
8-
COPY ["src/GymMgmt.Application/GymMgmt.Application.csproj", "src/GymMgmt.Application/"]
9-
COPY ["src/GymMgmt.Domain/GymMgmt.Domain.csproj", "src/GymMgmt.Domain/"]
10-
COPY ["src/GymMgmt.Infrastructure/GymMgmt.Infrastructure.csproj", "src/GymMgmt.Infrastructure/"]
5+
# FIX: Removed "src/" prefix because the folders are at the root
6+
COPY ["GymMgmt.Api/GymMgmt.Api.csproj", "GymMgmt.Api/"]
7+
COPY ["GymMgmt.Application/GymMgmt.Application.csproj", "GymMgmt.Application/"]
8+
COPY ["GymMgmt.Domain/GymMgmt.Domain.csproj", "GymMgmt.Domain/"]
9+
COPY ["GymMgmt.Infrastructure/GymMgmt.Infrastructure.csproj", "GymMgmt.Infrastructure/"]
1110

1211
# Restore dependencies
13-
RUN dotnet restore "src/GymMgmt.Api/GymMgmt.Api.csproj"
12+
RUN dotnet restore "GymMgmt.Api/GymMgmt.Api.csproj"
1413

1514
# Copy the rest of the source code
1615
COPY . .
1716

18-
# Build and Publish the API
19-
WORKDIR "/src/src/GymMgmt.Api"
17+
# Build and Publish
18+
WORKDIR "/src/GymMgmt.Api"
2019
RUN dotnet publish "GymMgmt.Api.csproj" -c Release -o /app/publish
2120

2221
# Stage 2: Run

0 commit comments

Comments
 (0)