From 85bddfa2766e26bd6318b74ed458ff1914313ba7 Mon Sep 17 00:00:00 2001 From: shikong <919411476@qq.com> Date: Sun, 27 Aug 2023 21:26:31 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=B8=80=E9=94=AE=E6=89=93?= =?UTF-8?q?=E5=8C=85=20docker=20=E8=84=9A=E6=9C=AC=20=E5=AE=8C=E5=96=84=20?= =?UTF-8?q?README.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 27 +++- package-docker.sh | 11 ++ pom.xml | 46 +++--- settings.xml | 366 ++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 425 insertions(+), 25 deletions(-) create mode 100644 package-docker.sh create mode 100644 settings.xml diff --git a/README.md b/README.md index 98f1727..78f77dc 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,27 @@ # gb28181-docking-platform -gb28181 协议 对接平台 -gb28181-docking-platform \ No newline at end of file +gb28181 协议 对接平台 +gb28181-docking-platform + + +### 项目打包 +#### 打包 为 jar +```shell +mvn clean package +``` +打包后jar在 starter/target/starter.jar + +#### 打包 为 docker 镜像 +一键脚本(纯docker环境打包 + 编译) +``` +chmod +x ./package-docker.sh +./package-docker.sh +``` +打包后的 docker镜像文件位于 项目根目录 gb28181-docking-platform.image + +##### 测试运行 +```shell +docker run --name gb28181 --rm \ + -v /mnt/sk-w/run/docker/maven/application.yml:/opt/gb28181-docking-platform/application.yml \ + skcks.cn/gb28181-docking-platform:0.0.1-SNAPSHOT +``` diff --git a/package-docker.sh b/package-docker.sh new file mode 100644 index 0000000..19e487f --- /dev/null +++ b/package-docker.sh @@ -0,0 +1,11 @@ +#!/bin/bash +docker run --name maven --rm \ + -v /mnt/sk-w/run/src/gb28181-docking-platform:/usr/src/mymaven \ + -v /mnt/sk-w/run/docker/maven/repository:/root/.m2/repository \ + -v /mnt/sk-w/run/docker/maven/settings.xml:/usr/share/maven/ref/settings.xml \ + -v /etc/docker/daemon.json:/etc/docker/daemon.json -v /var/run/docker.sock:/var/run/docker.sock -v /usr/bin/docker:/usr/bin/docker \ + -w /usr/src/mymaven \ + maven:3.9.3-eclipse-temurin-17 \ + mvn clean package -DskipTests -Pdocker +docker save skcks.cn/gb28181-docking-platform -o gb28181.docking.platform.image +ls -lh *.image diff --git a/pom.xml b/pom.xml index 0db4e25..b732156 100644 --- a/pom.xml +++ b/pom.xml @@ -178,29 +178,6 @@ - - com.spotify - dockerfile-maven-plugin - ${docker.maven.plugin.version} - - - default - - build - push - - - - - ${skip.docker} - skcks.cn/gb28181-docking-platform - ${project.version} - - ${project.build.finalName}.jar - - - - org.mybatis.generator mybatis-generator-maven-plugin @@ -229,6 +206,29 @@ + + + com.spotify + dockerfile-maven-plugin + ${docker.maven.plugin.version} + + + default + + build + push + + + + + ${skip.docker} + skcks.cn/gb28181-docking-platform + ${project.version} + + ${project.build.finalName}.jar + + + diff --git a/settings.xml b/settings.xml new file mode 100644 index 0000000..ad0bf9b --- /dev/null +++ b/settings.xml @@ -0,0 +1,366 @@ + + + + + + + + ${user.home}/.m2/repository + + + + + + + + + + + + + + + + + + + + + + + + + + + maven + * + maven + https://repo1.maven.org/maven2/ + + + alimaven + aliyun maven + http://maven.aliyun.com/nexus/content/groups/public/ + central + + + + nexus-163 + * + Nexus 163 + http://mirrors.163.com/maven/repository/maven-public/ + + + + nexus-tencentyun + * + Nexus tencentyun + http://mirrors.cloud.tencent.com/nexus/repository/maven-public/ + + + + CN + OSChina Central + http://maven.oschina.net/content/groups/public/ + central + + + + repo2 + central + Human Readable Name for this Mirror. + http://repo2.maven.org/maven2/ + + + + net-cn + central + Human Readable Name for this Mirror. + http://maven.net.cn/content/groups/public/ + + + + ui + central + Human Readable Name for this Mirror. + http://uk.maven.org/maven2/ + + + + ibiblio + central + Human Readable Name for this Mirror. + http://mirrors.ibiblio.org/pub/mirrors/maven2/ + + + + jboss-public-repository-group + central + JBoss Public Repository Group + http://repository.jboss.org/nexus/content/groups/public + + + + JBossJBPM + central + JBossJBPM Repository + https://repository.jboss.org/nexus/content/repositories/releases/ + + + + antelink + central + antelink Repository + http://maven.antelink.com/content/repositories/central/ + + + + openkoala + central + openkoala Repository + http://nexus.openkoala.org/nexus/content/groups/Koala-release/ + + + + tmatesoft + central + tmatesoft Repository + http://maven.tmatesoft.com/content/groups/public/ + + + + mavensync + central + mavensync Repository + http://mavensync.zkoss.org/maven2/ + + + + maven-default-http-blocker + external:http:* + Pseudo repository to mirror external repositories initially using HTTP. + http://0.0.0.0/ + true + + + + + + + + + + + \ No newline at end of file