Skip to content

Commit f5c8d6d

Browse files
committed
fixed image
1 parent b849ad7 commit f5c8d6d

File tree

2 files changed

+50
-2
lines changed

2 files changed

+50
-2
lines changed

demo/docker-build-config/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
<name>${project.artifactId}:${project.version}</name>
4343
<alias>${project.artifactId}</alias>
4444
<build>
45-
<from>eclipse-temurin:8-jdk-alpine</from>
45+
<from>openjdk8</from>
4646
<ports>
4747
<port>7070</port>
4848
<port>8080</port>

demo/docker-run-config/pom.xml

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
<run>
6363
<env>
6464
<JAVA_OPTS>
65-
-Dservicecomb.service.registry.address=http://sc.servicecomb.io:30100
65+
-Dservicecomb.service.registry.address=http://sc.servicecomb.io:30100 -Dservicecomb.service.publishAddress=${docker.hostname}
6666
</JAVA_OPTS>
6767
<JAR_PATH>/maven/maven/${demo.service.name}-${project.version}.jar</JAR_PATH>
6868
</env>
@@ -121,10 +121,34 @@
121121
<id>docker</id>
122122
<build>
123123
<plugins>
124+
<plugin>
125+
<groupId>org.codehaus.gmavenplus</groupId>
126+
<artifactId>gmavenplus-plugin</artifactId>
127+
<executions>
128+
<execution>
129+
<id>add-default-properties</id>
130+
<phase>initialize</phase>
131+
<goals>
132+
<goal>execute</goal>
133+
</goals>
134+
<configuration>
135+
<scripts>
136+
<script>
137+
project.properties.setProperty('docker.hostname', 'localhost')
138+
log.info("Docker hostname is " + project.properties['docker.hostname'])
139+
</script>
140+
</scripts>
141+
</configuration>
142+
</execution>
143+
</executions>
144+
</plugin>
124145
<plugin>
125146
<groupId>org.apache.maven.plugins</groupId>
126147
<artifactId>maven-failsafe-plugin</artifactId>
127148
<configuration>
149+
<systemPropertyVariables>
150+
<servicecomb.service.registry.address>http://${docker.hostname}:30100</servicecomb.service.registry.address>
151+
</systemPropertyVariables>
128152
<argLine>${jacoco.failsafe.argLine}</argLine>
129153
</configuration>
130154
<executions>
@@ -143,6 +167,30 @@
143167
<id>docker-machine</id>
144168
<build>
145169
<plugins>
170+
<plugin>
171+
<groupId>org.codehaus.gmavenplus</groupId>
172+
<artifactId>gmavenplus-plugin</artifactId>
173+
<executions>
174+
<execution>
175+
<id>add-dynamic-properties</id>
176+
<phase>prepare-package</phase>
177+
<goals>
178+
<goal>execute</goal>
179+
</goals>
180+
<configuration>
181+
<scripts>
182+
<script>
183+
def process = "docker-machine ip default".execute()
184+
process.waitFor()
185+
project.properties.setProperty('docker.hostname', process.in.text.trim())
186+
187+
log.info("Docker hostname is " + project.properties['docker.hostname'])
188+
</script>
189+
</scripts>
190+
</configuration>
191+
</execution>
192+
</executions>
193+
</plugin>
146194
</plugins>
147195
</build>
148196
</profile>

0 commit comments

Comments
 (0)