gitlab-CI作业-yml
.gitlab-ci.yml(net core&all&linux&docker-build-run)
stages:
- build
- deploy build_job:
stage: build
image: docker.tidebuy.net/dotnet/core/sdk:3.1
script:
- echo "Restore NuGet Packages..."
- echo "dotnet restore TLZ.COM.NetCore.Demo.sln ..."
- dotnet restore $CI_PROJECT_DIR/TLZ.COM.NetCore.Demo/TLZ.COM.NetCore.Demo.sln
- echo "Release easyui publish ..."
- dotnet publish $CI_PROJECT_DIR/TLZ.COM.NetCore.Demo/TLZ.COM.NetCore.View.EasyUIDemo/TLZ.COM.NetCore.View.EasyUIDemo.csproj -c Release -o $CI_PROJECT_DIR/publish/easyui/
- echo "Release sso publish ..."
- dotnet publish $CI_PROJECT_DIR/TLZ.COM.NetCore.Demo/TLZ.COM.NetCore.View.SSODemo/TLZ.COM.NetCore.View.SSODemo.csproj -c Release -o $CI_PROJECT_DIR/publish/sso/
- echo "Release image publish ..."
- dotnet publish $CI_PROJECT_DIR/TLZ.COM.NetCore.Demo/TLZ.COM.NetCore.View.ImageSharpImageDemo/TLZ.COM.NetCore.View.ImageSharpImageDemo.csproj -c Release -o $CI_PROJECT_DIR/publish/image/
artifacts:
name: "$CI_JOB_NAME-$CI_COMMIT_REF_NAME"
paths:
- publish/
expire_in: days
only:
- master
- dev deploy_job:
stage: deploy
image: "docker:19.03.5"
dependencies:
- build_job
services:
- docker:19.03.-dind
script:
- echo "Release easyui deploy ..."
- for PID in `ps -ef |grep TLZ.COM.NeatCore.View.EasyUIDemo.dll|grep -v grep|awk '{print $2}'`;do kill - $PID; done
- cp -rf $CI_PROJECT_DIR/publish/easyui/* /data/web/easyui/deploy/
- cd /data/web/easyui/deploy/
- rm -rf *.pdb
- echo "Run easyui deploy ..."
- setsid '/data/web/easyui/easyui-run-linux.sh' #直接从CI作业开始的任何进程都将在作业结束时终止https://gitlab.com/gitlab-org/gitlab-runner/issues/2231
- echo "Release sso deploy ..."
- for PID in `ps -ef |grep TLZ.COM.NetCore.View.SSODemo.dll|grep -v grep|awk '{print $2}'`;do kill -9 $PID; done
- cp -rf $CI_PROJECT_DIR/publish/sso/* /data/web/sso/deploy/
- cd /data/web/sso/deploy/
- rm -rf *.pdb
- echo "Run sso deploy ..."
- setsid '/data/web/sso/sso-run-linux.sh' #直接从CI作业开始的任何进程都将在作业结束时终止https://gitlab.com/gitlab-org/gitlab-runner/issues/2231
- echo "Release image deploy ..."
- for PID in `ps -ef |grep TLZ.COM.NetCore.View.ImageSharpImageDemo.dll|grep -v grep|awk '{print $2}'`;do kill -9 $PID; done
- cp -rf $CI_PROJECT_DIR/publish/image/* /data/web/image/deploy/
- cd /data/web/image/deploy/
- rm -rf *.pdb
- echo "Run image deploy ..."
- setsid '/data/web/image/image-run-linux.sh' #直接从CI作业开始的任何进程都将在作业结束时终止https://gitlab.com/gitlab-org/gitlab-runner/issues/2231
- echo "Run docker-compose deploy ..."
- cd $CI_PROJECT_DIR/
- chmod +x docker-compose.sh
- sh docker-compose.sh - echo "Run docker build ..."
- image_version="${CI_APPLICATION_TAG:-${CI_COMMIT_SHA:0:8}}"
- easyui_image="dotnetcore31easyui"
- sso_image="dotnetcore31sso"
- image_image="dotnetcore31image"
- cd $CI_PROJECT_DIR
- docker build -f rancher-pipeline/Dockerfile
--build-arg APP_PATH="publish/easyui/"
--build-arg MAIN_DLL="TLZ.COM.NetCore.View.EasyUIDemo.dll"
--build-arg PORT="7777"
--build-arg MAIN_ENV="--environment=Docker"
--tag "$easyui_image:$image_version"
--tag "$easyui_image:latest"
.
- docker build -f rancher-pipeline/Dockerfile
--build-arg APP_PATH="publish/sso/"
--build-arg MAIN_DLL="TLZ.COM.NetCore.View.SSODemo.dll"
--build-arg PORT="1234"
--build-arg MAIN_ENV="--environment=Docker"
--tag "$sso_image:$image_version"
--tag "$sso_image:latest"
.
- docker build -f rancher-pipeline/Dockerfile
--build-arg APP_PATH="publish/image/"
--build-arg MAIN_DLL="TLZ.COM.NetCore.View.ImageSharpImageDemo.dll"
--build-arg PORT="5050"
--build-arg MAIN_ENV=""
--tag "$image_image:$image_version"
--tag "$image_image:latest"
. - echo "Run docker run ..."
- for container_id in $(docker ps -a --filter="name=$easyui_image" -q);do docker rm -f $container_id;done
- docker run -d -p 27777:7777 --link trusting_euclid --network bridge --workdir /app --name $easyui_image $easyui_image:$image_version
- for container_id in $(docker ps -a --filter="name=$sso_image" -q);do docker rm -f $container_id;done
- docker run -d -p 21234:1234 --link trusting_euclid --network bridge --workdir /app --name $sso_image $sso_image:$image_version
- for container_id in $(docker ps -a --filter="name=$image_image" -q);do docker rm -f $container_id;done
- docker run -d -p 25050:5050 --volume /data/web/image/docker:/app/wwwroot/image-cache --workdir /app --name $image_image $image_image:$image_version
- exit
only:
- master
- dev
- tags
when: on_success
.gitlab-ci.yml(net core&all&linux&docker-build-run)
rancher-pipeline/Dockerfile
FROM docker.tidebuy.net/dotnet/core/aspnet:3.1
WORKDIR /app RUN echo "Asia/Shanghai" > /etc/timezone; \
sed -i 's/TLSv1.2/TLSv1.0/g' /etc/ssl/openssl.cnf; ARG APP_PATH
ARG MAIN_DLL
ARG MAIN_ENV COPY ${APP_PATH} .
ENV MAIN_DLL=${MAIN_DLL}
ENV MAIN_ENV=${MAIN_ENV}
EXPOSE ${PORT} CMD ["sh", "-c","/usr/bin/dotnet /app/$MAIN_DLL $MAIN_ENV"]
rancher-pipeline/Dockerfile
------------------------------------------------------------------------
.gitlab-ci.yml(net core&all&linux&docker-compose)
stages:
- build
- deploy before_script:
- echo "Restore NuGet Packages..."
- echo "dotnet restore TLZ.COM.NetCore.Demo.sln ..."
- dotnet restore $CI_PROJECT_DIR/TLZ.COM.NetCore.Demo/TLZ.COM.NetCore.Demo.sln build_job:
stage: build
script:
- echo "Release easyui publish ..."
- dotnet publish $CI_PROJECT_DIR/TLZ.COM.NetCore.Demo/TLZ.COM.NetCore.View.EasyUIDemo/TLZ.COM.NetCore.View.EasyUIDemo.csproj -c Release -o /data/web/easyui/publish
- echo "Release sso publish ..."
- dotnet publish $CI_PROJECT_DIR/TLZ.COM.NetCore.Demo/TLZ.COM.NetCore.View.SSODemo/TLZ.COM.NetCore.View.SSODemo.csproj -c Release -o /data/web/sso/publish
- echo "Release image publish ..."
- dotnet publish $CI_PROJECT_DIR/TLZ.COM.NetCore.Demo/TLZ.COM.NetCore.View.ImageSharpImageDemo/TLZ.COM.NetCore.View.ImageSharpImageDemo.csproj -c Release -o /data/web/image/publish
only:
- master
- dev deploy_job:
stage: deploy
script:
- echo "Release easyui deploy ..."
- for PID in `ps -ef |grep TLZ.COM.NetCore.View.EasyUIDemo.dll|grep -v grep|awk '{print $2}'`;do kill - $PID; done
- cp -rf /data/web/easyui/publish/* /data/web/easyui/deploy/
- cd /data/web/easyui/deploy/
- rm -rf *.pdb
- echo "Run easyui deploy ..."
- setsid '/data/web/easyui/easyui-run-linux.sh' #直接从CI作业开始的任何进程都将在作业结束时终止https://gitlab.com/gitlab-org/gitlab-runner/issues/2231
- echo "Release sso deploy ..."
- for PID in `ps -ef |grep TLZ.COM.NetCore.View.SSODemo.dll|grep -v grep|awk '{print $2}'`;do kill -9 $PID; done
- cp -rf /data/web/sso/publish/* /data/web/sso/deploy/
- cd /data/web/sso/deploy/
- rm -rf *.pdb
- echo "Run sso deploy ..."
- setsid '/data/web/sso/sso-run-linux.sh' #直接从CI作业开始的任何进程都将在作业结束时终止https://gitlab.com/gitlab-org/gitlab-runner/issues/2231
- echo "Release image deploy ..."
- for PID in `ps -ef |grep TLZ.COM.NetCore.View.ImageSharpImageDemo.dll|grep -v grep|awk '{print $2}'`;do kill -9 $PID; done
- cp -rf /data/web/image/publish/* /data/web/image/deploy/
- cd /data/web/image/deploy/
- rm -rf *.pdb
- echo "Run image deploy ..."
- setsid '/data/web/image/image-run-linux.sh' #直接从CI作业开始的任何进程都将在作业结束时终止https://gitlab.com/gitlab-org/gitlab-runner/issues/2231
- echo "Run docker deploy ..."
- cd $CI_PROJECT_DIR/
- chmod +x docker-compose.sh
- sh docker-compose.sh
- exit
only:
- master
- dev
- tags
when: on_success
.gitlab-ci.yml(net core&linux&docker-compose)
.gitlab-ci.yml(net core&easyui&linux)
stages:
- build
- deploy before_script:
- echo "Restore NuGet Packages..."
- echo "dotnet restore $CI_PROJECT_DIR/TLZ.COM.NetCore.Demo/TLZ.COM.NetCore.Demo.sln"
- dotnet restore $CI_PROJECT_DIR/TLZ.COM.NetCore.Demo/TLZ.COM.NetCore.Demo.sln build_job:
stage: build
script:
- echo "Release publish..."
- echo "dotnet publish $CI_PROJECT_DIR/TLZ.COM.NetCore.Demo/TLZ.COM.NetCore.View.EasyUIDemo/TLZ.COM.NetCore.View.EasyUIDemo.csproj -c Release -o /data/web/easyui/publish"
- dotnet publish $CI_PROJECT_DIR/TLZ.COM.NetCore.Demo/TLZ.COM.NetCore.View.EasyUIDemo/TLZ.COM.NetCore.View.EasyUIDemo.csproj -c Release -o /data/web/easyui/publish
only:
- master
- dev deploy_job:
stage: deploy
script:
- echo "Release deploy..."
- for PID in `ps -ef |grep TLZ.COM.NetCore.View.EasyUIDemo.dll|grep -v grep|awk '{print $2}'`;do kill - $PID; done
- cp -rf /data/web/easyui/publish/* /data/web/easyui/deploy/
- cd /data/web/easyui/deploy/
- rm -rf *.pdb
- echo "run deploy..."
- setsid '/data/web/easyui/easyui-run-linux.sh' #直接从CI作业开始的任何进程都将在作业结束时终止https://gitlab.com/gitlab-org/gitlab-runner/issues/2231
- exit
only:
- master
when: on_success
.gitlab-ci.yml(net core&easyui)
/data/web/easyui/easyui-run-linux.sh
nohup dotnet /data/web/easyui/deploy/TLZ.COM.NetCore.View.EasyUIDemo.dll >wwwroot/nohup.log >& &
easyui-run-linux.sh
.gitlab-ci.yml(net core&image&linux)
stages:
- build
- deploy before_script:
- echo "Restore NuGet Packages..."
- echo "dotnet restore $CI_PROJECT_DIR/TLZ.COM.NetCore.Demo/TLZ.COM.NetCore.Demo.sln"
- dotnet restore $CI_PROJECT_DIR/TLZ.COM.NetCore.Demo/TLZ.COM.NetCore.Demo.sln build_job:
stage: build
script:
- echo "Release publish..."
- echo "dotnet publish $CI_PROJECT_DIR/TLZ.COM.NetCore.Demo/TLZ.COM.NetCore.View.ImageSharpImageDemo/TLZ.COM.NetCore.View.ImageSharpImageDemo.csproj -c Release -o /data/web/image/publish"
- dotnet publish $CI_PROJECT_DIR/TLZ.COM.NetCore.Demo/TLZ.COM.NetCore.View.ImageSharpImageDemo/TLZ.COM.NetCore.View.ImageSharpImageDemo.csproj -c Release -o /data/web/image/publish
only:
- master
- dev deploy_job:
stage: deploy
script:
- echo "Release deploy..."
- for PID in `ps -ef |grep TLZ.COM.NetCore.View.ImageSharpImageDemo.dll|grep -v grep|awk '{print $2}'`;do kill - $PID; done
- cp -rf /data/web/image/publish/* /data/web/image/deploy/
- cd /data/web/image/deploy/
- rm -rf *.pdb
- echo "run deploy..."
- setsid '/data/web/image/image-run-linux.sh' #直接从CI作业开始的任何进程都将在作业结束时终止https://gitlab.com/gitlab-org/gitlab-runner/issues/2231
- exit
only:
- master
- tags
when: on_success
.gitlab-ci.yml(net core&image)
/data/web/image/image-run-linux.sh
nohup dotnet /data/web/image/deploy/TLZ.COM.NetCore.View.ImageSharpImageDemo.dll >wwwroot/nohup.log >& &
image-run-linux.sh
.gitlab-ci.yml(net core&sso&linux)
stages:
- build
- deploy before_script:
- echo "Restore NuGet Packages..."
- echo "dotnet restore $CI_PROJECT_DIR/TLZ.COM.NetCore.Demo/TLZ.COM.NetCore.Demo.sln"
- dotnet restore $CI_PROJECT_DIR/TLZ.COM.NetCore.Demo/TLZ.COM.NetCore.Demo.sln build_job:
stage: build
script:
- echo "Release publish..."
- echo "dotnet publish $CI_PROJECT_DIR/TLZ.COM.NetCore.Demo/TLZ.COM.NetCore.View.SSODemo/TLZ.COM.NetCore.View.SSODemo.csproj -c Release -o /data/web/sso/publish"
- dotnet publish $CI_PROJECT_DIR/TLZ.COM.NetCore.Demo/TLZ.COM.NetCore.View.SSODemo/TLZ.COM.NetCore.View.SSODemo.csproj -c Release -o /data/web/sso/publish
only:
- master
- dev deploy_job:
stage: deploy
script:
- echo "Release deploy..."
- for PID in `ps -ef |grep TLZ.COM.NetCore.View.SSODemo.dll|grep -v grep|awk '{print $2}'`;do kill - $PID; done
- cp -rf /data/web/sso/publish/* /data/web/sso/deploy/
- cd /data/web/sso/deploy/
- rm -rf *.pdb
- echo "run deploy..."
- setsid '/data/web/sso/sso-run-linux.sh' #直接从CI作业开始的任何进程都将在作业结束时终止https://gitlab.com/gitlab-org/gitlab-runner/issues/2231
- exit
only:
- master
- tags
when: on_success
.gitlab-ci.yml(net core&sso)
/data/web/sso/sso-run-linux.sh
nohup dotnet /data/web/sso/deploy/TLZ.COM.NetCore.View.SSODemo.dll >wwwroot/nohup.log >& &
sso-run-linux.sh
docker-compose.yml(net core&all)
version: '3.4'
services:
TLZ.COM.NetCore.View.EasyUIDemo:
image: tlz.netcore.easyuidemo:1.0
build:
context: ./TLZ.COM.NetCore.Demo
dockerfile: ./TLZ.COM.NetCore.View.EasyUIDemo/Dockerfile
environment:
- ASPNETCORE_ENVIRONMENT=Development
ports:
- :
TLZ.COM.NetCore.View.ImageSharpImageDemo:
image: tlz.netcore.imagesharpimagedemo:1.0
build:
context: ./TLZ.COM.NetCore.Demo
dockerfile: ./TLZ.COM.NetCore.View.ImageSharpImageDemo/Dockerfile
ports:
- :
volumes:
- type: bind
source: /data/web/image/docker
target: /app/wwwroot/image-cache
TLZ.COM.NetCore.View.SSODemo:
image: tlz.netcore.ssodemo:1.0
build:
context: ./TLZ.COM.NetCore.Demo
dockerfile: ./TLZ.COM.NetCore.View.SSODemo/Dockerfile
environment:
- ASPNETCORE_ENVIRONMENT=Docker
ports:
- :
external_links:
- trusting_euclid:trusting_euclid
network_mode: bridge
docker-compose.yml
docker-compose.sh
docker-compose build --no-cache && docker-compose up -d
docker-compose.sh
TLZ.COM.NetCore.View.EasyUIDemo(DockerFile)
FROM dotnet/core/aspnet:3.1 AS base
WORKDIR /app
EXPOSE FROM dotnet/core/sdk:3.1 AS build
WORKDIR /src
COPY ["TLZ.COM.NetCore.View.EasyUIDemo/TLZ.COM.NetCore.View.EasyUIDemo.csproj", "TLZ.COM.NetCore.View.EasyUIDemo/"]
COPY ["TLZ.DapperEx/TLZ.DapperEx.csproj", "TLZ.DapperEx/"]
COPY ["TLZ.ExpressionToSql/TLZ.ExpressionToSql.csproj", "TLZ.ExpressionToSql/"]
COPY ["TLZ.WebMvc/TLZ.WebMvc.csproj", "TLZ.WebMvc/"]
COPY ["TLZ.Web/TLZ.Web.csproj", "TLZ.Web/"]
COPY ["TLZ.Helper/TLZ.Helper.csproj", "TLZ.Helper/"]
COPY ["TLZ.Model/TLZ.Model.csproj", "TLZ.Model/"]
COPY ["TLZ.UrlRule/TLZ.UrlRule.csproj", "TLZ.UrlRule/"]
COPY ["TLZ.COM.Module.WebSite.Enum/TLZ.COM.Module.WebSite.Enum.csproj", "TLZ.COM.Module.WebSite.Enum/"]
COPY ["TLZ.COM.DB.Entity/TLZ.COM.DB.Entity.csproj", "TLZ.COM.DB.Entity/"]
COPY ["TLZ.COM.DB.SqlServerDAL/TLZ.COM.DB.SqlServerDAL.csproj", "TLZ.COM.DB.SqlServerDAL/"]
COPY ["TLZ.DBCore/TLZ.DBCore.csproj", "TLZ.DBCore/"]
COPY ["TLZ.COM.DB.IDAL/TLZ.COM.DB.IDAL.csproj", "TLZ.COM.DB.IDAL/"]
COPY ["TLZ.Redis/TLZ.Redis.csproj", "TLZ.Redis/"]
COPY ["TLZ.COM.DB.BLL/TLZ.COM.DB.BLL.csproj", "TLZ.COM.DB.BLL/"]
COPY ["TLZ.COM.DB.BIZ/TLZ.COM.DB.BIZ.csproj", "TLZ.COM.DB.BIZ/"]
COPY ["TLZ.CacheManager/TLZ.CacheManager.csproj", "TLZ.CacheManager/"]
COPY ["TLZ.CacheCore/TLZ.CacheCore.csproj", "TLZ.CacheCore/"]
COPY ["TLZ.FilterExpression/TLZ.FilterExpression.csproj", "TLZ.FilterExpression/"]
COPY ["TLZ.COM.DB.MySqlDAL/TLZ.COM.DB.MySqlDAL.csproj", "TLZ.COM.DB.MySqlDAL/"]
COPY ["TLZ.COM.DB.DataFilter/TLZ.COM.DB.DataFilter.csproj", "TLZ.COM.DB.DataFilter/"]
RUN dotnet restore "TLZ.COM.NetCore.View.EasyUIDemo/TLZ.COM.NetCore.View.EasyUIDemo.csproj"
COPY . .
WORKDIR "/src/TLZ.COM.NetCore.View.EasyUIDemo"
RUN dotnet build "TLZ.COM.NetCore.View.EasyUIDemo.csproj" -c Release -o /app/build FROM build AS publish
RUN dotnet publish "TLZ.COM.NetCore.View.EasyUIDemo.csproj" -c Release -o /app/publish FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
RUN sed -i 's/TLSv1.2/TLSv1.0/g' /etc/ssl/openssl.cnf
ENTRYPOINT ["dotnet", "TLZ.COM.NetCore.View.EasyUIDemo.dll", "--environment=Docker"]
TLZ.COM.NetCore.View.EasyUIDemo(DockerFile)
TLZ.COM.NetCore.View.ImageSharpImageDemo(DockerFile)
FROM mcr.microsoft.com/dotnet/core/aspnet:2.2 AS base
WORKDIR /app
EXPOSE FROM mcr.microsoft.com/dotnet/core/sdk:2.2 AS build
WORKDIR /src
COPY ["TLZ.COM.NetCore.View.ImageSharpImageDemo/TLZ.COM.NetCore.View.ImageSharpImageDemo.csproj", "TLZ.COM.NetCore.View.ImageSharpImageDemo/"]
COPY ["SixLabors.ImageSharp.WebEx/SixLabors.ImageSharp.WebEx.csproj", "SixLabors.ImageSharp.WebEx/"]
RUN dotnet restore "TLZ.COM.NetCore.View.ImageSharpImageDemo/TLZ.COM.NetCore.View.ImageSharpImageDemo.csproj"
COPY . .
WORKDIR "/src/TLZ.COM.NetCore.View.ImageSharpImageDemo"
RUN dotnet build "TLZ.COM.NetCore.View.ImageSharpImageDemo.csproj" -c Release -o /app/build FROM build AS publish
RUN dotnet publish "TLZ.COM.NetCore.View.ImageSharpImageDemo.csproj" -c Release -o /app/publish FROM base AS final
WORKDIR /app
VOLUME /app/wwwroot/image-cache
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "TLZ.COM.NetCore.View.ImageSharpImageDemo.dll"]
TLZ.COM.NetCore.View.ImageSharpImageDemo(DockerFile)
TLZ.COM.NetCore.View.SSODemo(DockerFile)
FROM dotnet/core/aspnet:3.1-buster-slim AS base
WORKDIR /app
EXPOSE FROM dotnet/core/sdk:3.1-buster AS build
WORKDIR /src
COPY ["TLZ.COM.NetCore.View.SSODemo/TLZ.COM.NetCore.View.SSODemo.csproj", "TLZ.COM.NetCore.View.SSODemo/"]
COPY ["TLZ.DapperEx/TLZ.DapperEx.csproj", "TLZ.DapperEx/"]
COPY ["TLZ.ExpressionToSql/TLZ.ExpressionToSql.csproj", "TLZ.ExpressionToSql/"]
COPY ["TLZ.WebMvc/TLZ.WebMvc.csproj", "TLZ.WebMvc/"]
COPY ["TLZ.Web/TLZ.Web.csproj", "TLZ.Web/"]
COPY ["TLZ.Helper/TLZ.Helper.csproj", "TLZ.Helper/"]
COPY ["TLZ.Model/TLZ.Model.csproj", "TLZ.Model/"]
COPY ["TLZ.COM.Module.WebSite.Enum/TLZ.COM.Module.WebSite.Enum.csproj", "TLZ.COM.Module.WebSite.Enum/"]
COPY ["TLZ.QrCodeEx/TLZ.QrCodeEx.csproj", "TLZ.QrCodeEx/"]
COPY ["TLZ.COM.DB.Entity/TLZ.COM.DB.Entity.csproj", "TLZ.COM.DB.Entity/"]
COPY ["TLZ.COM.DB.SqlServerDAL/TLZ.COM.DB.SqlServerDAL.csproj", "TLZ.COM.DB.SqlServerDAL/"]
COPY ["TLZ.DBCore/TLZ.DBCore.csproj", "TLZ.DBCore/"]
COPY ["TLZ.COM.DB.IDAL/TLZ.COM.DB.IDAL.csproj", "TLZ.COM.DB.IDAL/"]
COPY ["TLZ.Redis/TLZ.Redis.csproj", "TLZ.Redis/"]
COPY ["TLZ.COM.DB.BLL/TLZ.COM.DB.BLL.csproj", "TLZ.COM.DB.BLL/"]
COPY ["TLZ.SSO/TLZ.SSO.csproj", "TLZ.SSO/"]
COPY ["TLZ.COM.DB.BIZ/TLZ.COM.DB.BIZ.csproj", "TLZ.COM.DB.BIZ/"]
COPY ["TLZ.CacheManager/TLZ.CacheManager.csproj", "TLZ.CacheManager/"]
COPY ["TLZ.CacheCore/TLZ.CacheCore.csproj", "TLZ.CacheCore/"]
COPY ["TLZ.COM.DB.MySqlDAL/TLZ.COM.DB.MySqlDAL.csproj", "TLZ.COM.DB.MySqlDAL/"]
COPY ["TLZ.COM.DB.DataFilter/TLZ.COM.DB.DataFilter.csproj", "TLZ.COM.DB.DataFilter/"]
COPY ["TLZ.FilterExpression/TLZ.FilterExpression.csproj", "TLZ.FilterExpression/"]
RUN dotnet restore "TLZ.COM.NetCore.View.SSODemo/TLZ.COM.NetCore.View.SSODemo.csproj"
COPY . .
WORKDIR "/src/TLZ.COM.NetCore.View.SSODemo"
RUN dotnet build "TLZ.COM.NetCore.View.SSODemo.csproj" -c Release -o /app/build FROM build AS publish
RUN dotnet publish "TLZ.COM.NetCore.View.SSODemo.csproj" -c Release -o /app/publish FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
RUN sed -i 's/TLSv1.2/TLSv1.0/g' /etc/ssl/openssl.cnf
ENTRYPOINT ["dotnet", "TLZ.COM.NetCore.View.SSODemo.dll", "--environment=Docker"]
TLZ.COM.NetCore.View.SSODemo(DockerFile)
-----------------------------------------------------
.gitlab-ci.yml(java&springmvc)
stages:
- pull
- build
- deploy pull_job:
stage: pull
script:
- echo "Restoring Git..."
- cd /data/git/run/com.common
- git pull
- cd /data/git/run/com.sem.sdk
- git pull
- cd /data/git/run/com.sem.db
- git pull
- cd /data/git/run/com.sem.api
- git pull build_job:
stage: build
script:
- echo "Maven build..."
- cd /data/git/run/com.common/com.common.bus
- mvn clean install
- cd /data/git/run/com.sem.sdk/com.sem.sdk.bus
- mvn clean install
- cd /data/git/run/com.sem.api/com.sem.api.bus
- mvn clean install
- cd /data/git/run/com.sem.db/com.sem.db.bus
- mvn clean install
- cd $CI_PROJECT_DIR/com.sem.view.market
- mvn clean package
- cp $CI_PROJECT_DIR/com.sem.view.market/target/com.sem.view.market-1.0..war /data/war/com.sem.view.market.war
only:
- master deploy_job:
stage: deploy
script:
- echo "重启 Tomcat..."
- setsid '/root/restart.sh' #直接从CI作业开始的任何进程都将在作业结束时终止https://gitlab.com/gitlab-org/gitlab-runner/issues/2231
only:
- master
.gitlab-ci.yml(java&springmvc)
/root/restart.sh
#!/bin/bash
/data/tomcat/bin/shutdown.sh
for PID in `ps -ef |grep tomcat|grep -v grep|awk '{print $2}'`; do kill - $PID; done
/data/tomcat/bin/startup.sh
/root/restart.sh
tomcat server.xml
<?xml version='1.0' encoding='utf-8'?>
<Server port="" shutdown="SHUTDOWN">
<Listener className="org.apache.catalina.startup.VersionLoggerListener" />
<Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="off" />
<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
<Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" /> <GlobalNamingResources>
<Resource name="UserDatabase" auth="Container"
type="org.apache.catalina.UserDatabase"
description="User database that can be updated and saved"
factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
pathname="conf/tomcat-users.xml" />
</GlobalNamingResources> <Service name="Catalina">
<Connector port="" protocol="org.apache.coyote.http11.Http11AprProtocol"
connectionTimeout=""
maxThreads="" minSpareThreads="" maxSpareThreads=""
maxProcessors="" minProcessors="" acceptCount="" enableLookups="false" URIEncoding="UTF-8"
compression="on" disableUploadTimeout="true" noCompressionUserAgents="gozilla,traviata" useSendfile="false"
compressableMimeType="text/html,text/xml,text/javascript,application/javascript,application/json,text/css,text/plain"
/> <Connector port="" protocol="org.apache.coyote.http11.Http11Protocol"
maxThreads="" SSLEnabled="true" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS" keystoreFile="/data/cert/tomcat.keystore" keystorePass="qwe123"
ciphers="TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,TLS_ECDHE_RSA_WITH_RC4_128_SHA,TLS_RSA_WITH_AES_128_CBC_SHA256,TLS_RSA_WITH_AES_128_CBC_SHA,TLS_RSA_WITH_AES_256_CBC_SHA256,TLS_RSA_WITH_AES_256_CBC_SHA,SSL_RSA_WITH_RC4_128_SHA"
URIEncoding="UTF-8"
/> <Engine name="Catalina" defaultHost="run.tidebuy.net">
<Realm className="org.apache.catalina.realm.LockOutRealm">
<Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/>
</Realm>
<Host name="tomcat.run.tidebuy.net" appBase="webapps" unpackWARs="true" autoDeploy="true"></Host>
<Host name="run.tidebuy.net" appBase="/data/web/com.sem.view.market" unpackWARs="true" autoDeploy="true">
<Alias>run.tidebuy.net</Alias>
<Context path="/" docBase="/data/war/com.sem.view.market.war" privileged="true" antiResourceLocking="false" antiJARLocking="false" crossContext="true" caseSensitive="false" reloadable="false"/>
</Host>
</Engine>
</Service>
</Server>
tomcat server.xml
------------------------------------------------------------------------------
.gitlab-ci.yml(java&springboot&linux&docker-build-run)
stages:
- build
- deploy build_job:
stage: build
image: docker.tidebuy.net/maven:-jdk-
script:
- echo "Maven build..."
- cd $CI_PROJECT_DIR/tb.com.sbmsm.demo/tb.common
- mvn clean install -Dmaven.test.skip=true -s ../../rancher-pipeline/settings.xml
- cd $CI_PROJECT_DIR/tb.com.sbmsm.demo/tb.db
- mvn clean install -Dmaven.test.skip=true -s ../../rancher-pipeline/settings.xml
- cd $CI_PROJECT_DIR/tb.com.sbmsm.demo/tb.view.sbmsm.easyuidemo
- mvn clean package -Dmaven.test.skip=true -s ../../rancher-pipeline/settings.xml
- if [ ! -d "$CI_PROJECT_DIR/publish/springboot" ]; then mkdir -p "$CI_PROJECT_DIR/publish/springboot"; fi
- cp -rf $CI_PROJECT_DIR/tb.com.sbmsm.demo/tb.view.sbmsm.easyuidemo/target/tb.easyuidemo.jar $CI_PROJECT_DIR/publish/springboot/tb.easyuidemo.jar
artifacts:
name: "$CI_JOB_NAME-$CI_COMMIT_REF_NAME"
paths:
- publish/
expire_in: days
only:
- master deploy_job:
stage: deploy
image: "docker:19.03.5"
dependencies:
- build_job
services:
- docker:19.03.-dind
script:
- echo "Release deploy..."
- for PID in `ps -ef |grep tb.easyuidemo.jar|grep -v grep|awk '{print $2}'`;do kill - $PID; done
- cp -rf $CI_PROJECT_DIR/publish/springboot/* /data/web/springboot/deploy/
- cd /data/web/springboot/deploy/
- echo "run deploy..."
- setsid '/data/web/springboot/springboot-run-linux.sh' #直接从CI作业开始的任何进程都将在作业结束时终止https://gitlab.com/gitlab-org/gitlab-runner/issues/2231
- echo "Run docker deploy ..."
- cd $CI_PROJECT_DIR/
- chmod +x docker-compose.sh
- sh docker-compose.sh - echo "Run docker build ..."
- image_version="${CI_APPLICATION_TAG:-${CI_COMMIT_SHA:0:8}}"
- easyui_image="springboot22easyui"
- cd $CI_PROJECT_DIR
- docker build -f rancher-pipeline/Dockerfile
--build-arg APP_PATH="publish/springboot/"
--build-arg MAIN_DLL="tb.easyuidemo.jar"
--build-arg PORT="8090"
--build-arg MAIN_ENV="--spring.profiles.active=docker"
--tag "$easyui_image:$image_version"
--tag "$easyui_image:latest"
. - echo "Run docker run ..."
- for container_id in $(docker ps -a --filter="name=$easyui_image" -q);do docker rm -f $container_id;done
- docker run -d -p 28090:8090 --link heuristic_stallman --network bridge --workdir /app --name $easyui_image $easyui_image:$image_version - exit
only:
- master
when: on_success
.gitlab-ci.yml(java&springboot&linux&docker-build-run)
rancher-pipeline\Dockerfile
from docker.tidebuy.net/openjdk:
WORKDIR app ARG APP_PATH
ARG MAIN_DLL
ARG MAIN_ENV COPY ${APP_PATH} .
ENV MAIN_DLL=${MAIN_DLL}
ENV MAIN_ENV=${MAIN_ENV}
EXPOSE ${PORT} CMD ["sh", "-c","java -jar /app/$MAIN_DLL $MAIN_ENV"]
rancher-pipeline\Dockerfile
rancher-pipeline\settings.xml
<settings>
<mirrors>
<mirror>
<id>rancher</id>
<mirrorOf>*</mirrorOf>
<name>Rancher Repository</name>
<url>http://192.168.0.112/repository/maven-public/</url>
</mirror>
</mirrors>
</settings>
rancher-pipeline\settings.xml
------------------------------------------------------------------------
.gitlab-ci.yml(java&springboot&linux&docker-compose)
stages:
- build
- deploy build_job:
stage: build
script:
- echo "Maven build..."
- cd $CI_PROJECT_DIR/tb.com.sbmsm.demo/tb.common
- mvn clean install -Dmaven.test.skip=true -s ../../rancher-pipeline/settings.xml
- cd $CI_PROJECT_DIR/tb.com.sbmsm.demo/tb.db
- mvn clean install -Dmaven.test.skip=true -s ../../rancher-pipeline/settings.xml
- cd $CI_PROJECT_DIR/tb.com.sbmsm.demo/tb.view.sbmsm.easyuidemo
- mvn clean package -Dmaven.test.skip=true -s ../../rancher-pipeline/settings.xml
- cp $CI_PROJECT_DIR/tb.com.sbmsm.demo/tb.view.sbmsm.easyuidemo/target/tb.easyuidemo.jar /data/web/springboot/publish/tb.easyuidemo.jar
only:
- master deploy_job:
stage: deploy
script:
- echo "Release deploy..."
- for PID in `ps -ef |grep tb.easyuidemo.jar|grep -v grep|awk '{print $2}'`;do kill - $PID; done
- cp -rf /data/web/springboot/publish/* /data/web/springboot/deploy/
- cd /data/web/springboot/deploy/
- echo "run deploy..."
- setsid '/data/web/springboot/springboot-run-linux.sh' #直接从CI作业开始的任何进程都将在作业结束时终止https://gitlab.com/gitlab-org/gitlab-runner/issues/2231
- echo "Run docker deploy ..."
- cd $CI_PROJECT_DIR/
- chmod +x docker-compose.sh
- sh docker-compose.sh
- exit
only:
- master
.gitlab-ci.yml(java&springboot&linux&docker-compose)
/data/web/springboot/springboot-run-linux.sh
nohup java -jar /data/web/springboot/deploy/tb.easyuidemo.jar --spring.profiles.active=sharding >nohup.log >& &
/data/web/springboot/springboot-run-linux.sh
maven_install&package.bat (windows)
cd ./tb.common
call mvn clean install -Dmaven.test.skip=true
cd ../tb.db
call mvn clean install -Dmaven.test.skip=true
cd ../tb.view.sbmsm.easyuidemo
call mvn clean package -Dmaven.test.skip=true
cd ..
echo Success !!! Thank you, Mr.WangYunPeng !!! Good Luck my friend !!!
pause
maven_install&package.bat
docker-compose.yml
version: '3.4'
services:
tb.com.sbmsm.demo:
image: tb.com.sbmsm.demo:1.0
build:
context: ./tb.com.sbmsm.demo
dockerfile: ./tb.view.sbmsm.easyuidemo/Dockerfile
ports:
- :
external_links:
- heuristic_stallman:heuristic_stallman
network_mode: bridge
docker-compose.yml
docker-compose.sh
docker-compose build --no-cache && docker-compose up -d
docker-compose.sh
tb.view.sbmsm.easyuidemo\Dockerfile(DockerFile)
FROM openjdk: AS base
WORKDIR /app
EXPOSE FROM maven:-jdk- AS build
WORKDIR /app
COPY . .
RUN mvn clean install -Dmaven.test.skip=true -f tb.common/pom.xml -s settings.xml; \
mvn clean install -Dmaven.test.skip=true -f tb.db/pom.xml -s settings.xml; \
mvn clean package -Dmaven.test.skip=true -f tb.view.sbmsm.easyuidemo/pom.xml -s settings.xml FROM base AS final
WORKDIR /app
COPY --from=build /app/tb.view.sbmsm.easyuidemo/target/tb.easyuidemo.jar .
ENTRYPOINT ["java", "-jar", "tb.easyuidemo.jar", "--spring.profiles.active=docker"]
tb.view.sbmsm.easyuidemo\Dockerfile(DockerFile)
settings.xml
<settings>
<mirrors>
<mirror>
<id>rancher</id>
<mirrorOf>*</mirrorOf>
<name>Rancher Repository</name>
<url>http://192.168.0.112/repository/maven-public/</url>
</mirror>
</mirrors>
</settings>
settings.xml
gitlab-CI作业-yml的更多相关文章
- 【转】gitlab CI流水线配置文件.gitlab-ci.yml详解
目录 GitLab CI流水线配置文件.gitlab-ci.yml详解 实验环境 GitLab CI介绍 .gitlab-ci.yml 配置参数 参数详解 script image services ...
- Windows 下 docker 部署 gitlab ci
一.安装 1. 安装 docker Docker下载 注意:Windows 10 家庭版获取 之前的版本不能直接安装 Docker ,而是需要去安装 Docker Toolbox 我这里安装的是 Do ...
- 使用 Gitlab CI/CD 实现自动化发布站点到 IIS
说明 这里先介绍下两个东西 CI/CD.GitLab Runner,当然在此之前你需要对 git 有所了解,关于 git 这里不做说明,可以自行百度. 首先介绍 CI/CD :随着我们开发方式的转变, ...
- 【持续集成】GitLab CI + Docker 实现持续集成
GitLab CI + Docker 实现持续集成 一.持续集成(Continuous Integration, CI)的基本概念 概述 在传统软件的开发中,代码的集成工作通常是在所有人都将工作完成后 ...
- GitLab CI/CD的官译【原】
CI / CD方法简介 软件开发的持续集成基于自动执行脚本,以最大限度地减少在开发应用程序时引入错误的可能性.从新代码的开发到部署,它们需要较少的人为干预甚至根本不需要干预. 它涉及在每次小迭代中不断 ...
- 官网GitLab CI/CD英文文档翻译
在查阅GitLab官网的CI/CD功能说明时,全是英文看起来不方便,通过翻译软件自动翻译后"内容失真",看起来很变扭.查阅了百度上的资料发现很多翻译很老旧,有些甚至是挂羊头卖狗肉. ...
- [转]gitlab ci/cd 发布
转自 https://meigit.readthedocs.io/en/latest/configure_gitlab_i18n_and_create_gitlab_ci_with_gitlab_ru ...
- GitLab CI/CD 自动化部署入门
前言:因为找了B站内推,测试开发,正好知道内部使用GitLab做自动化测试,所以简单学了一下,有错误的地方请指正. 入门 初始化 cp: 无法获取'/root/node-v12.9.0-linux-x ...
- GitLab CI持续集成配置方案
目录 1. 持续集成介绍 1.1 概念 1.2 持续集成的好处 2. GitLab持续集成(CI) 2.1 简介 2.2 GitLab简单原理图 2.3 GitLab持续集成所需环境 2.4 需要了解 ...
随机推荐
- 线阵CCD-TCD1209采集系统&驱动设计
关键字:CPLD+AD9945+TCD1209+CY7C68013A TCD1209,一款经典的CCD线阵单色传感器.本次设计一款基于usb2.0高速采集图像. CPLD+AD9945+TCD1209 ...
- 【Vuejs】350- 学习 Vue 源码的必要知识储备
前言 我最近在写 Vue 进阶的内容.在这个过程中,有些人问我看 Vue 源码需要有哪些准备吗?所以也就有了这篇计划之外的文章. 当你想学习 Vue 源码的时候,需要有扎实的 JavaScript 基 ...
- rails 各种分组统计查询
SpecialGroup.group(:special_type).countselect special_type,count(*) from special_groups group by spe ...
- 【Ubuntu 16.04.2_64】安装配置SVN
[Ubuntu 16.04.2_64]安装配置SVN 转载:https://www.cnblogs.com/yangchongxing/p/10190549.html 检查是否已安装svn # svn ...
- django基础之day08,分页器从无到有,动态思路解析全过程
*********分页器从无到有的全过程,动态思路解析如下:******** 1.通过book_queryset = models.Book.objects.all()[start_num:end_n ...
- 计算密集型和 io 密集型项目的使用场景分析和代码演示
from threading import Thread from multiprocessing import Process import time 计算密集型 def work1(): res= ...
- Instrument API介绍
1. Instrumentation介绍 JVMTI(JVM Tool Interface)是 Java 虚拟机所提供的 native 编程接口,是 JVMPI(Java Virtual Machi ...
- Nginx环境搭建与使用
一.背景 之前测试的项目前后端的"路由"(负责把前端发过来的请求转发到相应的后端服务上)要用Nignx来取代原来的tomcat的http server功能,做这个替换的原因是Nig ...
- Navicat Keygen - 注册机是怎么工作的?
Navicat Keygen - 注册机是怎么工作的? 1. 关键词解释. Navicat激活公钥 这是一个2048位的RSA公钥,Navicat使用这个公钥来完成相关激活信息的加密和解密. 这个公钥 ...
- 修改Android源码实现原生应用双开,应用多开
1. 准备 把某系统双开的两个app的信息进行对比 1.1 目录的对比 1.1.1 data目录对比 原应用: /data/user/0/com.luoyesiqiu.crackme/files 被复 ...