-
Notifications
You must be signed in to change notification settings - Fork 222
Expand file tree
/
Copy pathDockerfile
More file actions
31 lines (25 loc) · 1.3 KB
/
Dockerfile
File metadata and controls
31 lines (25 loc) · 1.3 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
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY ["services/DevStore.Billing.API/DevStore.Billing.API.csproj", "services/DevStore.Billing.API/"]
COPY ["services/DevStore.Billing.DevsPay/DevStore.Billing.DevsPay.csproj", "services/DevStore.Billing.DevsPay/"]
COPY ["building-blocks/DevStore.WebAPI.Core/DevStore.WebAPI.Core.csproj", "building-blocks/DevStore.WebAPI.Core/"]
COPY ["building-blocks/DevStore.Core/DevStore.Core.csproj", "building-blocks/DevStore.Core/"]
COPY ["building-blocks/DevStore.MessageBus/DevStore.MessageBus.csproj", "building-blocks/DevStore.MessageBus/"]
RUN dotnet restore "services/DevStore.Billing.API/DevStore.Billing.API.csproj"
COPY . .
WORKDIR "services/DevStore.Billing.API"
RUN dotnet build "DevStore.Billing.API.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "DevStore.Billing.API.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
# Set a non-root user for running the application
RUN useradd -r -u 1001 appuser
USER appuser
ENTRYPOINT ["dotnet", "DevStore.Billing.API.dll"]