为Blazor网站项目,“添加Docker支持”

这时,网站项目根目录下会新增Dockerfile。

里面文字内容如下

#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
USER app
WORKDIR /app
EXPOSE 8080
EXPOSE 8081 FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY ["NuGet.Config", "."]
COPY ["src/Yee.Change.PayPortal.Blazor/Yee.Change.PayPortal.Blazor.csproj", "src/Yee.Change.PayPortal.Blazor/"]
COPY ["src/Yee.Change.PayPortal.Application/Yee.Change.PayPortal.Application.csproj", "src/Yee.Change.PayPortal.Application/"]
COPY ["src/Yee.Change.PayPortal.Domain/Yee.Change.PayPortal.Domain.csproj", "src/Yee.Change.PayPortal.Domain/"]
COPY ["src/Yee.Change.PayPortal.Domain.Shared/Yee.Change.PayPortal.Domain.Shared.csproj", "src/Yee.Change.PayPortal.Domain.Shared/"]
COPY ["src/Yee.Change.PayPortal.Application.Contracts/Yee.Change.PayPortal.Application.Contracts.csproj", "src/Yee.Change.PayPortal.Application.Contracts/"]
COPY ["src/Yee.Change.PayPortal.HttpApi/Yee.Change.PayPortal.HttpApi.csproj", "src/Yee.Change.PayPortal.HttpApi/"]
COPY ["src/Yee.Change.PayPortal.EntityFrameworkCore/Yee.Change.PayPortal.EntityFrameworkCore.csproj", "src/Yee.Change.PayPortal.EntityFrameworkCore/"]
RUN dotnet restore "./src/Yee.Change.PayPortal.Blazor/Yee.Change.PayPortal.Blazor.csproj"
COPY . .
WORKDIR "/src/src/Yee.Change.PayPortal.Blazor"
RUN dotnet build "./Yee.Change.PayPortal.Blazor.csproj" -c $BUILD_CONFIGURATION -o /app/build FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "./Yee.Change.PayPortal.Blazor.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Yee.Change.PayPortal.Blazor.dll"]

在第二步用的镜像,我们需要干预一下,里面加入我们docker-linux-dotnet8:2024镜像里的脚本文件。制作好这个脚本之后,push到我们的服务器。

假定这个镜像是docker.amicap.cn/amihome/dotnet/sdk8:2024

那么我们把Visual Studio默认生成的Dockerfile,稍微修改一下

FROM docker.amicap.cn/amihome/dotnet/sdk8:2024 AS build

WORKDIR /
# 因为要运行下边这个shell,所以build镜像不能用默认的mcr.microsoft.com/dotnet/sdk:8.0
# 我们自己的镜像是包含下边这个shell的
RUN /home/public/download-directory-builds-props.sh dev.amihome.cn

Gitlab服务器上的设置

适用于本项目或群组级别的变量

本项目的 .gitlab-ci.yml

解决方案根目录下,.gitlab-ci.yml的内容如下

stages:
- build-docker-image
- docker-run-on-local-app-server
variables:
PAY_IMAGE_FULL_URL: $DOCKER_REPOZITORY_URL/pay:$CI_PIPELINE_ID
# Use no compression for caches
CACHE_COMPRESSION_LEVEL: "fastest"
cache:
paths:
- node_modules/
build API:
stage: build-docker-image
before_script:
- dotnet nuget locals plugins-cache --clear
- echo $DOCKER_LOGIN_USER $DOCKER_LOGIN_PASSWORD $DOCKER_REGISTRY_DNS_NAME
- docker login -u $DOCKER_LOGIN_USER -p $DOCKER_LOGIN_PASSWORD $DOCKER_REGISTRY_DNS_NAME
script:
- cd .
- docker buildx build --platform linux/amd64 -t $PAY_IMAGE_FULL_URL -f src/Yee.Change.PayPortal.Blazor/Dockerfile --no-cache . --push
部署支付网关(测试站):
stage: docker-run-on-local-app-server
script:
- echo "部署到支付网关测试站……"
- bash "/home/public/ssh-to-app-server-docker-run.sh" pay_test 58003 8080 $PAY_IMAGE_FULL_URL amisoft $DOCKER_REGISTRY_DNS_NAME $DOCKER_LOGIN_USER $DOCKER_LOGIN_PASSWORD $SSH_AUTO_LOGIN_USER $APP_SERVER

签入Gitlab

任务成功

build-docker-image的输出如下

Running with gitlab-runner 16.9.0 (656c1943)

on 春漫里1号大力士 rzPy7M6hB, system ID: r_aAMlDtmiasEr

Preparing the "docker" executor 00:00

Using Docker executor with image docker.amicap.cn/amihome/gitlab/docker-linux-dotnet8.0:20240227014 ...

Authenticating with credentials from $DOCKER_AUTH_CONFIG

Pulling docker image docker.amicap.cn/amihome/gitlab/docker-linux-dotnet8.0:20240227014 ...

