Skip to content

Commit 8c1d83d

Browse files
committed
Fix Docker build: use *-all.jar pattern for shadowJar, revert lazy Firestore
1 parent 32431aa commit 8c1d83d

File tree

2 files changed

+6
-17
lines changed

2 files changed

+6
-17
lines changed

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ RUN /workspace/gradlew -x test shadowJar --no-daemon
2020
FROM eclipse-temurin:17-jre
2121
WORKDIR /app
2222

23-
# Copy application JAR
24-
COPY --from=build /workspace/build/libs/*.jar /app/app.jar
23+
# Copy application JAR (shadow/fat JAR only)
24+
COPY --from=build /workspace/build/libs/*-all.jar /app/app.jar
2525

2626
# Copy classpath resources (including static assets) alongside the JAR
2727
COPY --from=build /workspace/src/main/resources/ /app/resources/

src/main/kotlin/Application.kt

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -36,23 +36,12 @@ fun Application.module() {
3636
appConfig.port
3737
)
3838

39-
// Lazy initialization: Firestore connects on first use, not at startup
40-
val firestoreLazy = lazy {
41-
try {
42-
FirestoreProvider.create(appConfig)
43-
} catch (e: Exception) {
44-
log.error("Failed to initialize Firestore - some features may be unavailable", e)
45-
throw e
46-
}
47-
}
48-
val firestore by firestoreLazy
49-
val portfolioMetaService by lazy { PortfolioMetaService(PortfolioMetaRepository(firestore)) }
39+
val firestore = FirestoreProvider.create(appConfig)
40+
val portfolioMetaService = PortfolioMetaService(PortfolioMetaRepository(firestore))
5041

5142
environment.monitor.subscribe(ApplicationStopped) {
52-
if (firestoreLazy.isInitialized()) {
53-
runCatching { firestore.close() }
54-
.onFailure { throwable -> log.warn("Failed to close Firestore", throwable) }
55-
}
43+
runCatching { firestore.close() }
44+
.onFailure { throwable -> log.warn("Failed to close Firestore", throwable) }
5645
}
5746

5847
install(DefaultHeaders)

0 commit comments

Comments
 (0)