内容简介:k8s in rancher版GogsRancher
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 //构建源码,可自己定制其他 复制代码
Jenkins docker
1.初始密码在 /jenkins_home/secrets/initialAdminPassword 这个文件
2.完成初始化后 在左边列表 [系统管理->插件管理] 下载安装插件并重启jenkins
可选插件那里安装Gogs和Git Parameter,然后重启jenkins
3.新建项目
4.在Gogs配置一个钩子
推送地址:http://[jenkins url]/gogs-webhook/?job=[project name]
5.在Jenkins的项目配置
6.编辑自己的dockerfile和docker-compose.yml
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"] 复制代码
以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网
猜你喜欢:- Syncd - 自动化部署工具
- 前端自动化部署方案探索
- 使用 Capistrano 进行自动化部署
- jenkins自动化项目部署实战
- Syncd——开源自动化部署工具
- SaltStack自动化批量部署Apache
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Release It!
Michael T. Nygard / Pragmatic Bookshelf / 2007-03-30 / USD 34.95
“Feature complete” is not the same as “production ready.” Whether it’s in Java, .NET, or Ruby on Rails, getting your application ready to ship is only half the battle. Did you design your system to......一起来看看 《Release It!》 这本书的介绍吧!