diff --git a/src/.dockerignore b/src/.dockerignore new file mode 100644 index 0000000..38bece4 --- /dev/null +++ b/src/.dockerignore @@ -0,0 +1,25 @@ +**/.dockerignore +**/.env +**/.git +**/.gitignore +**/.project +**/.settings +**/.toolstarget +**/.vs +**/.vscode +**/.idea +**/*.*proj.user +**/*.dbmdl +**/*.jfm +**/azds.yaml +**/bin +**/charts +**/docker-compose* +**/Dockerfile* +**/node_modules +**/npm-debug.log +**/obj +**/secrets.dev.yaml +**/values.dev.yaml +LICENSE +README.md \ No newline at end of file diff --git a/src/BackOffice.BFF.WebApi/BackOffice.BFF.WebApi.csproj b/src/BackOffice.BFF.WebApi/BackOffice.BFF.WebApi.csproj index 82255c7..02a3b72 100644 --- a/src/BackOffice.BFF.WebApi/BackOffice.BFF.WebApi.csproj +++ b/src/BackOffice.BFF.WebApi/BackOffice.BFF.WebApi.csproj @@ -44,4 +44,9 @@ + + + .dockerignore + + diff --git a/src/BackOffice.BFF.WebApi/Dockerfile b/src/BackOffice.BFF.WebApi/Dockerfile index f7dc3fb..8ceeb51 100644 --- a/src/BackOffice.BFF.WebApi/Dockerfile +++ b/src/BackOffice.BFF.WebApi/Dockerfile @@ -1,54 +1,43 @@ 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 main projects COPY ["BackOffice.BFF.WebApi/BackOffice.BFF.WebApi.csproj", "BackOffice.BFF.WebApi/"] -COPY ["BackOffice.BFF.WebApi/NuGet.config", "BackOffice.BFF.WebApi/"] -COPY ["BackOffice.BFF.Application/BackOffice.BFF.Application.csproj", "BackOffice.BFF.Application/"] -COPY ["BackOffice.BFF.Infrastructure/BackOffice.BFF.Infrastructure.csproj", "BackOffice.BFF.Infrastructure/"] -COPY ["BackOffice.BFF.Domain/BackOffice.BFF.Domain.csproj", "BackOffice.BFF.Domain/"] - -# Copy all Protobuf projects -COPY ["Protobufs/BackOffice.BFF.Category.Protobuf/BackOffice.BFF.Category.Protobuf.csproj", "Protobufs/BackOffice.BFF.Category.Protobuf/"] -COPY ["Protobufs/BackOffice.BFF.ClubMembership.Protobuf/BackOffice.BFF.ClubMembership.Protobuf.csproj", "Protobufs/BackOffice.BFF.ClubMembership.Protobuf/"] COPY ["Protobufs/BackOffice.BFF.Commission.Protobuf/BackOffice.BFF.Commission.Protobuf.csproj", "Protobufs/BackOffice.BFF.Commission.Protobuf/"] COPY ["Protobufs/BackOffice.BFF.Common.Protobuf/BackOffice.BFF.Common.Protobuf.csproj", "Protobufs/BackOffice.BFF.Common.Protobuf/"] -COPY ["Protobufs/BackOffice.BFF.Configuration.Protobuf/BackOffice.BFF.Configuration.Protobuf.csproj", "Protobufs/BackOffice.BFF.Configuration.Protobuf/"] -COPY ["Protobufs/BackOffice.BFF.DiscountCategory.Protobuf/BackOffice.BFF.DiscountCategory.Protobuf.csproj", "Protobufs/BackOffice.BFF.DiscountCategory.Protobuf/"] -COPY ["Protobufs/BackOffice.BFF.DiscountOrder.Protobuf/BackOffice.BFF.DiscountOrder.Protobuf.csproj", "Protobufs/BackOffice.BFF.DiscountOrder.Protobuf/"] -COPY ["Protobufs/BackOffice.BFF.DiscountProduct.Protobuf/BackOffice.BFF.DiscountProduct.Protobuf.csproj", "Protobufs/BackOffice.BFF.DiscountProduct.Protobuf/"] -COPY ["Protobufs/BackOffice.BFF.DiscountShoppingCart.Protobuf/BackOffice.BFF.DiscountShoppingCart.Protobuf.csproj", "Protobufs/BackOffice.BFF.DiscountShoppingCart.Protobuf/"] -COPY ["Protobufs/BackOffice.BFF.Health.Protobuf/BackOffice.BFF.Health.Protobuf.csproj", "Protobufs/BackOffice.BFF.Health.Protobuf/"] -COPY ["Protobufs/BackOffice.BFF.ManualPayment.Protobuf/BackOffice.BFF.ManualPayment.Protobuf.csproj", "Protobufs/BackOffice.BFF.ManualPayment.Protobuf/"] -COPY ["Protobufs/BackOffice.BFF.NetworkMembership.Protobuf/BackOffice.BFF.NetworkMembership.Protobuf.csproj", "Protobufs/BackOffice.BFF.NetworkMembership.Protobuf/"] -COPY ["Protobufs/BackOffice.BFF.Otp.Protobuf/BackOffice.BFF.Otp.Protobuf.csproj", "Protobufs/BackOffice.BFF.Otp.Protobuf/"] +COPY ["BackOffice.BFF.Application/BackOffice.BFF.Application.csproj", "BackOffice.BFF.Application/"] +COPY ["Protobufs/BackOffice.BFF.UserOrder.Protobuf/BackOffice.BFF.UserOrder.Protobuf.csproj", "Protobufs/BackOffice.BFF.UserOrder.Protobuf/"] +COPY ["BackOffice.BFF.Domain/BackOffice.BFF.Domain.csproj", "BackOffice.BFF.Domain/"] COPY ["Protobufs/BackOffice.BFF.Package.Protobuf/BackOffice.BFF.Package.Protobuf.csproj", "Protobufs/BackOffice.BFF.Package.Protobuf/"] -COPY ["Protobufs/BackOffice.BFF.ProductTag.Protobuf/BackOffice.BFF.ProductTag.Protobuf.csproj", "Protobufs/BackOffice.BFF.ProductTag.Protobuf/"] -COPY ["Protobufs/BackOffice.BFF.Products.Protobuf/BackOffice.BFF.Products.Protobuf.csproj", "Protobufs/BackOffice.BFF.Products.Protobuf/"] +COPY ["Protobufs/BackOffice.BFF.NetworkMembership.Protobuf/BackOffice.BFF.NetworkMembership.Protobuf.csproj", "Protobufs/BackOffice.BFF.NetworkMembership.Protobuf/"] +COPY ["Protobufs/BackOffice.BFF.ClubMembership.Protobuf/BackOffice.BFF.ClubMembership.Protobuf.csproj", "Protobufs/BackOffice.BFF.ClubMembership.Protobuf/"] COPY ["Protobufs/BackOffice.BFF.PublicMessage.Protobuf/BackOffice.BFF.PublicMessage.Protobuf.csproj", "Protobufs/BackOffice.BFF.PublicMessage.Protobuf/"] -COPY ["Protobufs/BackOffice.BFF.Role.Protobuf/BackOffice.BFF.Role.Protobuf.csproj", "Protobufs/BackOffice.BFF.Role.Protobuf/"] -COPY ["Protobufs/BackOffice.BFF.Tag.Protobuf/BackOffice.BFF.Tag.Protobuf.csproj", "Protobufs/BackOffice.BFF.Tag.Protobuf/"] +COPY ["Protobufs/BackOffice.BFF.Health.Protobuf/BackOffice.BFF.Health.Protobuf.csproj", "Protobufs/BackOffice.BFF.Health.Protobuf/"] +COPY ["Protobufs/BackOffice.BFF.Configuration.Protobuf/BackOffice.BFF.Configuration.Protobuf.csproj", "Protobufs/BackOffice.BFF.Configuration.Protobuf/"] +COPY ["BackOffice.BFF.Infrastructure/BackOffice.BFF.Infrastructure.csproj", "BackOffice.BFF.Infrastructure/"] +COPY ["Protobufs/BackOffice.BFF.Otp.Protobuf/BackOffice.BFF.Otp.Protobuf.csproj", "Protobufs/BackOffice.BFF.Otp.Protobuf/"] COPY ["Protobufs/BackOffice.BFF.User.Protobuf/BackOffice.BFF.User.Protobuf.csproj", "Protobufs/BackOffice.BFF.User.Protobuf/"] COPY ["Protobufs/BackOffice.BFF.UserAddress.Protobuf/BackOffice.BFF.UserAddress.Protobuf.csproj", "Protobufs/BackOffice.BFF.UserAddress.Protobuf/"] -COPY ["Protobufs/BackOffice.BFF.UserOrder.Protobuf/BackOffice.BFF.UserOrder.Protobuf.csproj", "Protobufs/BackOffice.BFF.UserOrder.Protobuf/"] +COPY ["Protobufs/BackOffice.BFF.Products.Protobuf/BackOffice.BFF.Products.Protobuf.csproj", "Protobufs/BackOffice.BFF.Products.Protobuf/"] +COPY ["Protobufs/BackOffice.BFF.Role.Protobuf/BackOffice.BFF.Role.Protobuf.csproj", "Protobufs/BackOffice.BFF.Role.Protobuf/"] COPY ["Protobufs/BackOffice.BFF.UserRole.Protobuf/BackOffice.BFF.UserRole.Protobuf.csproj", "Protobufs/BackOffice.BFF.UserRole.Protobuf/"] - -RUN dotnet restore "BackOffice.BFF.WebApi/BackOffice.BFF.WebApi.csproj" --configfile "BackOffice.BFF.WebApi/NuGet.config" - +COPY ["Protobufs/BackOffice.BFF.Category.Protobuf/BackOffice.BFF.Category.Protobuf.csproj", "Protobufs/BackOffice.BFF.Category.Protobuf/"] +COPY ["Protobufs/BackOffice.BFF.ManualPayment.Protobuf/BackOffice.BFF.ManualPayment.Protobuf.csproj", "Protobufs/BackOffice.BFF.ManualPayment.Protobuf/"] +RUN dotnet restore "BackOffice.BFF.WebApi/BackOffice.BFF.WebApi.csproj" COPY . . WORKDIR "/src/BackOffice.BFF.WebApi" -RUN dotnet build "BackOffice.BFF.WebApi.csproj" -c Release -o /app/build +RUN dotnet build "./BackOffice.BFF.WebApi.csproj" -c $BUILD_CONFIGURATION -o /app/build FROM build AS publish -RUN dotnet publish "BackOffice.BFF.WebApi.csproj" -c Release -o /app/publish /p:UseAppHost=false +ARG BUILD_CONFIGURATION=Release +RUN dotnet publish "./BackOffice.BFF.WebApi.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false FROM base AS final WORKDIR /app COPY --from=publish /app/publish . - -ENV ASPNETCORE_URLS=http://+:8080 ENTRYPOINT ["dotnet", "BackOffice.BFF.WebApi.dll"]