Using docker image sha256:401be2ca165ffb3ef00c3e2bd172645dca0836969eadb800b60da3c5f20123c3 for docker.amicap.cn/amihome/gitlab/docker-linux-dotnet8.0:20240227014 with digest docker.amicap.cn/amihome/gitlab/docker-linux-dotnet8.0@sha256:899a45e25d3a397672c30c30bbdfc6719e80d706b24c2fa6265b413ab6ec85c7 ...

Preparing environment 00:01

Running on runner-rzpy7m6hb-project-37-concurrent-0 via 7171ce851b00...

Getting source from Git repository 00:02

Fetching changes with git depth set to 20...

Reinitialized existing Git repository in /builds/rzPy7M6hB/0/abp7/pay-portal/.git/

Checking out 4301a757 as detached HEAD (ref is master)...

Skipping Git submodules setup

Restoring cache 00:01

Checking cache for default-protected...

No URL provided, cache will not be downloaded from shared cache server. Instead a local version of cache will be extracted.

Successfully extracted cache

Executing "step_script" stage of the job script 02:53

Using docker image sha256:401be2ca165ffb3ef00c3e2bd172645dca0836969eadb800b60da3c5f20123c3 for docker.amicap.cn/amihome/gitlab/docker-linux-dotnet8.0:20240227014 with digest docker.amicap.cn/amihome/gitlab/docker-linux-dotnet8.0@sha256:899a45e25d3a397672c30c30bbdfc6719e80d706b24c2fa6265b413ab6ec85c7 ...

$ dotnet nuget locals plugins-cache --clear

Welcome to .NET 8.0!

---------------------

SDK Version: 8.0.200

Telemetry

---------

The .NET tools collect usage data in order to help us improve your experience. It is collected by Microsoft and shared with the community. You can opt-out of telemetry by setting the DOTNET_CLI_TELEMETRY_OPTOUT environment variable to '1' or 'true' using your favorite shell.

Read more about .NET CLI Tools telemetry: https://aka.ms/dotnet-cli-telemetry

----------------

Installed an ASP.NET Core HTTPS development certificate.

To trust the certificate, view the instructions: https://aka.ms/dotnet-https-linux

----------------

Write your first app: https://aka.ms/dotnet-hello-world

Find out what's new: https://aka.ms/dotnet-whats-new

Explore documentation: https://aka.ms/dotnet-docs

Report issues and find source on GitHub: https://github.com/dotnet/core

Use 'dotnet --help' to see available commands or visit: https://aka.ms/dotnet-cli

--------------------------------------------------------------------------------------

Clearing NuGet plugins cache: /root/.local/share/NuGet/plugin-cache

Local resources cleared.

$ echo $DOCKER_LOGIN_USER $DOCKER_LOGIN_PASSWORD $DOCKER_REGISTRY_DNS_NAME

david NXbdusoeiu*2349243_ded docker.amicap.cn

$ docker login -u $DOCKER_LOGIN_USER -p $DOCKER_LOGIN_PASSWORD $DOCKER_REGISTRY_DNS_NAME

WARNING! Using --password via the CLI is insecure. Use --password-stdin.

WARNING! Your password will be stored unencrypted in /root/.docker/config.json.

Configure a credential helper to remove this warning. See

https://docs.docker.com/engine/reference/commandline/login/#credentials-store

Login Succeeded

$ cd .

$ docker build -t $FRONT_API_REPO:$PAY_PORTAL_IMAGE_TAG -f src/Yee.Change.PayPortal.Blazor/Dockerfile --no-cache .

#0 building with "default" instance using docker driver

#1 [internal] load .dockerignore

#1 transferring context: 358B done

#1 DONE 0.0s

#2 [internal] load build definition from Dockerfile

#2 transferring dockerfile: 2.05kB done

#2 DONE 0.0s

#3 [internal] load metadata for docker.amicap.cn/amihome/dotnet/sdk8:2024

#3 DONE 0.0s

#4 [auth] sharing credentials for docker.amicap.cn

#4 DONE 0.0s

#5 [internal] load metadata for docker.amicap.cn/dotnet/aspnet:8.0

#5 DONE 0.1s

#6 [base 1/2] FROM docker.amicap.cn/dotnet/aspnet:8.0@sha256:29d068474f1a60fab7ee3a138ceb6a0c3ba9a81d77c96c28accc281a1327501d

#6 DONE 0.0s

#7 [base 2/2] WORKDIR /app

#7 CACHED

#8 [final 1/4] WORKDIR /app

#8 CACHED

#9 [build 1/16] FROM docker.amicap.cn/amihome/dotnet/sdk8:2024

#9 CACHED

#10 [internal] load build context

#10 transferring context: 30.32MB 0.3s done

#10 DONE 0.3s

#11 [build 2/16] RUN /home/public/download-directory-builds-props.sh dev.amihome.cn

#11 0.255 off

