NeuCharFramework (NCF)
  • NCF - NeuCharFramework
  • Projects

    • Preparation
    • NcfPackageSources Source Guide
    • DynamicWebApiEngine
    • Deployment
    • MCP (Model Context Protocol) Module
    • Senparc.AI
  • Help

    • Online Resources
    • Q&A Community
    • QQ Group (147054579)
    • Senparc WeChat SDK
  • Gitee
  • GitHub
  • English
  • 简体中文
GitHub
  • NCF - NeuCharFramework
  • Projects

    • Preparation
    • NcfPackageSources Source Guide
    • DynamicWebApiEngine
    • Deployment
    • MCP (Model Context Protocol) Module
    • Senparc.AI
  • Help

    • Online Resources
    • Q&A Community
    • QQ Group (147054579)
    • Senparc WeChat SDK
  • Gitee
  • GitHub
  • English
  • 简体中文
GitHub
  • NCF Overview

    • NCF - NeuCharFramework
    • About NCF
    • Environment Requirements
    • Frontend and Backend Separation Mode
    • Introduction to Xncf Modules
  • Prepare Development

    • Get NCF Template Source Code
    • Using Visual Studio to Run NCF
    • Running NCF Using CLI
    • Installation
    • Admin Login
    • Admin Backend
    • appsettings.json Configuration
    • Module Management
    • Accessing Documentation
  • Configuration

    • Entry File
    • Database Settings
    • appsettings.json Configuration
    • Docker
    • Dapr
    • Configure Multi-Tenant
    • Redis Cache
  • Template-Based Development

    • NCF Modular Development Concept
    • XNCF Module Structure
    • XNCF Extension Contracts and Boundaries
    • Create the First Xncf Module
    • Current XNCF Template Structure
    • Implement Your Own Business Logic
    • Update Xncf Module
    • How to Call Between Modules
    • Publish Xncf Module to nuget.org
    • Update Base Library
    • Create a Minimal XNCF Module Manually
    • Embedding Static Resource Files into NCF
    • Publish Local Nuget Package
    • Advanced
  • Database

    • Database Settings
    • Multi-Database Support
    • Specify Database
    • Update database migration files for the Senparc.Service project (Migrations)
    • Multi-Database Principle
    • DatabasePlant
    • Tarmac Operation Database Migration and Update
  • Unit Testing

    • NCF Unit Test Introduction
    • Start Development
    • Advanced
    • Appendix
  • Q&A

    • NCF Terminology
    • NCF FAQ
  • Release

    • New Features
    • Upgrade Guide
    • Logs

Docker

Docker is an open-source application container engine that allows developers to package their applications and dependencies into a portable image, which can then be published to any popular Linux or Windows operating system machine, and can also achieve virtualization. Containers are completely sandboxed and have no interfaces with each other.

Runtime version

The current NCF development baseline is net10.0. Both sdk and aspnet Docker images must use the matching 10.0 major version. Check and update base images before copying a Dockerfile from an older branch.

Docker Configuration

version: '3.4'

services:
  #mysql:
  #  image: mysql:latest
  #  ports:
  #   - "3307:3306"
  #  restart: always
  #  environment:
  #    MYSQL_ROOT_PASSWORD: "123456"

  redis:
    image: redis:latest
    ports:
    - "5379:6379"

  installer:
    image: ${DOCKER_REGISTRY-}installer
    build:
      context: .
      dockerfile: Senparc.Xncf.Installer/Dockerfile
    #depends_on:
    #  - mysql

  installer-dapr:
    image: "daprio/daprd:latest"
    command: [ "./daprd", "-app-id", "installer", "-app-port", "80" ]
    network_mode: "service:installer"
    depends_on:
      - installer

  accounts:
    image: ${DOCKER_REGISTRY-}accounts
    build:
      context: .
      dockerfile: Senparc.Xncf.Accounts/Dockerfile

  accounts-dapr:
    image: "daprio/daprd:latest"
    command: [ "./daprd", "-app-id", "accounts", "-app-port", "80" ]
    network_mode: "service:accounts"
    depends_on:
      - accounts

  senparc-client:
    image: ${DOCKER_REGISTRY-}senparcweb
    build:
      context: .
      dockerfile: Senparc.Web/Dockerfile

  senparc-client-dapr:
    image: "daprio/daprd:latest"
    command: ["./daprd","-app-id","senparc-client","-app-port","80"]
    network_mode: "service:senparc-client"
    depends_on:
      - senparc-client

Running Docker on Windows

Click the icon to run

Click to view images

Adding Project to Docker Configuration

When Docker support is added, a Dockerfile will be generated in the project

#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.

