test
This commit is contained in:
parent
d6954da174
commit
f75b86833a
|
@ -0,0 +1,24 @@
|
|||
kind: pipeline
|
||||
name: maven项目-镜像仓库
|
||||
|
||||
steps:
|
||||
- name: Maven编译
|
||||
image: maven:3-jdk-10
|
||||
commands:
|
||||
- mvn install
|
||||
|
||||
- name: 执行-部署脚本
|
||||
image: docker:dind
|
||||
volumes:
|
||||
- name: dockersock
|
||||
path: /var/run/docker.sock
|
||||
commands:
|
||||
- docker ps
|
||||
- chmod +x ./deploy.sh
|
||||
- ./deploy.sh
|
||||
|
||||
|
||||
volumes:
|
||||
- name: dockersock
|
||||
host:
|
||||
path: /var/run/docker.sock
|
|
@ -1,13 +1,24 @@
|
|||
kind: pipeline
|
||||
name: default
|
||||
name: maven项目-镜像仓库
|
||||
|
||||
platform:
|
||||
os: linux
|
||||
arch: arm64
|
||||
steps:
|
||||
- name: Maven编译
|
||||
image: maven:3-jdk-10
|
||||
commands:
|
||||
- mvn install
|
||||
|
||||
steps:
|
||||
- name: test
|
||||
image: maven:3-jdk-10
|
||||
commands:
|
||||
- mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V
|
||||
- mvn test -B
|
||||
- name: 执行-部署脚本
|
||||
image: docker:dind
|
||||
volumes:
|
||||
- name: dockersock
|
||||
path: /var/run/docker.sock
|
||||
commands:
|
||||
- docker ps
|
||||
- chmod +x ./deploy.sh
|
||||
- ./deploy.sh
|
||||
|
||||
|
||||
volumes:
|
||||
- name: dockersock
|
||||
host:
|
||||
path: /var/run/docker.sock
|
|
@ -0,0 +1,10 @@
|
|||
|
||||
#添加docker镜像
|
||||
FROM tomcat
|
||||
|
||||
#添加作者信息
|
||||
MAINTAINER moshenglv@163.com
|
||||
|
||||
#复制应用程序
|
||||
COPY target/demo-1.war /usr/local/tomcat/webapps/demo.war
|
||||
|
21
README.md
21
README.md
|
@ -1,20 +1,3 @@
|
|||
#### 从命令行创建一个新的仓库
|
||||
|
||||
```bash
|
||||
touch README.md
|
||||
git init
|
||||
git add README.md
|
||||
git commit -m "first commit"
|
||||
git remote add origin http://testgitea2.trustie.net/cxt/devops-test.git
|
||||
git push -u origin master
|
||||
|
||||
```
|
||||
|
||||
#### 从命令行推送已经创建的仓库
|
||||
|
||||
```bash
|
||||
git remote add origin http://testgitea2.trustie.net/cxt/devops-test.git
|
||||
git push -u origin master
|
||||
|
||||
```
|
||||
# MyTest
|
||||
|
||||
test
|
|
@ -0,0 +1,6 @@
|
|||
echo ====暂停容器开始=======
|
||||
docker rm -f devops-test
|
||||
echo ====开始部署=======
|
||||
docker build -t devops-test:1.0 .
|
||||
docker run -d -p 8080:8080 --name devops-test devops-test:1.0
|
||||
echo ====部署成功======
|
|
@ -0,0 +1,37 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>com.example</groupId>
|
||||
<artifactId>demo</artifactId>
|
||||
<version>1</version>
|
||||
<name>demo</name>
|
||||
<packaging>war</packaging>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<junit.version>5.6.2</junit.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>javax.servlet-api</artifactId>
|
||||
<version>4.0.1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-war-plugin</artifactId>
|
||||
<version>3.3.0</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
|
@ -0,0 +1,7 @@
|
|||
public class Test {
|
||||
|
||||
//测试111112
|
||||
public static void main(String[] args){
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
public class Test {
|
||||
|
||||
//测试111112
|
||||
public static void main(String[] args){
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
package controller;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.annotation.WebServlet;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
|
||||
public class HelloWorld extends HttpServlet {
|
||||
|
||||
private String message;
|
||||
|
||||
@Override
|
||||
public void init() throws ServletException {
|
||||
message = "Hello world, this message is from servlet!";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
|
||||
//设置响应内容类型
|
||||
resp.setContentType("text/html");
|
||||
|
||||
//设置逻辑实现
|
||||
PrintWriter out = resp.getWriter();
|
||||
out.println("<h1>" + message + "</h1>");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
super.destroy();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
|
||||
version="4.0">
|
||||
|
||||
<servlet>
|
||||
<servlet-name>HelloWorld</servlet-name>
|
||||
<servlet-class>controller.HelloWorld</servlet-class>
|
||||
</servlet>
|
||||
<servlet-mapping>
|
||||
<servlet-name>HelloWorld</servlet-name>
|
||||
<url-pattern>/hello</url-pattern>
|
||||
</servlet-mapping>
|
||||
</web-app>
|
Loading…
Reference in New Issue