Rfactored dockerfile to reuse pipeline publish output
This commit is contained in:
22
Dockerfile
22
Dockerfile
@@ -1,27 +1,9 @@
|
||||
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
|
||||
WORKDIR /src
|
||||
|
||||
COPY ["SampleApi/SampleApi.csproj", "SampleApi/"]
|
||||
RUN dotnet restore "SampleApi/SampleApi.csproj"
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN dotnet publish "SampleApi/SampleApi.csproj" \
|
||||
-c Release \
|
||||
-o /app/publish \
|
||||
--no-restore \
|
||||
/p:UseAppHost=false
|
||||
|
||||
FROM mcr.microsoft.com/dotnet/aspnet:8.0
|
||||
WORKDIR /app
|
||||
|
||||
COPY ./SampleApi/bin/Release/net8.0/publish/ .
|
||||
|
||||
ENV ASPNETCORE_HTTP_PORTS=8081
|
||||
EXPOSE 8081
|
||||
|
||||
COPY --from=build /app/publish .
|
||||
|
||||
RUN ls -la /app
|
||||
|
||||
ENV ASPNETCORE_HTTP_PORTS=8081
|
||||
|
||||
ENTRYPOINT ["dotnet", "SampleApi.dll"]
|
||||
Reference in New Issue
Block a user