# Use dotnet10.0 sdk for compilation
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS base
# Set working directory to app
WORKDIR /app
# Expose port 80
EXPOSE 80
# Expose port 443
EXPOSE 443

# Use dotnet10.0 sdk for compilation
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
# Compile the project to src
WORKDIR /src
# Copy Senparc.Web.csproj project to Senparc.Web directory
COPY ["Senparc.Web/Senparc.Web.csproj", "Senparc.Web/"]
# Execute dotnet restore command to restore packages
RUN dotnet restore "Senparc.Web/Senparc.Web.csproj"
# Copy all files
COPY . .
# Set working directory to /src/Senparc.Web
WORKDIR "/src/Senparc.Web"
# Execute dotnet build command, build Release environment to app/build directory
RUN dotnet build "Senparc.Web.csproj" -c Release -o /app/build

# Rename build to publish directory
FROM build AS publish
# Execute dotnet publish command, publish Release environment to app/publish directory
RUN dotnet publish "Senparc.Web.csproj" -c Release -o /app/publish

# Finally
FROM base AS final
# Set working directory to app
WORKDIR /app
# Copy files from publish directory to app/publish
COPY --from=publish /app/publish .
# Enter the project and execute dotnet Senparc.Web.dll
ENTRYPOINT ["dotnet", "Senparc.Web.dll"]

Docker

Docker is an open-source application container engine that allows developers to package their applications and dependencies into a portable image, which can then be published to any popular Linux or Windows operating system machine, and can also achieve virtualization. Containers are completely sandboxed and have no interfaces with each other.

Docker Configuration

version: '3.4'

services:
  #mysql:
  #  image: mysql:latest
  #  ports:
  #   - "3307:3306"
  #  restart: always
  #  environment:
  #    MYSQL_ROOT_PASSWORD: "123456"

  redis:
    image: redis:latest
    ports:
    - "5379:6379"

  installer:
    image: ${DOCKER_REGISTRY-}installer
    build:
      context: .
      dockerfile: Senparc.Xncf.Installer/Dockerfile
    #depends_on:
    #  - mysql

  installer-dapr:
    image: "daprio/daprd:latest"
    command: [ "./daprd", "-app-id", "installer", "-app-port", "80" ]
    network_mode: "service:installer"
    depends_on:
      - installer

  accounts:
    image: ${DOCKER_REGISTRY-}accounts
    build:
      context: .
      dockerfile: Senparc.Xncf.Accounts/Dockerfile

  accounts-dapr:
    image: "daprio/daprd:latest"
    command: [ "./daprd", "-app-id", "accounts", "-app-port", "80" ]
    network_mode: "service:accounts"
    depends_on:
      - accounts

  senparc-client:
    image: ${DOCKER_REGISTRY-}senparcweb
    build:
      context: .
      dockerfile: Senparc.Web/Dockerfile

  senparc-client-dapr:
    image: "daprio/daprd:latest"
    command: ["./daprd","-app-id","senparc-client","-app-port","80"]
    network_mode: "service:senparc-client"
    depends_on:
      - senparc-client

Running Docker on Windows

Click the icon to run

Click to view images

Adding Project to Docker Configuration

When Docker support is added, a Dockerfile will be generated in the project

#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.

# Use dotnet10.0 sdk for compilation
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS base
# Set working directory to app
WORKDIR /app
# Expose port 80
EXPOSE 80
# Expose port 443
EXPOSE 443

# Use dotnet10.0 sdk for compilation
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
# Compile the project to src
WORKDIR /src
# Copy Senparc.Web.csproj project to Senparc.Web directory
COPY ["Senparc.Web/Senparc.Web.csproj", "Senparc.Web/"]
# Execute dotnet restore command to restore packages
RUN dotnet restore "Senparc.Web/Senparc.Web.csproj"
# Copy all files
COPY . .
# Set working directory to /src/Senparc.Web
WORKDIR "/src/Senparc.Web"
# Execute dotnet build command, build Release environment to app/build directory
RUN dotnet build "Senparc.Web.csproj" -c Release -o /app/build

# Rename build to publish directory
FROM build AS publish
# Execute dotnet publish command, publish Release environment to app/publish directory
RUN dotnet publish "Senparc.Web.csproj" -c Release -o /app/publish

# Finally
FROM base AS final
# Set working directory to app
WORKDIR /app
# Copy files from publish directory to app/publish
COPY --from=publish /app/publish .
# Enter the project and execute dotnet Senparc.Web.dll
ENTRYPOINT ["dotnet", "Senparc.Web.dll"]
Edit this page on GitHub
Last Updated:
Contributors: Jeffrey Su, JeffreySu
Prev
appsettings.json Configuration
Next
Dapr