Open Closed

Openshift/Kubernetes Docker File #8588


User avatar
0
noveltydev created

Hi,

I want to test publish the application on openshift (kubernetes) via tfs pipeline. Can you share a sample dockerfile?


5 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Please share your project type.

    • UI Type: Angular / MVC / Blazor WASM / Blazor Server
    • Database System: EF Core (SQL Server, Oracle, MySQL, PostgreSQL, etc..) / MongoDB
    • Tiered (for MVC) or Auth Server Separated (for Angular): yes/no
  • User Avatar
    0
    noveltydev created

    UI Type: Blazor Server

    Database System: EF Core (SQL Server, Oracle, MySQL, PostgreSQL, etc..)

    Template: app

    Created ABP Studio Version: 0.9.19

    Current ABP Studio Version: 0.9.19

    Tiered: No

    Multi-Tenancy: Yes

    UI Framework: blazor-server

    Theme: leptonx

    Theme Style: system

    Run Install Libs: Yes

    Database Provider: ef

    Database Management System: sqlserver

    Separate Tenant Schema: No

    Create Initial Migration: Yes

    Run Db Migrator: Yes

    Mobile Framework: none

    Public Website: No

    Include Tests: Yes

    Kubernetes Configuration: Yes

    Distributed Event Bus: none

    Use Local References: No

    Optional Modules:

    GDPR

    FileManagement

    TextTemplateManagement

    LanguageManagement

    AuditLogging

    OpenIddictAdmin

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    The Dockerfile of blazor server is simple and same as asp net core default:

    FROM mcr.microsoft.com/dotnet/aspnet:9.0
    COPY bin/Release/net9.0/publish/ app/
    WORKDIR /app
    ENV ASPNETCORE_URLS=http://+:80
    ENTRYPOINT ["dotnet", "MyBlazorServerDemo.Blazor.dll"]
    
  • User Avatar
    0
    noveltydev created

    Hi,

    But I need to publish via tfs.

    I need to both build and publish with dockerfile.

    I have prepared a dockerfile as below, but I am trying to simplify it further.

    FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
    USER app
    WORKDIR /app
    
    USER root
    
    RUN adduser chatmanagementserverappuser --disabled-password --gecos "" && chown -R chatmanagementserverappuser:chatmanagementserverappuser /app
     
    USER chatmanagementserverappuser
    
    FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
    ARG BUILD_CONFIGURATION=Release
    WORKDIR /src
    ENV DOTNET_NUGET_SIGNATURE_VERIFICATION=false
    
    ENV NUGET_USERNAME=${NUGET_USERNAME}
    ENV NUGET_PASSWORD=${NUGET_PASSWORD}
    
    RUN dotnet nuget add source **/nuget.abp.io/index.json
    
    
    RUN apt update && apt -y install nodejs gnupg yarn npm
    
    COPY ["ChatManagementServer/ChatManagementServer.csproj", "ChatManagementServer/"]
    RUN dotnet restore "./ChatManagementServer/ChatManagementServer.csproj"
    COPY . .
    WORKDIR "/src/ChatManagementServer"
    
    RUN dotnet tool install -g Volo.Abp.Cli --version 8.3.2
    ENV PATH="${PATH}:/root/.dotnet/tools"
    RUN abp install-libs
    RUN abp add-package Volo.Abp.Account.Pro.Admin.Blazor.Server
    
    RUN dotnet build "./ChatManagementServer.csproj" -c $BUILD_CONFIGURATION -o /app/build
    FROM build AS publish
    ARG BUILD_CONFIGURATION=Release
    RUN dotnet publish "./ChatManagementServer.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
    
    FROM base AS final
    WORKDIR /app
    COPY --from=publish /app/publish .
    EXPOSE 5000
    ENV ASPNETCORE_URLS=http://+:5000
    ENTRYPOINT ["dotnet", "ChatManagementServer.dll"]
    
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Your Dockerfile seems to have no problem.

    I suggest you add a package to your project instead of in the pipeline.

    RUN abp add-package Volo.Abp.Account.Pro.Admin.Blazor.Server
    

    You can try it. If you have any problems, you can get feedback here.

    Thanks.

Made with ❤️ on ABP v9.2.0-preview. Updated on January 07, 2025, 07:14