Removed deployment comments
This commit is contained in:
12
Dockerfile
12
Dockerfile
@@ -1,39 +1,27 @@
|
||||
# STAGE 1: Build
|
||||
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
|
||||
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/"]
|
||||
RUN dotnet restore "SampleApi/SampleApi.csproj"
|
||||
|
||||
# 2. Copy the rest of the code
|
||||
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" \
|
||||
-c Release \
|
||||
-o /app/publish \
|
||||
--no-restore \
|
||||
/p:UseAppHost=false
|
||||
|
||||
# STAGE 2: Runtime
|
||||
FROM mcr.microsoft.com/dotnet/aspnet:8.0
|
||||
WORKDIR /app
|
||||
|
||||
# expose ports
|
||||
ENV ASPNETCORE_HTTP_PORTS=8081
|
||||
EXPOSE 8081
|
||||
|
||||
# Copy the contents directly
|
||||
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
|
||||
|
||||
# Set the environment to listen on the port you mapped in Compose
|
||||
ENV ASPNETCORE_HTTP_PORTS=8081
|
||||
|
||||
ENTRYPOINT ["dotnet", "SampleApi.dll"]
|
||||
Reference in New Issue
Block a user