k8s in rancher版
Gogs
docker run -d -p 10022:22 -p 10080:3000 / --name=gogs --net=gogs / -v /opt/docker/gogs/:/data / gogs/gogs 复制代码
Rancher
docker run -d --restart=unless-stopped -p 80:80 -p 443:443 rancher/rancher:stable 复制代码
Jenkins
https://hub.docker.com/r/carsonf/jenkinsci_jenkins https://github.com/CarsonFjz/ci-jenkins-with-docker //构建源码,可自己定制其他 复制代码
可选插件那里安装Gogs和Git Parameter,然后重启jenkins
推送地址:http://[jenkins url]/gogs-webhook/?job=[project name]
docker-compose.yml
ps: ${GIT_BRANCH}是获取git分支名称
version: '3.3' services: webapp: restart: always image: "${GIT_BRANCH}/webapp" build: context: WebApplication1/. dockerfile: Dockerfile container_name: webapptest ports: - "8085:8085" 复制代码
dockerfile
根据自己实际情况进行构建
FROM microsoft/dotnet:2.2-aspnetcore-runtime AS base WORKDIR /app EXPOSE 8085 FROM microsoft/dotnet:2.2-sdk AS build WORKDIR /src COPY . . RUN dotnet restore "WebApplication1.csproj" RUN dotnet build "WebApplication1.csproj" -c Release -o /app FROM build AS publish RUN dotnet publish "WebApplication1.csproj" -c Release -o /app FROM base AS final WORKDIR /app COPY --from=publish /app . ENTRYPOINT ["dotnet", "WebApplication1.dll"] 复制代码