#11 0.256 共享版本号的http服务器是 dev.amihome.cn

#11 0.256 下载urlx.txt

#11 0.256 http://dev.amihome.cn/urls.txt

#11 0.257 --2024-02-28 10:42:09-- http://dev.amihome.cn/urls.txt

#11 0.257 Resolving dev.amihome.cn (dev.amihome.cn)... 192.168.3.218

#11 0.261 Connecting to dev.amihome.cn (dev.amihome.cn)|192.168.3.218|:80... connected.

#11 0.262 HTTP request sent, awaiting response... 200 OK

#11 0.263 Length: 2585 (2.5K) [text/plain]

#11 0.263 Saving to: 'urls.txt'

#11 0.263

#11 0.263 0K .. 100% 5.88M=0s

#11 0.263

#11 0.263 2024-02-28 10:42:09 (5.88 MB/s) - 'urls.txt' saved [2585/2585]

#11 0.263

#11 0.272 2024-02-28 10:42:09 URL:http://dev.amihome.cn/Directory.Build.props [10138/10138] -> "Directory.Build.props" [1]

#11 0.280 2024-02-28 10:42:09 URL:http://dev.amihome.cn/version-numbers/Directory.Build.Change.Account.props [122/122] -> "version-numbers/Directory.Build.Change.Account.props" [1]

#11 0.286 2024-02-28 10:42:09 URL:http://dev.amihome.cn/version-numbers/Directory.Build.Change.Common.props [120/120] -> "version-numbers/Directory.Build.Change.Common.props" [1]

#11 0.293 2024-02-28 10:42:09 URL:http://dev.amihome.cn/version-numbers/Directory.Build.Change.Config.props [120/120] -> "version-numbers/Directory.Build.Change.Config.props" [1]

#11 0.300 2024-02-28 10:42:09 URL:http://dev.amihome.cn/version-numbers/Directory.Build.Change.Divination.props [128/128] -> "version-numbers/Directory.Build.Change.Divination.props" [1]

#11 0.306 2024-02-28 10:42:09 URL:http://dev.amihome.cn/version-numbers/Directory.Build.Change.SaasDbAccess.props [132/132] -> "version-numbers/Directory.Build.Change.SaasDbAccess.props" [1]

#11 0.313 2024-02-28 10:42:09 URL:http://dev.amihome.cn/version-numbers/Directory.Build.Change.LeptonC.props [122/122] -> "version-numbers/Directory.Build.Change.LeptonC.props" [1]

#11 0.319 2024-02-28 10:42:09 URL:http://dev.amihome.cn/version-numbers/Directory.Build.Change.Rms.props [114/114] -> "version-numbers/Directory.Build.Change.Rms.props" [1]

#11 0.326 2024-02-28 10:42:09 URL:http://dev.amihome.cn/version-numbers/Directory.Build.Change.ToolKit.props [122/122] -> "version-numbers/Directory.Build.Change.ToolKit.props" [1]

#11 0.334 2024-02-28 10:42:09 URL:http://dev.amihome.cn/version-numbers/Directory.Build.Change.Calendar.props [124/124] -> "version-numbers/Directory.Build.Change.Calendar.props" [1]

#11 0.345 2024-02-28 10:42:09 URL:http://dev.amihome.cn/version-numbers/Directory.Build.Change.Brain.props [120/120] -> "version-numbers/Directory.Build.Change.Brain.props" [1]

#11 0.356 2024-02-28 10:42:09 URL:http://dev.amihome.cn/version-numbers/Directory.Build.Change.Brain.Fengshui.props [137/137] -> "version-numbers/Directory.Build.Change.Brain.Fengshui.props" [1]

#11 0.362 2024-02-28 10:42:09 URL:http://dev.amihome.cn/version-numbers/Directory.Build.Change.Brain.UI.props [124/124] -> "version-numbers/Directory.Build.Change.Brain.UI.props" [1]

#11 0.368 2024-02-28 10:42:09 URL:http://dev.amihome.cn/version-numbers/Directory.Build.Change.Brain.Ziping.props [134/134] -> "version-numbers/Directory.Build.Change.Brain.Ziping.props" [1]

#11 0.375 2024-02-28 10:42:09 URL:http://dev.amihome.cn/version-numbers/Directory.Build.Change.Brain.Lianshan.props [137/137] -> "version-numbers/Directory.Build.Change.Brain.Lianshan.props" [1]

#11 0.382 2024-02-28 10:42:09 URL:http://dev.amihome.cn/version-numbers/Directory.Build.Change.Brain.Qimen.props [131/131] -> "version-numbers/Directory.Build.Change.Brain.Qimen.props" [1]

#11 0.390 2024-02-28 10:42:09 URL:http://dev.amihome.cn/version-numbers/Directory.Build.Change.Brain.Zeri.props [129/129] -> "version-numbers/Directory.Build.Change.Brain.Zeri.props" [1]

