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