Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Docker+jenkins+gitlab+dockerfile deployment configuration method

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article introduces the relevant knowledge of "docker+jenkins+gitlab+dockerfile deployment configuration method". Many people will encounter such a dilemma in the operation of actual cases, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Step 1: docker+jenkins+gitlab automated deployment configuration, not to mention here, please see my other article

Step 2: pom.xml and Dockerfile configuration content

Pom.xml

${project.artifactId}-${project.version} org.springframework.boot spring-boot-maven-plugin com.spotify docker-maven-plugin 1.0.0 ${project.artifactId}-${project.version} ${project.basedir} / src/main/resources ${project.version} http:// your ip : 2375 http:// your ip:5000 false your ip:5000/$ {project.artifactId}: ${project.version} / ${project.build.directory} ${project.artifactId}-${project.version} .jar

/ content of src/main/resourcesDockerfile

FROM java:8ENV project bdkt-eurekaENV version 1.0-RELEASEENV home_path/ homeWORKDIR $home_pathADD / $project-$version.jar $home_path/$project.jarENTRYPOINT ["java", "- jar", "bdkt-eureka.jar"]

FROM java:8 depends on jdk

ENV project bdkt-eureka environment variable key value

ENV version 1.0-RELEASE

ENV home_path / home

The working directory specified by WORKDIR $home_path

ADD / $project-$version.jar $home_path/$project.jar replication function

ENTRYPOINT ["java", "- jar", "bdkt-eureka.jar"] is the equivalent of java-jar bdkt-eureka.jar. This command is to concatenate the contents of several commas with spaces.

Step 3: build the configuration required in the task

Pre Steps 1

Bdkt-parent/bdkt-basics/bdkt-eureka/pom.xmlclean install

Pre Steps 2

The content is:

#! / bin/bash# image name the name of the image launched by image_name=47.111.115.253:5000/bdkt-eureka#: run_image_name=bdkt-eureka# version version=1.0-RELEASEresult=$ (docker ps | grep "$run_image_name") if [["$result"! = ""]] thenecho "stop $run_image_name" docker stop $run_image_namefiresult1=$ (docker ps-a | grep "$run_image_name") if [["$result1"! = ""] thenecho "rm $run_image_name" docker rm $run_image_namefiresult2=$ (docker images | grep "$image_name") if [["$result2"! = ""] thenecho "rmi $image_name:$version" docker rmi $image_name:$versionfi

Pre Steps 3

The content is:

Clean package-f bdkt-parent/bdkt-basics/bdkt-eureka/pom.xml-DskipTests docker:build

Pre Steps 3

The content is:

Ssh site is self-configured. Take a look at my previous article in detail.

This is the end of docker run-name bdkt-eureka-p 8100 idt 47.111.115.253:5000/bdkt-eureka:1.0-RELEASEdocker logs bdkt-eureka "docker+jenkins+gitlab+dockerfile deployment configuration method". Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report