Refactored dockerfile
This commit is contained in:
20
Dockerfile
20
Dockerfile
@@ -1,14 +1,12 @@
|
|||||||
#FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
|
# Stage 1: Build the app using the SDK
|
||||||
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS base
|
FROM ://mcr.microsoft.com AS build
|
||||||
|
WORKDIR /src
|
||||||
|
COPY . .
|
||||||
|
RUN dotnet publish "SampleApi/SampleApi.csproj" -c Release -o /app/publish
|
||||||
|
|
||||||
USER app
|
# Stage 2: Run the app using the Runtime
|
||||||
WORKDIR /app
|
FROM ://mcr.microsoft.com
|
||||||
|
|
||||||
EXPOSE 8080
|
|
||||||
EXPOSE 8081
|
|
||||||
|
|
||||||
COPY . /app
|
|
||||||
|
|
||||||
FROM base AS final
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
# Copy the compiled files from the 'build' stage to this stage
|
||||||
|
COPY --from=build /app/publish .
|
||||||
ENTRYPOINT ["dotnet", "SampleApi.dll"]
|
ENTRYPOINT ["dotnet", "SampleApi.dll"]
|
||||||
Reference in New Issue
Block a user