From 2a44f2c94fa4768b0aa6fcc8e0681a45fc8f1209 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=E5=98=89=E9=98=B3?= Date: Sun, 18 Aug 2019 15:51:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9A=B4=E9=9C=B2=E5=81=A5=E5=BA=B7=E6=A3=80?= =?UTF-8?q?=E6=9F=A5=E7=AB=AF=E5=8F=A3=EF=BC=8C=E6=B7=BB=E5=8A=A0README.MD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitlab-ci.yml | 15 ++++++++++++--- README.MD | 21 +++++++++++++++++++++ pom.xml | 5 +++++ src/main/resources/application.yml | 7 ++++++- 4 files changed, 44 insertions(+), 4 deletions(-) create mode 100644 README.MD diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 22ab2dc..dbed3c4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,7 +4,11 @@ services: variables: DOCKER_DRIVER: overlay - SPRING_PROFILES_ACTIVE: gitlab-ci + DOCKER_TLS_CERTDIR: "/certs" + IMAGE_VERSION: $CI_COMMIT_TAG + +before_script: + - "echo 构建版本号: ${IMAGE_VERSION}" stages: - build @@ -13,6 +17,8 @@ stages: maven-build: image: maven:3-jdk-8 stage: build + tags: + - 2T script: "mvn package -B" artifacts: paths: @@ -20,7 +26,10 @@ maven-build: docker-build: stage: package + tags: + - 2T script: - - docker build -t $CONTAINER_IMAGE:1.4 . + - docker build -t $CONTAINER_IMAGE:$IMAGE_VERSION . - docker login -u $DOCKER_HUB_USER -p $DOCKER_HUB_PASS - - docker push $CONTAINER_IMAGE:1.4 \ No newline at end of file + - docker push $CONTAINER_IMAGE:$IMAGE_VERSION\ + - docker logout \ No newline at end of file diff --git a/README.MD b/README.MD new file mode 100644 index 0000000..5b7c425 --- /dev/null +++ b/README.MD @@ -0,0 +1,21 @@ +# SpringBoot 测试样板工程 + +## 用途 + +- Docker环境测试 +- CICD测试 +- Java环境测试 +- 端口、端口转发测试 + + + +## 用法 + +默认暴露端口:8080 + +健康检查路径: + +样例接口访问API + + + diff --git a/pom.xml b/pom.xml index f272a1c..d0ba6bf 100644 --- a/pom.xml +++ b/pom.xml @@ -25,6 +25,11 @@ spring-boot-starter-web + + org.springframework.boot + spring-boot-starter-actuator + + org.springframework.boot spring-boot-starter-test diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 47fbb02..58a99f7 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -1,2 +1,7 @@ server: - port: 8080 \ No newline at end of file + port: 8080 +management: + endpoints: + web: + exposure: + include: * \ No newline at end of file