Compare commits
2 Commits
b4ee875ac8
...
4e653fd91d
| Author | SHA1 | Date | |
|---|---|---|---|
| 4e653fd91d | |||
| 331829b8e3 |
17
Dockerfile
17
Dockerfile
@@ -1,14 +1,15 @@
|
|||||||
|
# STAGE 1: Build (Uses the heavy SDK)
|
||||||
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
|
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
|
||||||
WORKDIR .
|
WORKDIR /src
|
||||||
|
# Copy everything from the solution folder
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN ls .
|
# Publish specifically the project from its subfolder
|
||||||
RUN ls ./SampleApi
|
RUN [dotnet publish](https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-publish) "SampleApi/SampleApi.csproj" -c Release -o /app/publish
|
||||||
RUN dotnet publish "SampleApi/SampleApi.csproj" -c Release -o /app/publish
|
|
||||||
|
|
||||||
|
# STAGE 2: Runtime (Uses the slim ASP.NET image)
|
||||||
# Stage 2: Run the app using the Runtime
|
FROM mcr.microsoft.com/dotnet/aspnet:8.0
|
||||||
FROM ://mcr.microsoft.com
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
# Copy the compiled files from the 'build' stage to this stage
|
# Copy ONLY the compiled binaries from the build stage
|
||||||
COPY --from=build /app/publish .
|
COPY --from=build /app/publish .
|
||||||
|
# The DLL is now in the root of /app, so no folder prefix is needed
|
||||||
ENTRYPOINT ["dotnet", "SampleApi.dll"]
|
ENTRYPOINT ["dotnet", "SampleApi.dll"]
|
||||||
|
|||||||
Reference in New Issue
Block a user