Skip to content

Commit 8751fcd

Browse files
committed
PR feedback
- use metadata/IMAGE_VERSION as source of truth, also read it in fewer places - use lazy-initialization in eureka to improve start time
1 parent 4ef8013 commit 8751fcd

File tree

8 files changed

+18
-24
lines changed

8 files changed

+18
-24
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ See [Common Tasks](https://github.com/SteeltoeOSS/Samples/blob/main/CommonTasks.
2727
| [steeltoe.azurecr.io/config-server](config-server/) | Spring Cloud Config Server |
2828
| [steeltoe.azurecr.io/eureka-server](eureka-server/) | Netflix Eureka Server |
2929
| [steeltoe.azurecr.io/spring-boot-admin](spring-boot-admin/) | Spring Boot Admin |
30-
| [steeltoe.azurecr.io/uaa-server](uaa-server/) | CloudFoundry UAA Server |
30+
| [steeltoe.azurecr.io/uaa-server](uaa-server/) | Cloud Foundry UAA Server |
3131

3232
## Debug Image Building
3333

native-build.sh renamed to build-with-gradle.sh

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,37 @@
11
#!/bin/bash
22

33
# This script essentially does what ./build.ps1 + the dockerfiles do, but without building container images.
4-
# Use this script if you need to troubleshoot or do something new with the servers that get embedded in the images
4+
# Use this script if you need to troubleshoot or do something new with the servers that get embedded in the images.
55

66
if [ "$#" -eq 0 ]
77
then
88
echo "You must specify the server to build. Supported options include config-server, eureka-server and spring-boot-admin."
99
exit 1
1010
fi
1111

12-
JVM="21"
13-
bootVersion="3.5.6"
14-
1512
if [ "$1" == "config-server" ]; then
1613
appName="ConfigServer"
17-
serverVersion="4.3.0"
1814
dependencies="cloud-config-server,actuator,cloud-eureka,security"
1915
elif [ "$1" == "eureka-server" ]; then
2016
appName="EurekaServer"
21-
serverVersion="4.3.0"
2217
dependencies="cloud-eureka-server,actuator"
2318
elif [ "$1" == "spring-boot-admin" ]; then
2419
appName="SpringBootAdmin"
25-
serverVersion="3.5.5"
2620
dependencies="codecentric-spring-boot-admin-server"
2721
else
2822
echo "$1 is not currently supported by this script"
2923
exit 2
3024
fi
25+
3126
sourceDirectory=$1
3227
serverName=${sourceDirectory//-/}
3328
tempDir="$serverName-temp"
29+
JVM="21"
30+
bootVersion="3.5.6"
31+
serverVersion="$(cat $sourceDirectory/metadata/IMAGE_VERSION)"
32+
33+
echo "From source: $sourceDirectory | Building server: $serverName@$serverVersion | In temp directory: $tempDir"
3434

35-
echo "Source: $sourceDirectory | Server: $serverName | TempDir: $tempDir"
3635
rm -rf $tempDir
3736
mkdir $tempDir
3837
cd $tempDir
@@ -61,8 +60,8 @@ for patch in patches/*.patch; do \
6160
cd ..; \
6261
done
6362

64-
$serverName/gradlew bootJar --project-dir $serverName
65-
mkdir output
66-
cp $serverName/build/libs/$serverName-$(cat metadata/IMAGE_VERSION).jar output/$serverName.jar
63+
cd $serverName
64+
./gradlew bootBuildImage --imageName="steeltoe.azurecr.io/$sourceDirectory:$serverVersion"
65+
cd ..
6766

6867
cd ..

build.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,6 @@ else
126126
Write-Host "Tag value set by script parameter:" $Tag
127127
}
128128

129-
$docker_command = "docker build $Tag $ImageDirectory"
129+
$docker_command = "docker build $Tag $ImageDirectory --build-arg SERVER_VERSION=$Version"
130130
Write-Host $docker_command
131131
Invoke-Expression $docker_command

config-server/Dockerfile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
# -----------------------------------------------------------------------------
44
ARG JVM=21
55
ARG BOOT_VERSION=3.5.6
6-
# When changing, make sure this aligns with metadata/IMAGE_VERSION
7-
ARG SERVER_VERSION=4.3.0
86

97
FROM eclipse-temurin:$JVM-alpine AS build
108
ARG JVM
@@ -34,7 +32,7 @@ RUN for patch in patches/*.patch; do \
3432
done
3533
RUN configserver/gradlew bootJar --project-dir configserver --no-daemon
3634
RUN mkdir output && \
37-
cp "configserver/build/libs/configserver-$(cat metadata/IMAGE_VERSION).jar" output/configserver.jar && \
35+
cp "configserver/build/libs/configserver-$SERVER_VERSION.jar" output/configserver.jar && \
3836
cp configserver/src/main/resources/application.properties output/application.properties
3937

4038
# -----------------------------------------------------------------------------

eureka-server/Dockerfile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
# -----------------------------------------------------------------------------
44
ARG JVM=21
55
ARG BOOT_VERSION=3.5.6
6-
# When changing, make sure this aligns with metadata/IMAGE_VERSION
7-
ARG SERVER_VERSION=4.3.0
86

97
FROM eclipse-temurin:$JVM-alpine AS build
108
ARG JVM
@@ -34,7 +32,7 @@ RUN for patch in patches/*.patch; do \
3432
done
3533
RUN eurekaserver/gradlew bootJar --project-dir eurekaserver --no-daemon
3634
RUN mkdir output && \
37-
cp "eurekaserver/build/libs/eurekaserver-$(cat metadata/IMAGE_VERSION).jar" output/eurekaserver.jar
35+
cp "eurekaserver/build/libs/eurekaserver-$SERVER_VERSION.jar" output/eurekaserver.jar
3836

3937
# -----------------------------------------------------------------------------
4038
# Netflix Eureka Server Linux Image
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
--- eurekaserver/src/main/resources/application.properties 2024-02-21 15:43:09.000000000 -0600
22
+++ eurekaserver/src/main/resources/application.properties 2024-04-02 13:15:18.461432100 -0500
3-
@@ -0,0 +1,8 @@
3+
@@ -0,0 +1,9 @@
44
+server.port = 8761
55
+eureka.client.fetch-registry = false
66
+eureka.client.register-with-eureka = false
@@ -9,3 +9,4 @@
99
+eureka.server.responseCacheUpdateIntervalMs = 1000
1010
+eureka.server.wait-time-in-ms-when-sync-empty = 0
1111
+logging.level.com.netflix.eureka = TRACE
12+
+spring.main.lazy-initialization = true

spring-boot-admin/Dockerfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
# -----------------------------------------------------------------------------
44
ARG JVM=21
55
ARG BOOT_VERSION=3.5.6
6-
# When changing, make sure this aligns with metadata/IMAGE_VERSION
7-
ARG SERVER_VERSION=3.5.5
86

97
FROM eclipse-temurin:$JVM-alpine AS build
108
ARG JVM

uaa-server/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# -----------------------------------------------------------------------------
22
# UAA Server Build
33
# -----------------------------------------------------------------------------
4-
5-
FROM cfidentity/uaa:v78.3.0
4+
ARG SERVER_VERSION
5+
FROM cfidentity/uaa:v${SERVER_VERSION}
66
COPY uaa.yml /uaa/uaa.yml
77
COPY log4j2.properties /uaa/log4j2.properties
88
ENV CLOUDFOUNDRY_CONFIG_PATH=/uaa

0 commit comments

Comments
 (0)