#11 0.395 2024-02-28 10:42:09 URL:http://dev.amihome.cn/version-numbers/Directory.Build.Change.Brain.Ziwei.props [131/131] -> "version-numbers/Directory.Build.Change.Brain.Ziwei.props" [1]

#11 0.401 2024-02-28 10:42:09 URL:http://dev.amihome.cn/version-numbers/Directory.Build.Yee.AspNetCore.props [123/123] -> "version-numbers/Directory.Build.Yee.AspNetCore.props" [1]

#11 0.409 2024-02-28 10:42:09 URL:http://dev.amihome.cn/version-numbers/Directory.Build.Yee.Cloud.props [113/113] -> "version-numbers/Directory.Build.Yee.Cloud.props" [1]

#11 0.417 2024-02-28 10:42:09 URL:http://dev.amihome.cn/version-numbers/Directory.Build.Yee.props [102/102] -> "version-numbers/Directory.Build.Yee.props" [1]

#11 0.428 2024-02-28 10:42:09 URL:http://dev.amihome.cn/version-numbers/Directory.Build.Yee.Utils.props [120/120] -> "version-numbers/Directory.Build.Yee.Utils.props" [1]

#11 0.437 2024-02-28 10:42:09 URL:http://dev.amihome.cn/version-numbers/Directory.Build.Change.AdminUI.props [122/122] -> "version-numbers/Directory.Build.Change.AdminUI.props" [1]

#11 0.448 2024-02-28 10:42:09 URL:http://dev.amihome.cn/version-numbers/Directory.Build.Change.EasyComment.props [132/132] -> "version-numbers/Directory.Build.Change.EasyComment.props" [1]

#11 0.461 2024-02-28 10:42:09 URL:http://dev.amihome.cn/version-numbers/Directory.Build.Change.EventRecorder.props [134/134] -> "version-numbers/Directory.Build.Change.EventRecorder.props" [1]

#11 0.475 2024-02-28 10:42:09 URL:http://dev.amihome.cn/version-numbers/Directory.Build.Change.Shop.props [116/116] -> "version-numbers/Directory.Build.Change.Shop.props" [1]

#11 0.488 2024-02-28 10:42:09 URL:http://dev.amihome.cn/version-numbers/Directory.Build.Change.Pay.props [116/116] -> "version-numbers/Directory.Build.Change.Pay.props" [1]

#11 0.495 2024-02-28 10:42:09 URL:http://dev.amihome.cn/version-numbers/Directory.Build.Change.WeChatMp.props [124/124] -> "version-numbers/Directory.Build.Change.WeChatMp.props" [1]

#11 0.501 2024-02-28 10:42:09 URL:http://dev.amihome.cn/version-numbers/Directory.Build.Change.WeChatServices.props [135/135] -> "version-numbers/Directory.Build.Change.WeChatServices.props" [1]

#11 0.508 2024-02-28 10:42:09 URL:http://dev.amihome.cn/version-numbers/Directory.Build.EasyAbp.Abp.WeChat.props [146/146] -> "version-numbers/Directory.Build.EasyAbp.Abp.WeChat.props" [1]

#11 0.513 2024-02-28 10:42:09 URL:http://dev.amihome.cn/version-numbers/Directory.Build.Myvas.QQConnect.props [123/123] -> "version-numbers/Directory.Build.Myvas.QQConnect.props" [1]

#11 0.520 2024-02-28 10:42:09 URL:http://dev.amihome.cn/version-numbers/Directory.Build.Myvas.Weixin.Mp.props [124/124] -> "version-numbers/Directory.Build.Myvas.Weixin.Mp.props" [1]

#11 0.528 2024-02-28 10:42:09 URL:http://dev.amihome.cn/version-numbers/Directory.Build.Myvas.Weixin.Open.props [127/127] -> "version-numbers/Directory.Build.Myvas.Weixin.Open.props" [1]

#11 0.538 2024-02-28 10:42:09 URL:http://dev.amihome.cn/version-numbers/Directory.Build.Change.FrontEnd.props [125/125] -> "version-numbers/Directory.Build.Change.FrontEnd.props" [1]

#11 DONE 0.6s

#12 [build 3/16] WORKDIR /src

#12 DONE 0.1s

#13 [build 4/16] COPY [NuGet.Config, .]

#13 DONE 0.0s

#14 [build 5/16] COPY [src/Yee.Change.PayPortal.Blazor/Yee.Change.PayPortal.Blazor.csproj, src/Yee.Change.PayPortal.Blazor/]

#14 DONE 0.0s

#15 [build 6/16] COPY [src/Yee.Change.PayPortal.Application/Yee.Change.PayPortal.Application.csproj, src/Yee.Change.PayPortal.Application/]

#15 DONE 0.0s

#16 [build 7/16] COPY [src/Yee.Change.PayPortal.Domain/Yee.Change.PayPortal.Domain.csproj, src/Yee.Change.PayPortal.Domain/]

#16 DONE 0.0s

