-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
38 lines (27 loc) · 1.13 KB
/
Dockerfile
File metadata and controls
38 lines (27 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# use ASP.NET Core 9.0 runtime image (alpine) as base
FROM mcr.microsoft.com/dotnet/aspnet:9.0-alpine AS base
WORKDIR /app
EXPOSE 8080
# use SDK image (Alpine) for build
FROM mcr.microsoft.com/dotnet/sdk:9.0-alpine AS build
WORKDIR /src
# copy only csproj and sln to restore as early as possible
COPY ["Source/Vinder.Federation.WebApi/Vinder.Federation.WebApi.csproj", "Vinder.Federation.WebApi/"]
COPY ["Vinder.Federation.sln", "./"]
# restore dependencies
RUN dotnet restore "Vinder.Federation.WebApi/Vinder.Federation.WebApi.csproj"
# copy the rest of the source code
COPY Source/ ./Source/
WORKDIR "/src/Source/Vinder.Federation.WebApi"
# build in Release mode
RUN dotnet build "Vinder.Federation.WebApi.csproj" -c Release -o /app/build
# publish the project for production
RUN dotnet publish "Vinder.Federation.WebApi.csproj" -c Release -o /app/publish /p:UseAppHost=false
# final image to run the app
FROM base AS final
WORKDIR /app
ENV ASPNETCORE_URLS=http://+:8080
ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=true
# copy published files from the build stage
COPY --from=build /app/publish .
ENTRYPOINT ["dotnet", "Vinder.Federation.WebApi.dll"]