-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
96 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,4 +13,4 @@ bin/ | |
out/ | ||
*private.env* | ||
.env | ||
|
||
*.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
backoffice-app/src/main/java/dev/vlaship/backoffice/config/CaffeineCacheConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package dev.vlaship.backoffice.config; | ||
|
||
import com.github.benmanes.caffeine.cache.Caffeine; | ||
import org.springframework.cache.CacheManager; | ||
import org.springframework.cache.annotation.EnableCaching; | ||
import org.springframework.cache.caffeine.CaffeineCacheManager; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
import java.time.Duration; | ||
import java.util.Collection; | ||
import java.util.List; | ||
|
||
@Configuration | ||
@EnableCaching | ||
public class CaffeineCacheConfig { | ||
|
||
@Bean | ||
public CacheManager cacheManager() { | ||
var cacheManager = new CaffeineCacheManager(); | ||
cacheManager.setCaffeine(caffeineCacheBuilder()); | ||
cacheManager.setCacheNames(getCacheNames()); | ||
|
||
cacheManager.registerCustomCache("cacheName1", caffeineCacheBuilder().expireAfterWrite(Duration.ofSeconds(10)).build()); | ||
|
||
return cacheManager; | ||
} | ||
|
||
private Caffeine<Object, Object> caffeineCacheBuilder() { | ||
return Caffeine.newBuilder(); | ||
} | ||
|
||
private Collection<String> getCacheNames() { | ||
return List.of("cacheName1", "cacheName2", "cacheName3"); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
### Build stage | ||
# Builder gradle | ||
FROM gradle:jdk21-alpine AS builder | ||
|
||
# Set the working directory inside the container | ||
WORKDIR /tmp | ||
|
||
# Copy the source code into the container | ||
COPY . . | ||
|
||
# Build | ||
RUN gradle clean backoffice-app:bootJar -x test --no-daemon | ||
|
||
# Copy the source code into the container | ||
COPY backoffice-app/build/libs/backoffice-app.jar app.jar | ||
|
||
# Extract the layers | ||
RUN java -Djarmode=layertools -jar app.jar extract | ||
|
||
### Run stage | ||
# Create a minimal production image | ||
FROM azul/zulu-openjdk-alpine:21-jre-headless | ||
|
||
# Set the working directory inside the container | ||
WORKDIR /app | ||
|
||
# Set the working directory inside the container | ||
COPY --from=builder /tmp/dependencies/ ./ | ||
COPY --from=builder /tmp/snapshot-dependencies/ ./ | ||
COPY --from=builder /tmp/spring-boot-loader/ ./ | ||
COPY --from=builder /tmp/application/ ./ | ||
|
||
# Run the binary when the container starts | ||
ENTRYPOINT ["java", "org.springframework.boot.loader.JarLauncher"] |