#17 [build 8/16] COPY [src/Yee.Change.PayPortal.Domain.Shared/Yee.Change.PayPortal.Domain.Shared.csproj, src/Yee.Change.PayPortal.Domain.Shared/]

#17 DONE 0.0s

#18 [build 9/16] COPY [src/Yee.Change.PayPortal.Application.Contracts/Yee.Change.PayPortal.Application.Contracts.csproj, src/Yee.Change.PayPortal.Application.Contracts/]

#18 DONE 0.0s

#19 [build 10/16] COPY [src/Yee.Change.PayPortal.HttpApi/Yee.Change.PayPortal.HttpApi.csproj, src/Yee.Change.PayPortal.HttpApi/]

#19 DONE 0.0s

#20 [build 11/16] COPY [src/Yee.Change.PayPortal.EntityFrameworkCore/Yee.Change.PayPortal.EntityFrameworkCore.csproj, src/Yee.Change.PayPortal.EntityFrameworkCore/]

#20 DONE 0.1s

#21 [build 12/16] RUN dotnet restore "src/Yee.Change.PayPortal.Blazor/Yee.Change.PayPortal.Blazor.csproj"

#21 0.765 Determining projects to restore...

#21 40.55 Restored /src/src/Yee.Change.PayPortal.Domain.Shared/Yee.Change.PayPortal.Domain.Shared.csproj (in 38.72 sec).

#21 42.40 Restored /src/src/Yee.Change.PayPortal.Domain/Yee.Change.PayPortal.Domain.csproj (in 40.6 sec).

#21 42.43 Restored /src/src/Yee.Change.PayPortal.Application.Contracts/Yee.Change.PayPortal.Application.Contracts.csproj (in 40.63 sec).

#21 53.05 Restored /src/src/Yee.Change.PayPortal.HttpApi/Yee.Change.PayPortal.HttpApi.csproj (in 51.25 sec).

#21 55.45 Restored /src/src/Yee.Change.PayPortal.EntityFrameworkCore/Yee.Change.PayPortal.EntityFrameworkCore.csproj (in 53.65 sec).

#21 63.38 Restored /src/src/Yee.Change.PayPortal.Application/Yee.Change.PayPortal.Application.csproj (in 1.03 min).

#21 134.9 Restored /src/src/Yee.Change.PayPortal.Blazor/Yee.Change.PayPortal.Blazor.csproj (in 2.22 min).

#21 DONE 135.4s

#22 [build 13/16] COPY . .

#22 DONE 0.1s

#23 [build 14/16] WORKDIR /src/src/Yee.Change.PayPortal.Blazor

#23 DONE 0.0s

#24 [build 15/16] RUN dotnet build "Yee.Change.PayPortal.Blazor.csproj" -c Release -o /app/build

#24 0.383 MSBuild version 17.9.4+90725d08d for .NET

#24 1.190 Determining projects to restore...

#24 2.104 All projects are up-to-date for restore.

#24 4.088 Yee.Change.PayPortal.Domain.Shared -> /app/build/Yee.Change.PayPortal.Domain.Shared.dll

#24 4.347 Yee.Change.PayPortal.Application.Contracts -> /app/build/Yee.Change.PayPortal.Application.Contracts.dll

#24 5.164 Yee.Change.PayPortal.HttpApi -> /app/build/Yee.Change.PayPortal.HttpApi.dll

#24 5.175 Yee.Change.PayPortal.Domain -> /app/build/Yee.Change.PayPortal.Domain.dll

#24 5.593 Yee.Change.PayPortal.Application -> /app/build/Yee.Change.PayPortal.Application.dll

#24 5.657 Yee.Change.PayPortal.EntityFrameworkCore -> /app/build/Yee.Change.PayPortal.EntityFrameworkCore.dll

#24 11.23 Yee.Change.PayPortal.Blazor -> /app/build/Yee.Change.PayPortal.Blazor.dll

#24 11.25

#24 11.25 Build succeeded.

#24 11.26 0 Warning(s)

#24 11.26 0 Error(s)

#24 11.26

#24 11.26 Time Elapsed 00:00:10.80

#24 DONE 11.4s

#25 [publish 1/1] RUN dotnet publish "Yee.Change.PayPortal.Blazor.csproj" -c Release -o /app/publish /p:UseAppHost=false

#25 0.430 MSBuild version 17.9.4+90725d08d for .NET

#25 1.204 Determining projects to restore...

#25 1.901 All projects are up-to-date for restore.

#25 2.985 Yee.Change.PayPortal.Domain.Shared -> /src/src/Yee.Change.PayPortal.Domain.Shared/bin/Release/netstandard2.0/Yee.Change.PayPortal.Domain.Shared.dll

#25 3.997 Yee.Change.PayPortal.Application.Contracts -> /src/src/Yee.Change.PayPortal.Application.Contracts/bin/Release/netstandard2.0/Yee.Change.PayPortal.Application.Contracts.dll

