diff --git a/blade-gateway/pom.xml b/blade-gateway/pom.xml index 1d7afdf49..5ac6442d8 100644 --- a/blade-gateway/pom.xml +++ b/blade-gateway/pom.xml @@ -78,18 +78,10 @@ - com.spotify - dockerfile-maven-plugin + io.fabric8 + docker-maven-plugin - ${docker.username} - ${docker.password} - ${docker.registry.url}/${docker.namespace}/${project.artifactId} - ${project.version} - true - - target/${project.build.finalName}.jar - - false + ${docker.fabric.skip} diff --git a/blade-ops/blade-xxljob-admin/pom.xml b/blade-ops/blade-xxljob-admin/pom.xml index d4cc52278..3325066e5 100644 --- a/blade-ops/blade-xxljob-admin/pom.xml +++ b/blade-ops/blade-xxljob-admin/pom.xml @@ -92,18 +92,10 @@ - com.spotify - dockerfile-maven-plugin + io.fabric8 + docker-maven-plugin - ${docker.username} - ${docker.password} - ${docker.registry.url}/${docker.namespace}/${project.artifactId} - ${project.version} - true - - target/${project.build.finalName}.jar - - false + ${docker.fabric.skip} diff --git a/blade-ops/blade-xxljob/pom.xml b/blade-ops/blade-xxljob/pom.xml index b5453ee8f..ffe65ff20 100644 --- a/blade-ops/blade-xxljob/pom.xml +++ b/blade-ops/blade-xxljob/pom.xml @@ -37,18 +37,10 @@ - com.spotify - dockerfile-maven-plugin + io.fabric8 + docker-maven-plugin - ${docker.username} - ${docker.password} - ${docker.registry.url}/${docker.namespace}/${project.artifactId} - ${project.version} - true - - target/${project.build.finalName}.jar - - false + ${docker.fabric.skip} diff --git a/blade-service/blade-demo/pom.xml b/blade-service/blade-demo/pom.xml index 523890a6a..7f0dac8d3 100644 --- a/blade-service/blade-demo/pom.xml +++ b/blade-service/blade-demo/pom.xml @@ -57,18 +57,10 @@ - com.spotify - dockerfile-maven-plugin + io.fabric8 + docker-maven-plugin - ${docker.username} - ${docker.password} - ${docker.registry.url}/${docker.namespace}/${project.artifactId} - ${project.version} - true - - target/${project.build.finalName}.jar - - false + ${docker.fabric.skip} diff --git a/doc/docker/README.md b/doc/docker/README.md index e65faed91..b9d1222ba 100644 --- a/doc/docker/README.md +++ b/doc/docker/README.md @@ -4,9 +4,9 @@ ``` - 192.168.0.157 + 192.168.0.188 admin - Harbor12345 + admin12345 smallchill@163.com @@ -14,13 +14,13 @@ - com.spotify + io.fabric8 ``` ### 2. docker开启远程访问 -如果没有远程访问,会报 `Connect to 192.168.0.157:2375 [/192.168.0.157] failed: Connection refused: connect` +如果没有远程访问,会报 `Connect to 192.168.0.188:2375 [/192.168.0.188] failed: Connection refused: connect` 在`/usr/lib/systemd/system/docker.service`,配置远程访问。主要是在[Service]这个部分,加上下面两个参数: @@ -49,7 +49,7 @@ ExecStart=/usr/bin/dockerd -H tcp://0.0.0.0:2375 -H unix://var/run/docker.sock ``` { "registry-mirrors": ["https://3dse7md.mirror.aliyuncs.com"], - "insecure-registries":["192.168.0.157"] + "insecure-registries":["192.168.0.188"] } ``` @@ -59,18 +59,10 @@ ExecStart=/usr/bin/dockerd -H tcp://0.0.0.0:2375 -H unix://var/run/docker.sock - com.spotify - dockerfile-maven-plugin + io.fabric8 + docker-maven-plugin - ${docker.username} - ${docker.password} - ${docker.registry.url}/${docker.namespace}/${project.artifactId} - ${project.version} - true - - target/${project.build.finalName}.jar - - false + ${docker.fabric.skip} @@ -80,9 +72,9 @@ ExecStart=/usr/bin/dockerd -H tcp://0.0.0.0:2375 -H unix://var/run/docker.sock ### 5. 在每个需要构建子项目的根目录下加入Dockerfile,内容可参考如下 ``` -FROM adoptopenjdk/openjdk8-openj9:alpine-slim +FROM bladex/alpine-java:openjdk8-openj9_cn_slim -MAINTAINER smallchill@163.com +MAINTAINER bladejava@qq.com RUN mkdir -p /blade/gateway @@ -100,10 +92,15 @@ CMD ["--spring.profiles.active=test"] ### 6. 在工程根目录的docker-compose.yml下加入配置,内容可参考如下 ``` blade-gateway: - image: "${REGISTER}/blade/blade-gateway:${TAG}" + image: "${REGISTER}/blade-gateway:${TAG}" ports: - 80:80 networks: blade_net: ipv4_address: 192.168.2.1 ``` + +### 7. 一切配置完毕,采用fabric插件命令执行构建推送: +``` +mvn clean package docker:build docker:push +``` \ No newline at end of file diff --git a/doc/nacos/blade-prod.yaml b/doc/nacos/blade-prod.yaml index 27585df7e..380df7ddb 100644 --- a/doc/nacos/blade-prod.yaml +++ b/doc/nacos/blade-prod.yaml @@ -4,7 +4,7 @@ spring: ##redis 单机环境配置 ##将docker脚本部署的redis服务映射为宿主机ip ##生产环境推荐使用阿里云高可用redis服务并设置密码 - host: 192.168.0.157 + host: 192.168.0.188 port: 3379 password: database: 0 @@ -34,10 +34,10 @@ blade: enabled: false ##将docker脚本部署的redis服务映射为宿主机ip ##生产环境推荐使用阿里云高可用redis服务并设置密码 - address: redis://192.168.0.157:3379 + address: redis://192.168.0.188:3379 #通用开发生产环境数据库地址(特殊情况可在对应的子工程里配置覆盖) datasource: prod: - url: jdbc:mysql://192.168.0.157:3306/bladex?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&allowMultiQueries=true&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true + url: jdbc:mysql://192.168.0.188:3306/bladex?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&allowMultiQueries=true&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true username: root password: root diff --git a/doc/nacos/blade-test.yaml b/doc/nacos/blade-test.yaml index cb0ed5a34..448c5c83e 100644 --- a/doc/nacos/blade-test.yaml +++ b/doc/nacos/blade-test.yaml @@ -3,7 +3,7 @@ spring: redis: ##redis 单机环境配置 ##将docker脚本部署的redis服务映射为宿主机ip - host: 192.168.0.157 + host: 192.168.0.188 port: 3379 password: database: 0 @@ -32,10 +32,10 @@ blade: ##是否启用分布式锁 enabled: false ##将docker脚本部署的redis服务映射为宿主机ip - address: redis://192.168.0.157:3379 + address: redis://192.168.0.188:3379 #通用开发生产环境数据库地址(特殊情况可在对应的子工程里配置覆盖) datasource: test: - url: jdbc:mysql://192.168.0.157:3306/bladex?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&allowMultiQueries=true&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true + url: jdbc:mysql://192.168.0.188:3306/bladex?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&allowMultiQueries=true&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true username: root password: root diff --git a/pom.xml b/pom.xml index c87932ac7..2aa85bd25 100644 --- a/pom.xml +++ b/pom.xml @@ -19,13 +19,13 @@ 6.4.2 2.7.8 - - 192.168.0.157 - http://${docker.registry.url}:2375 + + 192.168.0.188 admin - Harbor12345 + admin12345 blade - 1.4.13 + false + 0.42.0 @@ -121,29 +121,29 @@ - com.spotify - dockerfile-maven-plugin - ${docker.plugin.version} + io.fabric8 + docker-maven-plugin + ${docker.fabric.version} - ${docker.username} - ${docker.password} - ${docker.registry.url}/${docker.namespace}/${project.artifactId} - ${project.version} - true + true + + ${docker.username} + ${docker.password} + + ${docker.registry.url} + + + ${docker.namespace}/${project.build.finalName}:${project.version} + ${project.name} + + ${project.basedir}/Dockerfile + + + - target/${project.build.finalName}.jar + ${basedir}/target/${project.build.finalName}.jar - - org.apache.maven.plugins @@ -168,13 +168,6 @@ - - com.spotify - dockerfile-maven-plugin - - true - - org.springframework.boot spring-boot-maven-plugin diff --git a/script/docker/app/.env b/script/docker/app/.env index 795c1284f..c80e67205 100644 --- a/script/docker/app/.env +++ b/script/docker/app/.env @@ -1,2 +1,2 @@ -REGISTER=192.168.0.157/blade +REGISTER=192.168.0.188/blade TAG=3.1.0.RELEASE