Skip to content
This repository was archived by the owner on May 21, 2026. It is now read-only.

Commit b4613e7

Browse files
Refractor: incress ram size
1 parent 7632a2b commit b4613e7

2 files changed

Lines changed: 49 additions & 42 deletions

File tree

docker/Dockerfile.jvm

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
# Multi-stage JVM image (fat executable artifact normalized to app.jar)
2-
FROM eclipse-temurin:21-jdk AS build
3-
WORKDIR /workspace
4-
SHELL ["/bin/bash", "-c"]
5-
COPY . .
6-
# bootJar is disabled in build.gradle, so use `build` to produce WAR (or executable JAR if enabled later)
7-
RUN ./gradlew clean build -x test --no-daemon
8-
RUN set -e; shopt -s nullglob; files=(build/libs/*.[jw]ar); if [ ${#files[@]} -eq 0 ]; then echo "No jar/war produced"; ls -l build/libs; exit 1; fi; preferred=""; for f in "${files[@]}"; do case "$f" in *-plain.*) ;; *) preferred="$f"; break ;; esac; done; if [ -z "$preferred" ]; then preferred="${files[0]}"; fi; echo "Using artifact: $preferred"; cp "$preferred" build/libs/app.jar
9-
10-
FROM eclipse-temurin:21-jre AS run
11-
WORKDIR /app
12-
COPY --from=build /workspace/build/libs/app.jar /app/app.jar
13-
14-
EXPOSE 8080 5005
15-
ENV JAVA_OPTS="-Xms256m -Xmx512m"
16-
# HEALTHCHECK --interval=10s --timeout=5s --retries=5 --start-period=15s \
17-
# CMD curl -f http://localhost:8080/actuator/health || exit 1
18-
ENTRYPOINT ["sh", "-c", "java ${JAVA_OPTS} -jar app.jar"]
1+
# Multi-stage JVM image (fat executable artifact normalized to app.jar)
2+
FROM eclipse-temurin:21-jdk AS build
3+
WORKDIR /workspace
4+
SHELL ["/bin/bash", "-c"]
5+
COPY . .
6+
# bootJar is disabled in build.gradle, so use `build` to produce WAR (or executable JAR if enabled later)
7+
RUN ./gradlew clean build -x test --no-daemon
8+
RUN set -e; shopt -s nullglob; files=(build/libs/*.[jw]ar); if [ ${#files[@]} -eq 0 ]; then echo "No jar/war produced"; ls -l build/libs; exit 1; fi; preferred=""; for f in "${files[@]}"; do case "$f" in *-plain.*) ;; *) preferred="$f"; break ;; esac; done; if [ -z "$preferred" ]; then preferred="${files[0]}"; fi; echo "Using artifact: $preferred"; cp "$preferred" build/libs/app.jar
9+
10+
FROM eclipse-temurin:21-jre AS run
11+
WORKDIR /app
12+
COPY --from=build /workspace/build/libs/app.jar /app/app.jar
13+
14+
EXPOSE 8080 5005
15+
ENV JAVA_OPTS="-XX:InitialRAMPercentage=75.0 -XX:MaxRAMPercentage=75.0 -XX:+UseContainerSupport -XX:+UseSerialGC"
16+
# HEALTHCHECK --interval=10s --timeout=5s --retries=5 --start-period=15s \
17+
# CMD curl -f http://localhost:8080/actuator/health || exit 1
18+
ENTRYPOINT ["sh", "-c", "java ${JAVA_OPTS} -jar app.jar"]

docker/docker-compose.yml

Lines changed: 31 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,31 @@
1-
services:
2-
app-jvm:
3-
build:
4-
context: ..
5-
dockerfile: docker/Dockerfile.jvm
6-
image: espacogeek-jvm:latest
7-
container_name: espacogeek-jvm
8-
environment:
9-
SPRING_DATASOURCE_URL: ${SPRING_DATASOURCE_URL}
10-
SPRING_DATASOURCE_USERNAME: ${SPRING_DATASOURCE_USERNAME}
11-
SPRING_DATASOURCE_PASSWORD: ${SPRING_DATASOURCE_PASSWORD}
12-
JAVA_OPTS: "-Xms256m -Xmx512m"
13-
SPRING_MVC_CORS_ALLOWED_ORIGINS: ${SPRING_MVC_CORS_ALLOWED_ORIGINS:http://localhost:3000}
14-
ALLOWED_ORIGINS: ${ALLOWED_ORIGINS:http://localhost:3000}
15-
SECURITY_JWT_EXPIRATION_MS: ${SECURITY_JWT_EXPIRATION_MS:604800000}
16-
ports:
17-
- "8080:8080"
18-
- "5005:5005"
19-
# healthcheck:
20-
# test: ["CMD", "curl", "-f", "http://localhost:8080/actuator/health"]
21-
# interval: 10s
22-
# timeout: 5s
23-
# retries: 5
24-
# start_period: 15s
1+
services:
2+
app-jvm:
3+
build:
4+
context: ..
5+
dockerfile: docker/Dockerfile.jvm
6+
image: espacogeek-jvm:latest
7+
container_name: espacogeek-jvm
8+
environment:
9+
SPRING_DATASOURCE_URL: ${SPRING_DATASOURCE_URL}
10+
SPRING_DATASOURCE_USERNAME: ${SPRING_DATASOURCE_USERNAME}
11+
SPRING_DATASOURCE_PASSWORD: ${SPRING_DATASOURCE_PASSWORD}
12+
JAVA_OPTS: "-XX:InitialRAMPercentage=75.0 -XX:MaxRAMPercentage=75.0 -XX:+UseSerialGC"
13+
SPRING_MVC_CORS_ALLOWED_ORIGINS: ${SPRING_MVC_CORS_ALLOWED_ORIGINS:http://localhost:3000}
14+
ALLOWED_ORIGINS: ${ALLOWED_ORIGINS:http://localhost:3000}
15+
SECURITY_JWT_EXPIRATION_MS: ${SECURITY_JWT_EXPIRATION_MS:604800000}
16+
ports:
17+
- "8080:8080"
18+
- "5005:5005"
19+
healthcheck:
20+
test: ["CMD", "curl", "-f", "http://localhost:8080/actuator/health"]
21+
interval: 10s
22+
timeout: 5s
23+
retries: 5
24+
start_period: 15s
25+
deploy:
26+
resources:
27+
limits:
28+
cpus: '0.8'
29+
memory: '3500M'
30+
reservations:
31+
memory: 2000M

0 commit comments

Comments
 (0)