#25 4.301 Yee.Change.PayPortal.Domain -> /src/src/Yee.Change.PayPortal.Domain/bin/Release/net8.0/Yee.Change.PayPortal.Domain.dll

#25 4.578 Yee.Change.PayPortal.HttpApi -> /src/src/Yee.Change.PayPortal.HttpApi/bin/Release/net8.0/Yee.Change.PayPortal.HttpApi.dll

#25 4.768 Yee.Change.PayPortal.Application -> /src/src/Yee.Change.PayPortal.Application/bin/Release/net8.0/Yee.Change.PayPortal.Application.dll

#25 4.828 Yee.Change.PayPortal.EntityFrameworkCore -> /src/src/Yee.Change.PayPortal.EntityFrameworkCore/bin/Release/net8.0/Yee.Change.PayPortal.EntityFrameworkCore.dll

#25 9.141 Yee.Change.PayPortal.Blazor -> /src/src/Yee.Change.PayPortal.Blazor/bin/Release/net8.0/Yee.Change.PayPortal.Blazor.dll

#25 10.49 Yee.Change.PayPortal.Blazor -> /app/publish/

#25 DONE 10.6s

#26 [final 2/4] COPY --from=publish /app/publish .

#26 DONE 0.4s

#27 [final 3/4] RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

#27 DONE 0.2s

#28 [final 4/4] RUN echo 'Asia/Shanghai' >/etc/timezone

#28 DONE 0.5s

#29 exporting to image

#29 exporting layers

#29 exporting layers 1.1s done

#29 writing image sha256:18ea057d17482baf3638f9f0fcf91b164cb93a1cb87382befbb0fc6c6b8b583d done

#29 naming to docker.amicap.cn/change/pay:14501 0.0s done

#29 DONE 1.1s

$ docker push $FRONT_API_REPO:$PAY_PORTAL_IMAGE_TAG

The push refers to repository [docker.amicap.cn/change/pay]

a570bc7b0595: Preparing

4eca3a93fea4: Preparing

da9fe53908d2: Preparing

5f70bf18a086: Preparing

fca4cba553fe: Preparing

828e2dabde3f: Preparing

6e906a70a066: Preparing

82cc5cf93bd2: Preparing

93287e66966f: Preparing

4b703ea23cb9: Preparing

7292cf786aa8: Preparing

828e2dabde3f: Waiting

6e906a70a066: Waiting

82cc5cf93bd2: Waiting

93287e66966f: Waiting

4b703ea23cb9: Waiting

7292cf786aa8: Waiting

5f70bf18a086: Layer already exists

fca4cba553fe: Layer already exists

828e2dabde3f: Layer already exists

6e906a70a066: Layer already exists

82cc5cf93bd2: Layer already exists

93287e66966f: Layer already exists

4b703ea23cb9: Layer already exists

4eca3a93fea4: Pushed

7292cf786aa8: Layer already exists

a570bc7b0595: Pushed

da9fe53908d2: Pushed

14501: digest: sha256:63e7771e2f4f1562e2c4853bfd5a0c57871af82e6f71a84298ebfb4c3ae14425 size: 2618

Saving cache for successful job 00:01

Creating cache default-protected...

WARNING: node_modules/: no matching files. Ensure that the artifact path is relative to the working directory (/builds/rzPy7M6hB/0/abp7/pay-portal)

Archive is up to date!

Created cache

Cleaning up project directory and file based variables 00:01

Job succeeded

docker-run-on-local-app-server的输出如下

Running with gitlab-runner 16.9.0 (656c1943)

on 春漫里2号大力士 oEbtvPUXD, system ID: r_aAMlDtmiasEr

Preparing the "docker" executor 00:01

Using Docker executor with image docker.amicap.cn/amihome/gitlab/docker-linux-dotnet8.0:20240227014 ...

Authenticating with credentials from $DOCKER_AUTH_CONFIG

Pulling docker image docker.amicap.cn/amihome/gitlab/docker-linux-dotnet8.0:20240227014 ...

Using docker image sha256:401be2ca165ffb3ef00c3e2bd172645dca0836969eadb800b60da3c5f20123c3 for docker.amicap.cn/amihome/gitlab/docker-linux-dotnet8.0:20240227014 with digest docker.amicap.cn/amihome/gitlab/docker-linux-dotnet8.0@sha256:899a45e25d3a397672c30c30bbdfc6719e80d706b24c2fa6265b413ab6ec85c7 ...

Preparing environment 00:00

Running on runner-oebtvpuxd-project-37-concurrent-0 via 7171ce851b00...

Getting source from Git repository 00:01

Fetching changes with git depth set to 20...

Reinitialized existing Git repository in /builds/oEbtvPUXD/0/abp7/pay-portal/.git/

Checking out 4301a757 as detached HEAD (ref is master)...

Skipping Git submodules setup

Restoring cache 00:01

Checking cache for default-protected...

