File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ** /.vs
2+ ** /.git
3+
4+ ** /bin
5+ ** /obj
6+ ** /.vscode
7+ ** /TestResults
8+
9+ ** /appsettings.json
10+ ** /appsettings.Development.json
11+ ** /appsettings. * .json
12+
13+ .env
14+ .env. *
15+ .env.example
16+
17+ * .user
18+ * .suo
19+ * .userosscache
20+ * .sln.docstates
21+ .gitattributes
22+
23+ Dockerfile
24+ README.md
25+ LICENSE
Original file line number Diff line number Diff line change 1+ # use ASP.NET Core 9.0 runtime image (alpine) as base
2+ FROM mcr.microsoft.com/dotnet/aspnet:9.0-alpine AS base
3+ WORKDIR /artifacts
4+ EXPOSE 8080
5+
6+ # use SDK image (Alpine) for build
7+ FROM mcr.microsoft.com/dotnet/sdk:9.0-alpine AS build
8+ WORKDIR /workdir
9+
10+ ARG BUILD_CONFIGURATION=Release
11+ ARG SOLUTION=HttpsRichardy.Federation.Proxy
12+
13+ # copy only csproj and sln to restore as early as possible
14+ COPY ["Source/${SOLUTION}.WebApi/${SOLUTION}.WebApi.csproj" , "${SOLUTION}.WebApi/" ]
15+ COPY ["${SOLUTION}.sln" , "./" ]
16+
17+ # restore dependencies
18+ RUN dotnet restore "${SOLUTION}.WebApi/${SOLUTION}.WebApi.csproj"
19+
20+ # copy the rest of the source code
21+ COPY Source/ ./Source/
22+
23+ WORKDIR "/workdir/Source/${SOLUTION}.WebApi"
24+
25+ # build in Release mode
26+ RUN dotnet build "${SOLUTION}.WebApi.csproj" -c $BUILD_CONFIGURATION -o /artifacts/build
27+
28+ # publish the project for production
29+ RUN dotnet publish "${SOLUTION}.WebApi.csproj" -c $BUILD_CONFIGURATION -o /artifacts/publish /p:UseAppHost=false
30+
31+ # final image to run the app
32+ FROM base AS final
33+ WORKDIR /artifacts
34+
35+ ENV ASPNETCORE_URLS=http://+:8080
36+ ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=true
37+ ENV DOTNET_RUNNING_IN_CONTAINER=true
38+
39+ # copy published files from the build stage
40+ COPY --from=build /artifacts/publish .
41+
42+ ENTRYPOINT ["dotnet" , "HttpsRichardy.Federation.Proxy.WebApi.dll" ]
You can’t perform that action at this time.
0 commit comments