参考的是这篇文章https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/product/wxcloudrun_dev.html
下载的是官方demo
修改dockefile
# 指定wxcomponent镜像
FROM ccr.ccs.tencentyun.com/weixincloud/weixincloud_wxcomponent:latest as wxcomponent
# dotnet镜像
# https://hub.docker.com/_/microsoft-dotnet
FROM mcr.microsoft.com/dotnet/sdk:6.0-alpine AS build
# 选用国内镜像源以提高下载速度
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tencent.com/g' /etc/apk/repositories
WORKDIR /source
# 恢复项目的依赖项
COPY *.sln .
COPY aspnetapp/*.csproj ./aspnetapp/
RUN dotnet restore -r linux-musl-x64 /p:PublishReadyToRun=true
# copy everything else and build app
COPY aspnetapp/. ./aspnetapp/
WORKDIR /source/aspnetapp
RUN dotnet publish -c release -o /app -r linux-musl-x64 --self-contained true --no-restore /p:PublishTrimmed=true /p:PublishReadyToRun=true /p:PublishSingleFile=true
# final stage/image
FROM mcr.microsoft.com/dotnet/runtime-deps:6.0-alpine-amd64
# 容器默认时区为UTC,如需使用上海时间请启用以下时区设置命令
# RUN apk add tzdata && cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo Asia/Shanghai > /etc/timezone
# 使用 HTTPS 协议访问容器云调用证书安装
RUN apk add ca-certificates
COPY --from=wxcomponent /wxcloudrun-wxcomponent /wxcloudrun-wxcomponent
ENV GIN_MODE release
# 设定当前的工作目录
WORKDIR /app
COPY --from=build /app ./
# See: https://github.com/dotnet/announcements/issues/20
# Uncomment to enable globalization APIs (or delete)
# ENV \
# DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false \
# LC_ALL=en_US.UTF-8 \
# LANG=en_US.UTF-8
#RUN apk add --no-cache icu-libs
#ENV ASPNETCORE_URLS=http://127.0.0.1:8090
#ENTRYPOINT ["dotnet", "aspnetapp.dll", "--server.urls", "http://*:8090"]
#ENTRYPOINT ["dotnet", "aspnetapp.dll"]
CMD ["/bin/bash","-ce","./start.sh"]
start.sh
./aspnetapp &
cd /wxcloudrun-wxcomponent
./main
结果报错
----------服务wxcomponent-66438部署wxcomponent-66438-037-----------
2022-09-25 08:43:28 check_eks_virtual_service : process, Back-off restarting failed container,
2022-09-25 08:43:28 create_eks_virtual_service : succ,
通知中心
数据加载失败: 加载 “tcbDescribeCloudBaseRunProcessLog” 失败:Error: InternalError, tars_invoke_err:request timeout|CloudApp.CloudBaseRunServer.MainObj|4953344 (a3b7eb2e-ae27-440b-832b-204c507d8f88), 9 分钟前
你好,麻烦提供下APPID,环境ID,我们这边看下