No URL provided, cache will not be downloaded from shared cache server. Instead a local version of cache will be extracted.

Successfully extracted cache

Executing "step_script" stage of the job script 00:01

Using docker image sha256:401be2ca165ffb3ef00c3e2bd172645dca0836969eadb800b60da3c5f20123c3 for docker.amicap.cn/amihome/gitlab/docker-linux-dotnet8.0:20240227014 with digest docker.amicap.cn/amihome/gitlab/docker-linux-dotnet8.0@sha256:899a45e25d3a397672c30c30bbdfc6719e80d706b24c2fa6265b413ab6ec85c7 ...

$ echo "部署到支付网关测试站……"

部署到支付网关测试站……

$ bash "/home/public/ssh-to-app-server-docker-run.sh" pay_test 58003 8080 $FRONT_API_REPO:$PAY_PORTAL_IMAGE_TAG amisoft $DOCKER_REGISTRY_DNS_NAME $DOCKER_LOGIN_USER $DOCKER_LOGIN_PASSWORD $SSH_AUTO_LOGIN_USER $APP_SERVER

docker容器实例名称: pay_test

目标服务器对外端口号 58003

docker容器开放端口号 8080

docker镜像URL docker.amicap.cn/change/pay:14501

容器启动配置环境 amisoft

Docker服务器DNS名称 docker.amicap.cn

登入Docker服务器的用户名称 david

登入Docker服务器的密码 NXbdusoeiu*2349243_ded

SSH自动登入目标服务器使用的用户名 david

SSH自动登入的目标服务器 192.168.3.201

在服务器上执行的命令是

docker run -d --privileged=true --restart=always -d --name pay_test -v /mnt/data/yee-change:/var/config -e ASPNETCORE_ENVIRONMENT=amisoft -p 58003:8080 docker.amicap.cn/change/pay:14501

Pseudo-terminal will not be allocated because stdin is not a terminal.

Host key verification failed.

734e7beae631

734e7beae631

Untagged: docker.amicap.cn/change/pay:14501

Untagged: docker.amicap.cn/change/pay@sha256:63e7771e2f4f1562e2c4853bfd5a0c57871af82e6f71a84298ebfb4c3ae14425

Deleted: sha256:18ea057d17482baf3638f9f0fcf91b164cb93a1cb87382befbb0fc6c6b8b583d

WARNING! Using --password via the CLI is insecure. Use --password-stdin.

WARNING! Your password will be stored unencrypted in /root/.docker/config.json.

Configure a credential helper to remove this warning. See

https://docs.docker.com/engine/reference/commandline/login/#credentials-store

Login Succeeded

Unable to find image 'docker.amicap.cn/change/pay:14501' locally

14501: Pulling from change/pay

af107e978371: Already exists

1b4797dcb4fc: Already exists

c044f7351ca2: Already exists

5eb35267f5cb: Already exists

8927932ecf48: Already exists

11c57fbb3977: Already exists

325935882b12: Already exists

4f4fb700ef54: Already exists

e5298dd679e6: Already exists

3512db053162: Already exists

ef88c93916ce: Already exists

Digest: sha256:63e7771e2f4f1562e2c4853bfd5a0c57871af82e6f71a84298ebfb4c3ae14425

Status: Downloaded newer image for docker.amicap.cn/change/pay:14501

5e2494bda111ad7636b56ddd2c5a016ae103e787c21e95e65aedef7c07fb0388

Saving cache for successful job 00:00

Creating cache default-protected...

WARNING: node_modules/: no matching files. Ensure that the artifact path is relative to the working directory (/builds/oEbtvPUXD/0/abp7/pay-portal)

Archive is up to date!

Created cache

Cleaning up project directory and file based variables 00:01

Job succeeded

