Removed deployment comments

This commit is contained in:
2026-03-03 17:54:49 +02:00
parent ac224fd665
commit 8a11987b8e

View File

@@ -1,39 +1,27 @@
# STAGE 1: Build
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /src WORKDIR /src
# 1. Copy the .sln and .csproj files first to restore dependencies
# This makes builds faster by caching the 'restore' layer
COPY ["SampleApi/SampleApi.csproj", "SampleApi/"] COPY ["SampleApi/SampleApi.csproj", "SampleApi/"]
RUN dotnet restore "SampleApi/SampleApi.csproj" RUN dotnet restore "SampleApi/SampleApi.csproj"
# 2. Copy the rest of the code
COPY . . COPY . .
# 3. Publish to a FLAT directory
# We use -o /app/publish and ensure no extra subfolders are created
RUN dotnet publish "SampleApi/SampleApi.csproj" \ RUN dotnet publish "SampleApi/SampleApi.csproj" \
-c Release \ -c Release \
-o /app/publish \ -o /app/publish \
--no-restore \ --no-restore \
/p:UseAppHost=false /p:UseAppHost=false
# STAGE 2: Runtime
FROM mcr.microsoft.com/dotnet/aspnet:8.0 FROM mcr.microsoft.com/dotnet/aspnet:8.0
WORKDIR /app WORKDIR /app
# expose ports
ENV ASPNETCORE_HTTP_PORTS=8081 ENV ASPNETCORE_HTTP_PORTS=8081
EXPOSE 8081 EXPOSE 8081
# Copy the contents directly
COPY --from=build /app/publish . COPY --from=build /app/publish .
# DEBUG: This will print the contents of /app during the build.
# If SampleApi.dll isn't in this list, the build will stop here.
RUN ls -la /app RUN ls -la /app
# Set the environment to listen on the port you mapped in Compose
ENV ASPNETCORE_HTTP_PORTS=8081 ENV ASPNETCORE_HTTP_PORTS=8081
ENTRYPOINT ["dotnet", "SampleApi.dll"] ENTRYPOINT ["dotnet", "SampleApi.dll"]