
Linux Deployment
Follow these deployment steps:
1. Generate Publish Files
Right-click the *.Host project and select Publish, click Create new profile, select Folder and Folder location, then click Publish after configuring the settings.

The publish profile is generated in Properties/PublishProfiles/FolderProfile.pubxml
<?xml version="1.0" encoding="utf-8"?>
<!-- https://go.microsoft.com/fwlink/?LinkID=208121. -->
<Project>
<PropertyGroup>
<DeleteExistingFiles>false</DeleteExistingFiles>
<ExcludeApp_Data>false</ExcludeApp_Data>
<LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<PublishProvider>FileSystem</PublishProvider>
<PublishUrl>bin\Release\net10.0\publish\</PublishUrl>
<WebPublishMethod>FileSystem</WebPublishMethod>
<_TargetId>Folder</_TargetId>
<SiteUrlToLaunchAfterPublish />
<TargetFramework>net10.0</TargetFramework>
<RuntimeIdentifier>linux-x64</RuntimeIdentifier>
<ProjectGuid>6f47a41a-085e-4422-bb73-5a2cbaa07d9f</ProjectGuid>
<SelfContained>false</SelfContained>
</PropertyGroup>
</Project>2. Add Docker Deployment Files
Dockerfile
# Use official ASP.NET Core 10.0 runtime image
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS publish
# Set working directory to /app
WORKDIR /app
# Expose container port 18010
EXPOSE 18010
# Copy all files from the build context to /app directory
COPY . .
# Set container timezone to Asia/Shanghai (UTC+8)
ENV TZ=Asia/Shanghai
# Set the command to run when the container starts
ENTRYPOINT ["dotnet", "*.Host.dll"]Note
Replace *.Host.dll with the actual *.Host.dll from the bin/Release/net9.0/publish directory. Modify according to your module project name.
18010 is the module port. Modify according to your module's startup port.
docker-compose.yml
version: '3'
services:
admin:
image: zhontai/admin:10.0.1
build:
context: .
dockerfile: Dockerfile
hostname: admin
container_name: admin
ports:
- "18010:18010"
volumes:
- ./appsettings.json:/app/appsettings.json
- ./ConfigCenter:/app/ConfigCenter
- ../logs/:/logs
- ./upload/:/app/upload
restart: alwaysports:
- "host_port:container_port"
volumes:
- host_directory:container_directory3. Build Image and Start Container
docker-compose up -d --build-d: Run container in background --build: Force rebuild the image (applicable after code updates)
Access API documentation
http://localhost:18010/doc/admin/index.htmlNote
If you cannot access it, first check whether ConfigCenter/appconfig.json.swagger.enabled is enabled
4. View Service Status
docker-compose ps5. View Logs
docker-compose logs -f admin6. Stop and Remove Container
docker-compose down7. Remove Image
- Remove a specific image (e.g., zhontai/admin:10.0.1)
docker rmi zhontai/admin:10.0.1- Force remove (if the image is in use by a container)
docker rmi -f zhontai/admin:10.0.1