用Docker发布网站时,自动下载Directory.Build.props及其Import的文件的更多相关文章

  1. asp.net core项目发布网站时的选项

    发布网站时的选项 Debug 通常称为调试版本,它包含调试信息,并且不作任何优化,便于程序员调试程序. Release 称为发布版本,它往往是进行了各种优化,使得程序在代码大小和运行速度上都是最优的, ...

  2. VS2010 发布网站时如何使DLL文件名固定

    VS在发布网站时,bin目录里为所有cs生成的dll文件每次都是随机命名的,如:App_Web_xxxxxxxx.dll(xxxxxxx是8个小写的字母和数字组成的字符串,随机的),这样对更新 Liv ...

  3. VS2010 发布网站时文件丢失

      问题:使用VS发布网站时,发现一些Flv等文件丢失,没有发布到指定文件夹中. 解决办法:打开文件属性窗口,找到生成操作,选项选择“内容”即可. 详细内容可参考官方文档: http://msdn.m ...

  4. DEDECMS织梦全站动态化访问(包括自由列表freelist)及发布内容时自动动态化设置

    DEDECMS织梦 - 全站已有内容全部设置为动态化访问(包括自由列表freelist),以及发布内容时自动为动态化,设置分为三个步骤: 1.将所有文档设置为“仅动态”:执行以下mysql语句:upd ...

  5. VS2010 发布网站时文件丢失解决办法

    网站项目中包含了一写rdlc的东西,发布网站选择仅限运行此应用程序所需文件,发布成功后发现这两个文件夹都没发布出来,找了下原因,解决办法是选择文件打开属性窗口找到生成操作,选项选择“内容”,重新发布, ...

  6. 安装Ruby、Sass在WebStrom添加Watcher实现编辑scss文件时自动生成.map和压缩后的.css文件

    前言 这段时间一直在看Bootstrap,V3官方直接提供了Less版本的源码,就先将Less学完了,很简单的语法,学习写Demo都是在Webstorm里写的,配置了Watcher自动编译(详见< ...

  7. Roslyn 使用 Directory.Build.props 管理多个项目配置

    在一些大项目需要很多独立的仓库来做,每个仓库之间都会有很多相同的配置,本文告诉大家如何通过 Directory.Build.props 管理多个项目配置 在我的 MVVM 框架需要三个不同的库,一个是 ...

  8. 使用MSBuild Tools调用csproj项目文件发布网站时$(SolutionDir)宏参数值丢失为空的解决方案

    使用Visual Studio打开解决方案,对<网站项目>右键点击<发布>,一切都是正常的,所有宏都可用,宏参数值也是正确的. 而通过批处理脚本命令调用MSBuild.exe对 ...

  9. VS编译时自动下载NuGet管理的库

    之前一直使用NuGet来管理一些第三方的库,但是每次check in代码时候为了保证编译通过,都需要把对应的packages check in. 比较耗费时间,特别是往github上同步代码,而且这些 ...

  10. VS发布网站时,报错提示:“未能将文件xxx复制到xxx,未能找到文件xx”三种解决方案!

    发布网站时候大家可能会遇到这样的情况,就是报错提示说:“未能将文件xxx复制到xxx,未能找到文件xx”,这个问题一般来说有三种解决方案,个人倾向第三种,如图: 解决方案如下: 方案一.把系统提示缺失 ...

随机推荐

  1. [转帖]Ceph优化系列(四):RocksDB 使用 ARM 64 位 CRC32C 硬件优化指令

    一.前言 CRC32(A cyclic redundancy check 32)应用于校验,为了保证数据的正确性,采用的一种检错手段. CRC32C (CRC32 Castagnoli)  与 CRC ...

  2. [转帖]【redis】redis各稳定版本特性(更新到6.0版本)

    1.Redis2.6 Redis2.6在2012年正是发布,经历了17个版本,到2.6.17版本,相对于Redis2.4,主要特性如下: 1)服务端支持Lua脚本. 2)去掉虚拟内存相关功能. 3)放 ...

  3. 记录一次RPC服务有损上线的分析过程

    1. 问题背景 某应用在启动完提供JSF服务后,短时间内出现了大量的空指针异常. 分析日志,发现是服务依赖的藏经阁配置数据未加载完成导致.即所谓的有损上线或者是直接发布,当应用启动时,service还 ...

  4. 解决刷新SwaggerUi控制台报错

    一.问题描述 在浏览器刷新SwaggerUI的页面,控制台就报错: java.lang.NumberFormatException: For input string: "" at ...

  5. vue3.2中setup语法糖父组件如何调用子组件中的方法

    父组件如何调用子组件中的方法 父组件.vue <template> <div> <aa ref="testRef"></aa> &l ...

  6. js 删除数组中的某一个内容

    <script type="text/javascript"> let list=["为","啊发大水","阿斯蒂芬& ...

  7. 微服务用yml安装系统(第一版)

    当用微服务安装系统后,面临服务较多,一个一个安装比较麻烦,是否有统一的脚本可以直接执行安装呢?答案是肯定的: 1.首先介绍一下所有安装脚本,如下图 spd-volume:是各服务外挂的资料卷 comm ...

  8. NSSCTF Round#17 Basic CRYPTO

    Level_1 题目 Level_1.py(我把参数整理了一下,看着舒服) #真签到题 from Crypto.Util.number import bytes_to_long, getPrime f ...

  9. 解决Edge浏览器提示“此网站已被人举报不安全”

    今天下午微软旗下的 Microsoft Edge 浏览器将百度搜索的跳转域名 (*.baidu.com/link?url=*) 封杀,百度搜索首页可以打开,但搜索任何关键词点击搜索结果都会被拦截. 当 ...

  10. PaddleHub--飞桨预训练模型应用工具{风格迁移模型、词法分析情感分析、Fine-tune API微调}【一】

    相关文章: 基础知识介绍: [一]ERNIE:飞桨开源开发套件,入门学习,看看行业顶尖持续学习语义理解框架,如何取得世界多个实战的SOTA效果?_汀.的博客-CSDN博客_ernie模型 百度飞桨:E ...