|
|
|
@ -4,9 +4,9 @@
|
|
|
|
|
``` |
|
|
|
|
<servers> |
|
|
|
|
<server> |
|
|
|
|
<id>192.168.0.157</id> |
|
|
|
|
<id>192.168.0.188</id> |
|
|
|
|
<username>admin</username> |
|
|
|
|
<password>Harbor12345</password> |
|
|
|
|
<password>admin12345</password> |
|
|
|
|
<configuration> |
|
|
|
|
<email>smallchill@163.com</email> |
|
|
|
|
</configuration> |
|
|
|
@ -14,13 +14,13 @@
|
|
|
|
|
</servers> |
|
|
|
|
|
|
|
|
|
<pluginGroups> |
|
|
|
|
<pluginGroup>com.spotify</pluginGroup> |
|
|
|
|
<pluginGroup>io.fabric8</pluginGroup> |
|
|
|
|
</pluginGroups> |
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
### 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
|
|
|
|
|
<build> |
|
|
|
|
<plugins> |
|
|
|
|
<plugin> |
|
|
|
|
<groupId>com.spotify</groupId> |
|
|
|
|
<artifactId>dockerfile-maven-plugin</artifactId> |
|
|
|
|
<groupId>io.fabric8</groupId> |
|
|
|
|
<artifactId>docker-maven-plugin</artifactId> |
|
|
|
|
<configuration> |
|
|
|
|
<username>${docker.username}</username> |
|
|
|
|
<password>${docker.password}</password> |
|
|
|
|
<repository>${docker.registry.url}/${docker.namespace}/${project.artifactId}</repository> |
|
|
|
|
<tag>${project.version}</tag> |
|
|
|
|
<useMavenSettingsForAuth>true</useMavenSettingsForAuth> |
|
|
|
|
<buildArgs> |
|
|
|
|
<JAR_FILE>target/${project.build.finalName}.jar</JAR_FILE> |
|
|
|
|
</buildArgs> |
|
|
|
|
<skip>false</skip> |
|
|
|
|
<skip>${docker.fabric.skip}</skip> |
|
|
|
|
</configuration> |
|
|
|
|
</plugin> |
|
|
|
|
</plugins> |
|
|
|
@ -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 |
|
|
|
|
``` |