持续集成之.gitlab-ci.yml文件样例

gitlab-ci.yml文件样例

stages:

  • build
  • push
  • run
  • clear

build:
stage: build
script:
- cd /usr/local/app/
- /usr/local/maven/bin/mvn clean
- cp ./target/*.jar /usr/local/docker/
- cp /usr/local/app/docker/Dockerfile /usr/local/docker/
- cd /usr/local/docker/
- docker build -t 192.168.88.133:server-eureka .

push:
stage: push
script:
- docker push 92.168.88.133:server-eureka

run:
stage: run
script:
- cp /usr/local/app/docker/docker-compose.yml /usr/local/docker/compose/
- cd /usr/local/docker/compose/
- docker-compse down
- docker-compose up -d

clear:
stage: clear
script:
- docker rmi $(docker images -q -f dangling=true)

样例说明:本样例为gitlab-ci.yml文件样例,其中包含四个步骤
1、构建jar包
2、推送jar到私服
3、运行jar包
4、清理虚悬镜像

你可能感兴趣的:(持续集成之.gitlab-ci.yml文件样例)