Refactored dockerfile stage 2 ports exposure
This commit is contained in:
@@ -2,10 +2,6 @@
|
|||||||
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
|
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
|
|
||||||
# expose ports
|
|
||||||
ENV ASPNETCORE_HTTP_PORTS=8081
|
|
||||||
EXPOSE 8081
|
|
||||||
|
|
||||||
# 1. Copy the .sln and .csproj files first to restore dependencies
|
# 1. Copy the .sln and .csproj files first to restore dependencies
|
||||||
# This makes builds faster by caching the 'restore' layer
|
# This makes builds faster by caching the 'restore' layer
|
||||||
COPY ["SampleApi/SampleApi.csproj", "SampleApi/"]
|
COPY ["SampleApi/SampleApi.csproj", "SampleApi/"]
|
||||||
@@ -26,6 +22,10 @@ RUN dotnet publish "SampleApi/SampleApi.csproj" \
|
|||||||
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
|
||||||
|
EXPOSE 8081
|
||||||
|
|
||||||
# Copy the contents directly
|
# Copy the contents directly
|
||||||
COPY --from=build /app/publish .
|
COPY --from=build /app/publish .
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user