.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的更多相关文章

  1. 【转】gitlab CI流水线配置文件.gitlab-ci.yml详解

    目录 GitLab CI流水线配置文件.gitlab-ci.yml详解 实验环境 GitLab CI介绍 .gitlab-ci.yml 配置参数 参数详解 script image services ...

  2. Windows 下 docker 部署 gitlab ci

    一.安装 1. 安装 docker Docker下载 注意:Windows 10 家庭版获取 之前的版本不能直接安装 Docker ,而是需要去安装 Docker Toolbox 我这里安装的是 Do ...

  3. 使用 Gitlab CI/CD 实现自动化发布站点到 IIS

    说明 这里先介绍下两个东西 CI/CD.GitLab Runner,当然在此之前你需要对 git 有所了解,关于 git 这里不做说明,可以自行百度. 首先介绍 CI/CD :随着我们开发方式的转变, ...

  4. 【持续集成】GitLab CI + Docker 实现持续集成

    GitLab CI + Docker 实现持续集成 一.持续集成(Continuous Integration, CI)的基本概念 概述 在传统软件的开发中,代码的集成工作通常是在所有人都将工作完成后 ...

  5. GitLab CI/CD的官译【原】

    CI / CD方法简介 软件开发的持续集成基于自动执行脚本,以最大限度地减少在开发应用程序时引入错误的可能性.从新代码的开发到部署,它们需要较少的人为干预甚至根本不需要干预. 它涉及在每次小迭代中不断 ...

  6. 官网GitLab CI/CD英文文档翻译

    在查阅GitLab官网的CI/CD功能说明时,全是英文看起来不方便,通过翻译软件自动翻译后"内容失真",看起来很变扭.查阅了百度上的资料发现很多翻译很老旧,有些甚至是挂羊头卖狗肉. ...

  7. [转]gitlab ci/cd 发布

    转自 https://meigit.readthedocs.io/en/latest/configure_gitlab_i18n_and_create_gitlab_ci_with_gitlab_ru ...

  8. GitLab CI/CD 自动化部署入门

    前言:因为找了B站内推,测试开发,正好知道内部使用GitLab做自动化测试,所以简单学了一下,有错误的地方请指正. 入门 初始化 cp: 无法获取'/root/node-v12.9.0-linux-x ...

  9. GitLab CI持续集成配置方案

    目录 1. 持续集成介绍 1.1 概念 1.2 持续集成的好处 2. GitLab持续集成(CI) 2.1 简介 2.2 GitLab简单原理图 2.3 GitLab持续集成所需环境 2.4 需要了解 ...

随机推荐

  1. Linux-(3)Linux Shell 使用

    三.Linux Shell 3.1 文件管理 3.1.1 ls 命令 显示指定工作目录下的内容及属性信息 ls 命令是Linux下最常用的指令之一.ls命令为英文单词 list 的缩写,正如英文单词 ...

  2. 【React】345- React v16.9 新特性[译]

    今天我们发布了 React 16.9.它包含了一些新特性.bug修复以及新的弃用警告,以便与筹备接下来的主要版本. 一.新弃用 重命名 Unsafe 生命周期方法 一年前,我们宣布 unsafe 生命 ...

  3. 【重温基础】JS中的常用高阶函数介绍

    Ps. 晚上加班到快十点,回来赶紧整理整理这篇文章,今天老大给我推荐了一篇文章,我从写技术博客中收获到了什么?- J_Knight_,感受也是很多,自己也需要慢慢养成记录博客的习惯,即使起步艰难,难以 ...

  4. elasticsearch搜索QueryStringQueryBuilder时的一些问题记录

    首先看下原始数据 但是 如果使用英文查询的时候又和上面有点区别了,感觉还是分词器的问题

  5. 从5个方面让你真正了解Java内存模型

    前言 首先我们在了解java内存模型之前先看一下计算机内存模型,理解了计算机内存模型的话后面在看JMM就会简单的多. 计算机内存 计算机是由CPU.主存.磁盘等组成的(简单引出问题熬)我们都知道计算机 ...

  6. 《MySQL数据库》MySQL数据库安装(windows)

    MySQL安装包和操作工具 链接: https://pan.baidu.com/s/1BTfrHwVR1uNBuB_E27N55g 提取码: dhbv 1.首先解压文件包,我这解压到E:\instal ...

  7. 解决zabbix监控因php问题导致图形界面中文乱码方法

    解决因编译php中添加了-enable-gd-jis-conv选项导致Zabbix监控系统图形界面中文乱码问题 现象: php编译参数: 说明: 如果PHP编译时启用–enable-gd-jis-co ...

  8. Linux Bash之正则表达式

    首先注意:正则表达式与通配符是完全不同的概念.通配符(wildcard)代表的是 Bash 操作接口的一个功能,而正则表达式是一种字符串处理的表示方式,一定要区分开来. 正则表达式(Regular E ...

  9. JS---DOM/BOM---学习road map---7 parts

    JS---DOM/BOM---学习road map---6 parts Part 1-2: Part 3-4 part 5-7:

  10. HCTF_2018-Writeup【web题】

    HCTF_2018-Writeup 赛题来自:BUUCTF By:Mirror王宇阳 WarmUp: 打开赛题的页面源码(F12) <!DOCTYPE html> <html lan ...