Add Dockerfile and NuGet config for containerization
This commit is contained in:
40
src/FrontOffice.BFF.WebApi/Dockerfile
Normal file
40
src/FrontOffice.BFF.WebApi/Dockerfile
Normal file
@@ -0,0 +1,40 @@
|
||||
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS base
|
||||
USER $APP_UID
|
||||
WORKDIR /app
|
||||
EXPOSE 8080
|
||||
EXPOSE 8081
|
||||
|
||||
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
|
||||
ARG BUILD_CONFIGURATION=Release
|
||||
WORKDIR /src
|
||||
COPY ["FrontOffice.BFF.WebApi/NuGet.config", "NuGet.config"]
|
||||
COPY ["FrontOffice.BFF.WebApi/FrontOffice.BFF.WebApi.csproj", "FrontOffice.BFF.WebApi/"]
|
||||
COPY ["Protobufs/FrontOffice.BFF.DiscountShop.Protobuf/FrontOffice.BFF.DiscountShop.Protobuf.csproj", "Protobufs/FrontOffice.BFF.DiscountShop.Protobuf/"]
|
||||
COPY ["FrontOffice.BFF.Application/FrontOffice.BFF.Application.csproj", "FrontOffice.BFF.Application/"]
|
||||
COPY ["FrontOffice.BFF.Domain/FrontOffice.BFF.Domain.csproj", "FrontOffice.BFF.Domain/"]
|
||||
COPY ["Protobufs/FrontOffice.BFF.UserOrder.Protobuf/FrontOffice.BFF.UserOrder.Protobuf.csproj", "Protobufs/FrontOffice.BFF.UserOrder.Protobuf/"]
|
||||
COPY ["Protobufs/FrontOffice.BFF.Category.Protobuf/FrontOffice.BFF.Category.Protobuf.csproj", "Protobufs/FrontOffice.BFF.Category.Protobuf/"]
|
||||
COPY ["FrontOffice.BFF.Infrastructure/FrontOffice.BFF.Infrastructure.csproj", "FrontOffice.BFF.Infrastructure/"]
|
||||
COPY ["Protobufs/FrontOffice.BFF.Products.Protobuf/FrontOffice.BFF.Products.Protobuf.csproj", "Protobufs/FrontOffice.BFF.Products.Protobuf/"]
|
||||
COPY ["Protobufs/FrontOffice.BFF.ShopingCart.Protobuf/FrontOffice.BFF.ShopingCart.Protobuf.csproj", "Protobufs/FrontOffice.BFF.ShopingCart.Protobuf/"]
|
||||
COPY ["Protobufs/FrontOffice.BFF.Transaction.Protobuf/FrontOffice.BFF.Transaction.Protobuf.csproj", "Protobufs/FrontOffice.BFF.Transaction.Protobuf/"]
|
||||
COPY ["Protobufs/FrontOffice.BFF.UserWallet.Protobuf/FrontOffice.BFF.UserWallet.Protobuf.csproj", "Protobufs/FrontOffice.BFF.UserWallet.Protobuf/"]
|
||||
COPY ["Protobufs/FrontOffice.BFF.User.Protobuf/FrontOffice.BFF.User.Protobuf.csproj", "Protobufs/FrontOffice.BFF.User.Protobuf/"]
|
||||
COPY ["Protobufs/FrontOffice.BFF.UserAddress.Protobuf/FrontOffice.BFF.UserAddress.Protobuf.csproj", "Protobufs/FrontOffice.BFF.UserAddress.Protobuf/"]
|
||||
COPY ["Protobufs/FrontOffice.BFF.Package.Protobuf/FrontOffice.BFF.Package.Protobuf.csproj", "Protobufs/FrontOffice.BFF.Package.Protobuf/"]
|
||||
COPY ["Protobufs/FrontOffice.BFF.Commission.Protobuf/FrontOffice.BFF.Commission.Protobuf.csproj", "Protobufs/FrontOffice.BFF.Commission.Protobuf/"]
|
||||
COPY ["Protobufs/FrontOffice.BFF.ClubMembership.Protobuf/FrontOffice.BFF.ClubMembership.Protobuf.csproj", "Protobufs/FrontOffice.BFF.ClubMembership.Protobuf/"]
|
||||
COPY ["Protobufs/FrontOffice.BFF.NetworkMembership.Protobuf/FrontOffice.BFF.NetworkMembership.Protobuf.csproj", "Protobufs/FrontOffice.BFF.NetworkMembership.Protobuf/"]
|
||||
RUN dotnet restore "FrontOffice.BFF.WebApi/FrontOffice.BFF.WebApi.csproj" --configfile NuGet.config
|
||||
COPY . .
|
||||
WORKDIR "/src/FrontOffice.BFF.WebApi"
|
||||
RUN dotnet build "./FrontOffice.BFF.WebApi.csproj" -c $BUILD_CONFIGURATION -o /app/build
|
||||
|
||||
FROM build AS publish
|
||||
ARG BUILD_CONFIGURATION=Release
|
||||
RUN dotnet publish "./FrontOffice.BFF.WebApi.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
|
||||
|
||||
FROM base AS final
|
||||
WORKDIR /app
|
||||
COPY --from=publish /app/publish .
|
||||
ENTRYPOINT ["dotnet", "FrontOffice.BFF.WebApi.dll"]
|
||||
Reference in New Issue
Block a user